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
Joshua Verdey
parkinglot
Commits
18e247d0
Commit
18e247d0
authored
Jul 05, 2016
by
Joshua Verdey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
:wq
"midt
parent
7ce2c630
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
26 deletions
+113
-26
car_logs_controller.rb
app/controllers/car_logs_controller.rb
+24
-0
pages_controller.rb
app/controllers/pages_controller.rb
+24
-0
index.html.erb
app/views/car_logs/index.html.erb
+23
-8
create.html.erb
app/views/pages/create.html.erb
+0
-9
index.html.erb
app/views/pages/index.html.erb
+7
-4
new.html.erb
app/views/pages/new.html.erb
+29
-0
routes.rb
config/routes.rb
+6
-5
No files found.
app/controllers/car_logs_controller.rb
View file @
18e247d0
class
CarLogsController
<
ApplicationController
class
CarLogsController
<
ApplicationController
def
index
@car_logs
=
CarLog
.
all
end
def
show
@car_log
=
CarLog
.
find
(
params
[
:id
])
end
def
new
@car_log
=
CarLog
.
new
end
def
create
@car_log
=
CarLog
.
new
(
car_log_params
)
if
@car_log
.
save
redirect_to
@car_log
,
notice:
"User was successfully added!"
else
end
end
end
end
app/controllers/pages_controller.rb
View file @
18e247d0
class
PagesController
<
ApplicationController
class
PagesController
<
ApplicationController
def
index
@car_logs
=
CarLog
.
all
end
def
show
@car_log
=
CarLog
.
find
(
params
[
:id
])
end
def
new
@car_log
=
CarLog
.
new
end
def
create
@car_log
=
CarLog
.
new
(
car_log_params
)
if
@car_log
.
save
redirect_to
@car_log
,
notice:
"User was successfully added!"
else
end
end
end
end
app/views/car_logs/index.html.erb
View file @
18e247d0
<ul
class=
"nav nav-pills"
>
<li
role=
"presentation"
class=
"active"
><a
href=
"/pages"
>
Home
</a></li>
</ul>
<h1>
Car Logs
</h1>
<h1>
Car Logs
</h1>
<table
border=
"1"
>
<table>
<thead>
<thead>
<th>
Plate Number:
</th>
<th>
Brand:
</th>
<th>
Slot Number:
</th>
<th>
Is Taken:
</th>
<th>
Created:
</th>
<th>
Updated:
</th>
</thead>
<tbody>
<%
@car_logs
.
each
do
|
car_log
|
%>
<tr>
<tr>
<td>
Plate Number
</td>
<td>
<%=
car_log
.
plate_number
%>
</td>
<td>
Brand
</td>
<td>
<%=
car_log
.
brand
%>
</td>
<td>
Slot Number
</td>
<td>
<%=
car_log
.
slot_number
%>
</td>
<td>
Is Taken
</td>
<td>
<%=
car_log
.
is_take
%>
</td>
<td>
<%=
car_log
.
created_at
%>
</td>
<td>
<%=
car_log
.
updated_at
%>
</td>
</tr>
</tr>
</thead>
<%
end
%>
</tbody>
</table>
</table>
<a
href=
"../"
>
Back
</a>
\ No newline at end of file
app/views/pages/create.html.erb
deleted
100644 → 0
View file @
7ce2c630
<h1>
Make a new user
</h1>
<select
name =
"brand"
>
<option
value=
"A"
>
A
</option>
<option
value=
"A"
>
A
</option>
<option
value=
"A"
>
A
</option>
</select>
<a
href=
"../"
>
Back
</a>
\ No newline at end of file
app/views/pages/index.html.erb
View file @
18e247d0
<h1>
Hey
</h1>
<h1>
Welcome to the Parking Lot
</h1>
<p>
<a
href=
"car_logs#index"
>
Car Logs
</a>
<ul
class=
"nav nav-pills"
>
<a
href=
"pages#create"
>
Create
</a>
<li
role=
"presentation"
class=
"active"
><a
href=
"car_logs#index"
>
Car Logs
</a></li>
\ No newline at end of file
<li
role=
"presentation"
class=
"active"
><a
href=
"/pages/new"
>
Create
</a></li>
</ul>
</p>
app/views/pages/new.html.erb
0 → 100644
View file @
18e247d0
<ul
class=
"nav nav-pills"
>
<li
role=
"presentation"
class=
"active"
><a
href=
"/pages"
>
Home
</a></li>
</ul>
<h1>
New Car
</h1>
<%=
form_for
(
@car_log
)
do
|
c
|
%>
<p>
<%=
c
.
label
:plate_number
%>
<%=
c
.
text_field
:plate_number
%>
</p>
<p>
<%=
c
.
label
:brand
%>
<select
name =
"brand"
>
<option
value=
"Honda"
>
Honda
</option>
<option
value=
"Toyota"
>
Toyota
</option>
<option
value=
"Ford"
>
Ford
</option>
</select>
</p>
<p>
<%=
c
.
label
:slot_number
%>
<%=
c
.
text_field
:slot_number
%>
</p>
<p>
<%=
c
.
label
:is_taken
%>
<%=
c
.
password_field
:password
%>
</p>
<%=
c
.
submit
%>
<%
end
%>
\ No newline at end of file
config/routes.rb
View file @
18e247d0
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
root
'pages#index'
get
'/pages'
,
to:
'pages#index'
,
as: :car_logs
get
'pages'
=>
'pages#create'
get
'/pages/new'
,
to:
'pages#new'
,
as: :new_car_log
get
'car_logs'
=>
'car_logs#index'
get
'car_logs'
=>
'car_logs#index'
post
'/pages'
,
to:
'pages#create"'
,
as: :car_log
# The priority is based upon order of creation: first created -> highest priority.
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# See how all your routes lay out with "rake routes".
...
...
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