Browse Source

lk | removes show action for clients

master
Louis Knapp 9 years ago
parent
commit
9f9cf5e6ba
  1. 19
      app/controllers/clients_controller.rb
  2. 4
      app/models/bike.rb
  3. 3
      app/views/clients/_fields.html.haml
  4. 2
      app/views/clients/edit.html.haml
  5. 8
      app/views/clients/index.html.haml
  6. 7
      app/views/clients/show.html.haml
  7. 4
      app/views/freecyclery/closed_applications.html.haml
  8. 12
      notes.txt

19
app/controllers/clients_controller.rb

@ -1,5 +1,5 @@
class ClientsController < ApplicationController
before_action :set_client, only: [:show, :edit, :update, :destroy]
before_action :set_client, only: [:edit, :update]
before_action :authenticate_user!
def index
@ -7,20 +7,16 @@ class ClientsController < ApplicationController
@clients = Client.all
end
def show
end
def new
@client = Client.new
end
def edit
end
def edit; end
def create
@client = Client.new(client_params)
if @client.save
redirect_to @client, notice: 'Client was successfully created.'
redirect_to edit_client_url(@client), notice: 'Client was successfully created.'
else
render action: 'new'
end
@ -28,19 +24,12 @@ class ClientsController < ApplicationController
def update
if @client.update(client_params)
redirect_to @client, notice: 'Client was successfully updated.'
redirect_to edit_client_url(@client), notice: 'Client was successfully updated.'
else
render action: 'edit'
end
end
def destroy
@client.destroy
respond_to do |format|
format.html { redirect_to clients_url }
end
end
private
def set_client
@client = Client.find(params[:id])

4
app/models/bike.rb

@ -39,7 +39,9 @@ class Bike < ActiveRecord::Base
end
def self.available_for_freecyclery
Bike.order(log_number: :desc).select{|bike| bike.completion_date && (bike.purpose == "Freecyclery")}
assigned_bikes = Client.all.select{|c| !c.bike_id.nil?}.map(&:bike)
all_freecyclery_bikes = Bike.order(log_number: :desc).select{|bike| bike.completion_date && (bike.purpose == "Freecyclery")}
all_freecyclery_bikes - assigned_bikes
end
def mark_picked_up

3
app/views/clients/_fields.html.haml

@ -63,6 +63,9 @@
.form-group
= f.label "Bike:", class: "col-sm-2 control-label"
.col-sm-10
- if @client.bike_id
= f.select :bike_id, options_for_select( Bike.available_for_freecyclery.collect{|b| [ b.name, b.id ]} + [[@client.bike.name, @client.bike_id]], @client.bike_id ), {include_blank: 'None'}, class: "selectpicker", disabled: disabled
- else
= f.select :bike_id, options_for_select( Bike.available_for_freecyclery.collect{|b| [ b.name, b.id ]}, @client.bike_id ), {include_blank: 'None'}, class: "selectpicker", disabled: disabled
.form-group

2
app/views/clients/edit.html.haml

@ -1,6 +1,4 @@
.container
%h1 Edit client
= render 'form'
= link_to 'Show', @client
|
= link_to 'Back', clients_path

8
app/views/clients/index.html.haml

@ -13,8 +13,6 @@
%th Application Date
%th Agency
%th
%th
%th
%tbody
- @waiting_list.each_with_index do |client, index|
%tr
@ -23,9 +21,7 @@
%td= client.last_name
%td= client.application_date
%td= client.agency.agency_name if 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
.row
@ -38,16 +34,12 @@
%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.agency_name if 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

7
app/views/clients/show.html.haml

@ -1,7 +0,0 @@
.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

4
app/views/freecyclery/closed_applications.html.haml

@ -8,12 +8,12 @@
%th Name
%th Voided
%th Completed
%th Show
%th Edit
%tbody
- @closed_applications.each do |client|
%tr
%td= client.name
%td= client.application_voided
%td= client.completion_date
%td= link_to 'Show', client
%td= link_to 'Edit', edit_client_path(client)
%br

12
notes.txt

@ -2,24 +2,16 @@ when bike gets picked up, remove it from freecyclery bike list
when visiting user page check if they have a bike and add it to
the list
available freecyclery bikes list should have all the infos - size,
make, model, color, etc
make sure you can mark bike completion dates
bikes ready for pickup should also include color & log number
clients should not be on waiting list after they get assigned a bike
Freecyclery Receipts
print sales labels should not show freecyclery bikes
search for bike based on log #
convert to bootstrap-less or something
convert to bootstrap-less
integrate with autocomplete to get manufacturers & models
enable posting to bike index when a bike is created
Freecyclery Receipts
Reports
General Reports

Loading…
Cancel
Save