Louis | Adds clients model & views to db

This commit is contained in:
Loos
2014-09-16 20:50:58 -04:00
parent 3c8962fa49
commit d3403e18cd
17 changed files with 237 additions and 21 deletions
+49
View File
@@ -0,0 +1,49 @@
- disabled ||= false
.form-horizontal
.form-group
= f.label "First Name", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :first_name, class: "form-control", disabled: disabled
.form-group
= f.label "Last Name", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :last_name, class: "form-control datepicker", disabled: disabled
.form-group
= f.label "Gender", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :gender, class: "form-control", disabled: disabled
.form-group
= f.label "Age", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :age, class: "form-control", disabled: disabled
.form-group
= f.label "Weight", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :weight, class: "form-control", disabled: disabled
.form-group
= f.label "Application Date:", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :application_date, class: "form-control", disabled: disabled
.form-group
= f.label "Helmet", class: "col-sm-2 control-label"
.col-sm-10
= f.check_box :helmet, class: "form-control", disabled: disabled
.form-group
= f.label "Lock", class: "col-sm-2 control-label"
.col-sm-10
= f.check_box :lock, class: "form-control", disabled: disabled
.form-group
= f.label "Agency", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :agency, class: "form-control", disabled: disabled
.form-group
= f.label "Completion Date:", class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :completion_date, class: "form-control datepicker", disabled: disabled
+12
View File
@@ -0,0 +1,12 @@
.container
= form_for @client, html: {class: 'form-horizontal'} do |f|
- if @client.errors.any?
#error_explanation
%h2= pluralize(@client.errors.count, "error") + " prohibited this bike from being saved:"
%ul
- @client.errors.full_messages.each do |msg|
%li= msg
= render 'fields', f: f
.row
.actions.col-sm-offset-2
= f.submit class: "btn btn-default"
+6
View File
@@ -0,0 +1,6 @@
.container
%h1 Editing client
= render 'form'
= link_to 'Show', @client
|
= link_to 'Back', clients_path
+24
View File
@@ -0,0 +1,24 @@
.container
%h1 Clients
%table.table.table-striped.table-bordered.table-hover
%thead
%tr
%th First Name
%th Last Name
%th Agency
%th
%th
%th
%tbody
- @clients.each do |client|
%tr
%td= client.first_name
%td= client.last_name
%td= client.agency
%td= link_to 'Show', client
%td= link_to 'Edit', edit_client_path(client)
%td= link_to 'Destroy', client, method: :delete, data: { confirm: 'Are you sure?' }
%br
= link_to ' + New Client', new_client_path, class: "btn btn-default"
+3
View File
@@ -0,0 +1,3 @@
%h1 New Client
= render 'form'
= link_to 'Back', clients_path
+7
View File
@@ -0,0 +1,7 @@
.container
%p#notice= notice
= form_for(@client) do |f|
= render 'fields', f: f, disabled: true
= link_to 'Edit', edit_client_path(@client)
|
= link_to 'Back', clients_path
+1 -1
View File
@@ -12,7 +12,7 @@
<div class="navbar-collapse collapse navbar-responsive-collapse" id='collapse-1'>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Bikes", bikes_path %></li>
<li><%= link_to "Volunteers", volunteers_path %></li>
<li><%= link_to "Clients", clients_path %></li>
</ul>
</div>
</nav>