Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
parkinglot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MiiikoLang
parkinglot
Commits
f5c88855
Commit
f5c88855
authored
Jul 05, 2016
by
Francesco Martin Mamaradlo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Paayos na lang. No delete and design pa.
parent
4ded60ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
11 deletions
+30
-11
car_logs_controller.rb
parkinglot/app/controllers/car_logs_controller.rb
+12
-11
add_cars.html.erb
parkinglot/app/views/car_logs/add_cars.html.erb
+9
-0
index.html.erb
parkinglot/app/views/car_logs/index.html.erb
+8
-0
routes.rb
parkinglot/config/routes.rb
+1
-0
No files found.
parkinglot/app/controllers/car_logs_controller.rb
View file @
f5c88855
class
CarLogsController
<
ApplicationController
def
index
#@car_logs = Car_Log.all
@car_logs
=
Car_Log
.
all
render
"car_logs/index.html.erb"
end
...
...
@@ -8,16 +9,16 @@ class CarLogsController < ApplicationController
render
"car_logs/add_cars.html.erb"
end
#
def create
#
car_log = Car_Log.new
#
car_log.plate_number = params[:plate_number]
#
car_log.time_in = params[:time_in]
#
car_log.time_out = params[:time_out]
#
car_log.color = params[:color]
#
car_log.brand = params[:brand]
#
car_log.save
# redirect_to "/car_logs/index
"
#
end
def
create
car_log
=
Car_Log
.
new
car_log
.
plate_number
=
params
[
:plate_number
]
car_log
.
time_in
=
params
[
:time_in
]
car_log
.
time_out
=
params
[
:time_out
]
car_log
.
color
=
params
[
:color
]
car_log
.
brand
=
params
[
:brand
]
car_log
.
save
redirect_to
"/car_logs
"
end
end
parkinglot/app/views/car_logs/add_cars.html.erb
View file @
f5c88855
...
...
@@ -17,5 +17,14 @@
<option
value=
"black"
>
black
</option>
<option
value=
"others"
>
others
</option>
</select>
<label>
Brand
</label>
<select>
<option
value=
"Honda"
>
Honda
</option>
<option
value=
"Toyota"
>
Toyota
</option>
<option
value=
"Ford"
>
Ford
</option>
</select>
<input
type=
"submit"
value=
"Save to Car Log"
>
<%
end
%>
\ No newline at end of file
parkinglot/app/views/car_logs/index.html.erb
View file @
f5c88855
<h1>
Car Records
</h1>
<ul>
<%
@car_logs
.
each
do
|
car_log
|
%>
<li>
<%=
"
#{
car_log
.
plate_number
}
#{
car_log
.
time_in
}
-
#{
car_log
.
time_out
}
#{
car_log
.
color
}
#{
car_log
.
brand
}
"
%>
</li>
<%
end
%>
</ul>
<a
href=
"/car_logs/add"
>
Add Entry
</a>
\ No newline at end of file
parkinglot/config/routes.rb
View file @
f5c88855
...
...
@@ -3,4 +3,5 @@ Rails.application.routes.draw do
get
"/pages"
,
to:
"pages#creators"
get
"/car_logs"
,
to:
"car_logs#index"
get
"/car_logs/add"
,
to:
"car_logs#add"
post
"/car_logs/create"
,
to:
"car_logs#create"
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment