i

parent 3c55e232
......@@ -13,7 +13,7 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass', '~> 3.3.6'
# 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
......@@ -28,7 +28,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use Unicorn as the app server
# gem 'unicorn'
gem 'twitter-bootstrap-rails'
# gem 'twitter-bootstrap-rails'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
......
......@@ -37,12 +37,17 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.3)
autoprefixer-rails (6.3.6.2)
execjs
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)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.2)
byebug (9.0.5)
coderay (1.1.1)
......@@ -53,7 +58,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.10.0)
commonjs (0.2.7)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
erubis (2.7.0)
......@@ -69,13 +73,6 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
less (2.6.0)
commonjs (~> 0.2.7)
less-rails (2.7.1)
actionpack (>= 4.0)
less (~> 2.6.0)
sprockets (> 2, < 4)
tilt
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
......@@ -144,11 +141,6 @@ GEM
turbolinks (5.0.0)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
twitter-bootstrap-rails (3.2.2)
actionpack (>= 3.1)
execjs (>= 2.2.2, >= 2.2)
less-rails (>= 2.5.0)
railties (>= 3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2016.5)
......@@ -166,6 +158,7 @@ PLATFORMS
DEPENDENCIES
better_errors
bootstrap-sass (~> 3.3.6)
byebug
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
......@@ -175,7 +168,6 @@ DEPENDENCIES
sdoc (~> 0.4.0)
sqlite3
turbolinks
twitter-bootstrap-rails
tzinfo-data
uglifier (>= 1.3.0)
web-console (~> 2.0)
......
......@@ -11,6 +11,7 @@
// about supported directives.
//
//= require jquery
//= require bootstrap-sprockets
//= require jquery_ujs
//= require turbolinks
//= require_tree .
This diff is collapsed.
@import "bootstrap-sprockets";
@import "bootstrap";
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
......@@ -10,6 +12,5 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
class CarLogsController < ApplicationController
def index
def records
@carlogs = CarLog.all
end
#displays one user
def show
@carlogs = CarLog.find(params[:id])
end
#Instantiate a new
def new
@carlogs = CarLog.new
# render 'users/new'
@carlog = CarLog.new
# @carlogs.plate_number = params[:plate_number]
# @carlogs.brand = params[:brand]
# @carlogs.slot_number = params[:slot_number]
# @carlogs.is_taken = params[:is_taken]
@carlog.plate_number = params[:plate_number]
@carlog.brand = params[:brand]
@carlog.slot_number = params[:slot_number]
@carlog.is_taken = params[:is_taken]
@carlog.save
end
# render 'users/new'
#Creates a new user
def log
@carlogs = CarLog.new(cars_params)
if @carlogs.save
# this will display one user page
redirect_to @carlogs, notice: "Car was successfully logged in!"
else
# this will return to the form to create a user
@error = 'yes'
render 'index'
def deletecarlog
id = params[:id]
@carlog = CarLog.find(id.to_i)
@carlog.destroy
redirect_to '/'
end
private
# This will limit the parameters for :user
# if there are otber parameters, e.g. :post, these will not be included
def carlog_params
params.require(:car_logs).permit!
end
end
class PagesController < ApplicationController
def index
end
end
class CarLog < ActiveRecord::Base
end
<h1 align="center">Log new car</h1>
<%= form_tag("/new", method: "post", class: 'form-signin') do=%>
<div class="row">
<div class="col-md-4 col-md-offset-4">
<p>
<label class="sr-only"> Plate Number: </label>
<input type="text" name="inputPlateNumber" id="plate_number" class="form-control" placeholder="Plate Number" maxlength="15">
</p>
<p align="center">
<label class="sr-only"> Brand </label>
<select name="brand" id="brand">
<option value="Toyota">Toyota</option>
<option value="Mazda">Mazda</option>
<option value="Ford">Ford</option>
<option value="Mitsubishi">Mitsubishi</option>
</select>
</p>
<p>
<label class="sr-only"> Slot Number: </label>
<input type="text" name="inputSlotNumber" id="slot_number" class="form-control" placeholder="Slot Number" maxlength="30">
</p>
<p>
<div class="checkbox">
<label>
<input type="checkbox" id="is_taken" value="option1">
Is taken?
</label>
</div>
</p>
</div>
</div>
<% end %>
<%= link_to "Records", records_path %>
\ No newline at end of file
<style type="text/css">
table{
border-color: black;
}
</style>
<h1 align="center">Parking Lot Records</h1>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<table class="table table-bordered">
<thead>
<tr>
<th>plate_number</th>
<th>brand</th>
<th>slot_number</th>
<th>is_taken</th>
<th>created_at</th>
<th>updated_at</th>
</tr>
</thead>
<tbody>
<%@carlogs.each do |carlog| %>
<tr>
<td><%= carlog.plate_number %></td>
<td><%= carlog.brand %></td>
<td><%= carlog.slot_number %></td>
<td><%= carlog.is_taken %></td>
<td><%= carlog.created_at %></td>
<td><%= carlog.updated_at %></td>
<td><%= link_to('Delete', 'deletecarlog/' + carlog.id.to_s) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<%= link_to "Create New form", new_path %>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Parkinglot</title>
<title>The Parking Lot</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
......
<h1><center>The Parking Lot</center></h1>
<br><br><br><br><br>
<p align="center"><%= link_to 'Records', records_path %></p>
\ No newline at end of file
<p align="center"><button class="button btn-success"><%= link_to 'Records', records_path %></button></p>
\ No newline at end of file
<h1><center>Parking Lot Records</center></h1>
<table>
<thead>
<th>"plate_number"</th>
<th>"brand"</th>
<th>"slot_number"</th>
<th>"is_taken"</th>
<th>"created_at"</th>
<th>"updated_at"</th>
</thead>
<tbody>
</tbody>
</table>
\ No newline at end of file
Rails.application.routes.draw do
root 'car_logs#index'
get 'car_logs/index' => 'car_logs#index'
get 'records' => 'pages#records'
root 'pages#index'
get '/car_logs/records', to: 'car_logs#records', as: :records
get '/car_logs/new' => 'car_logs#new', as: :new
post '/car_logs/new', to: 'car_logs#_post', as: :new_post
get 'deletecarlog/:id' => 'car_logs#deletecarlog'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
......
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