Commit b359ced6 authored by aprilangelo's avatar aprilangelo

Done na

parents ddf0d819 cda8b90f
......@@ -15,6 +15,7 @@ gem 'coffee-rails', '~> 4.1.0'
# gem 'therubyracer', platforms: :ruby
gem 'will_paginate', '~> 3.1'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
......@@ -24,6 +25,8 @@ gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'will_paginate'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
......
......@@ -37,15 +37,20 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.3)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.2)
byebug (9.0.5)
coderay (1.1.1)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
......@@ -147,6 +152,9 @@ GEM
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.1.0)
will_paginate (3.1.0)
PLATFORMS
......@@ -154,6 +162,9 @@ PLATFORMS
DEPENDENCIES
better_errors
better_errors
byebug
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
......@@ -167,6 +178,7 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console (~> 2.0)
will_paginate (~> 3.1)
will_paginate
BUNDLED WITH
1.10.4
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
// Place all the styles related to the car_logs controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class CarLogsController < ApplicationController
def index
@CarLogs = CarLog.all.paginate(:page => params[:page], :per_page => 8)
end
def deletestudent
id = params[:id]
@CarLogs = CarLog.find(id.to_i)
@CarLogs.destroy
redirect_to '/'
end
def addCarLog
end
def addCarLog_post
plate_number= params[:inputPlateNumber]
brand = params[:inputBrand]
slot_number = params[:inputSlotNumber]
is_taken = params[:is_taken]
if !plate_number.empty? && !brand.empty?
newCarlog = CarLog.new
newCarlog.plate_number = plate_number
newCarlog.brand= brand
newCarlog.slot_number = slot_number
newCarlog.is_taken = is_taken
newCarlog.save
redirect_to '/'
else
@error = 'yes'
render 'newCarlog'
end
end
end
......@@ -6,4 +6,8 @@ class PagesController < ApplicationController
def carlogs
render 'carlogs'
end
def index
end
end
module CarLogsHelper
end
<div class="container">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">About</a></li>
<li role="presentation"><a href="#">Contact</a></li>
</ul>
</nav>
<h3 class="text-muted">Project name</h3>
</div>
<br>
<div class="row marketing">
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>Plate Number</th>
<th>Brand</th>
<th>Slot Number</th>
<th>Is Taken</th>
<th> Created At</th>
</tr>
</thead>
<%@CarLogs.each do |item|%>
<tr>
<td><%=item.plate_number%></td>
<td><%=item.plate_number%></td>
<td><%=item.brand%></td>
<td><%=item.slot_number%></td>
<td><%=item.is_taken%></td>
<!--<td><%=@users.average((item.english_grade + item.history_grade + item.science_grade + item.math_grade)/4).round(2) %></td>-->
<td><%= link_to('Delete', 'deletestudent/' + item.id.to_s) %></td>
</tr>
<%end%>
<tbody>
</tbody>
</table>
</div>
</div>
<footer class="footer">
<p>&copy; 2015 Company, Inc.</p>
</footer>
</div> <!-- /container -->
/* Space out content a bit */
body {
padding-top: 20px;
padding-bottom: 20px;
}
/* Everything but the jumbotron gets side spacing for mobile first views */
.header,
.marketing,
.footer {
padding-right: 15px;
padding-left: 15px;
}
/* Custom page header */
.header {
padding-bottom: 20px;
border-bottom: 1px solid #e5e5e5;
}
/* Make the masthead heading the same height as the navigation */
.header h3 {
margin-top: 0;
margin-bottom: 0;
line-height: 40px;
}
/* Custom page footer */
.footer {
padding-top: 19px;
color: #777;
border-top: 1px solid #e5e5e5;
}
/* Customize container */
@media (min-width: 768px) {
.container {
max-width: 730px;
}
}
.container-narrow > hr {
margin: 30px 0;
}
/* Main marketing message and sign up button */
.jumbotron {
text-align: center;
border-bottom: 1px solid #e5e5e5;
}
.jumbotron .btn {
padding: 14px 24px;
font-size: 21px;
}
/* Supporting marketing content */
.marketing {
margin: 40px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
/* Remove the padding we set earlier */
.header,
.marketing,
.footer {
padding-right: 0;
padding-left: 0;
}
/* Space out the masthead */
.header {
margin-bottom: 30px;
}
/* Remove the bottom border on the jumbotron for visual effect */
.jumbotron {
border-bottom: 0;
}
}
<div class="container">
<form class="form-signin">
<h2 class="form-signin-heading">Please Fill Up</h2>
<label for="inputPlateNumber" class="sr-only">Plate number</label>
<input type="text" id="inputPlateNumber" class="form-control" placeholder="Plate Number" required autofocus>
<label for="inputBrand" class="sr-only">Brand</label>
<select name="cars" id="inputBrand" class="form-control" placeholder="Brand">
<option value="volvo">Honda</option>
<option value="saab">Toyota</option>
<option value="fiat">Ford</option>
</select>
<label for="is_taken" class="sr-only">Is taken?</label>
<input type="radio" name="is_taken" value="yes" checked> Yes<br>
<input type="radio" name="gender" value="no"> No<br>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
</div> <!-- /container -->
\ No newline at end of file
......@@ -3,6 +3,8 @@
body {
padding-top: 20px;
background-color: #3d3d3d;
body {
padding-top: 20px;
padding-bottom: 20px;
}
......
<div class="container">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="#">Home</a></li>
</ul>
</nav>
<h3 class="text-muted">Car Log</h3>
</div>
<div class="jumbotron">
<h1>Parking Lot</h1>
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-lg btn-success" href="/carlogs" role="button">View All Car Logs</a></p>
<p><a class="btn btn-lg btn-success" href="#" role="button">Create New Car Log</a></p>
</div>
<div class="row marketing">
<div class="col-lg-6">
<h4>Subheading</h4>
<p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>
<h4>Subheading</h4>
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>
<h4>Subheading</h4>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
</div>
<div class="col-lg-6">
<h4>Subheading</h4>
<p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>
<h4>Subheading</h4>
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>
<h4>Subheading</h4>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
</div>
</div>
<footer class="footer">
<p>&copy; 2015 Company, Inc.</p>
</footer>
</div> <!-- /container -->
......@@ -3,6 +3,8 @@ body {
padding-top: 200px;
padding-bottom: 20px;
padding-top: 20px;
padding-bottom: 20px;
}
/* Everything but the jumbotron gets side spacing for mobile first views */
......@@ -40,6 +42,8 @@ body {
}
}
}
}
.container-narrow > hr {
margin: 30px 0;
}
......
......@@ -18,6 +18,12 @@ Rails.application.routes.draw do
# new
root 'pages#index'
get 'carlogs' => 'car_logs#index'
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
......
......@@ -15,6 +15,10 @@ development:
test:
secret_key_base: 679db63b3a63f70d6c971688e8c253b3dd54c8f725883d5118643795024dcfff46e5f95c2b212804aa568e665ae54a08caa92b527ae9ea10dffdba1f51b71110
secret_key_base: d7801a1c2ba92fc5117ce8a3b180c96bc45a3e6d925c457503f11b7319e6a44633de35cd8c07aa137bfe329321f2b3a3018a5dfb0f91d46aef92323be3c0dd2f
test:
secret_key_base: f343bbad72330abc5d5841ac839687f79ef66821a2aad06f04ec7e89c426585d086058c4c99522e6d4fe5c9b527b0720d4394ebbdb641151341f454a75f418fb
# Do not keep production secrets in the repository,
# instead read values from the environment.
......
class CreateCarLogs < ActiveRecord::Migration
def change
create_table :car_logs do |t|
t.string :plate_number
t.string :brand
t.string :slot_number
t.boolean :is_taken
t.timestamps null: false
end
end
end
require 'test_helper'
class CarLogsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
......@@ -11,3 +11,12 @@ two:
brand: MyString
slot_number: MyString
is_take: false
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment