Browse Source

lk | remove unused fields on bikes & fix some formatting

master
Louis Knapp 9 years ago
parent
commit
2c98232f46
  1. 5
      app/controllers/bikes_controller.rb
  2. 2
      app/controllers/clients_controller.rb
  3. 8
      app/views/bikes/_fields.html.haml
  4. 4
      app/views/bikes/print_labels.html.haml
  5. 3
      app/views/clients/_fields.html.haml
  6. 4
      app/views/static_pages/home.html.haml
  7. 6
      db/migrate/20150918220734_remove_unused_bike_fields.rb
  8. 5
      db/migrate/20150918220913_remove_unused_client_fields.rb
  9. 6
      db/migrate/20150918221119_update_bike_field_names.rb
  10. 9
      db/schema.rb
  11. 4
      notes.txt

5
app/controllers/bikes_controller.rb

@ -51,12 +51,12 @@ class BikesController < ApplicationController
end end
def mark_as_sold def mark_as_sold
current_date = Time.new.strftime("%Y-%m-%d") current_date = Time.new.strftime("%Y-%m-%d")
@bike = Bike.find(params[:id]) @bike = Bike.find(params[:id])
if @bike.update_attribute(:date_sold, current_date) if @bike.update_attribute(:date_sold, current_date)
redirect_to bikes_url, notice: @bike.name + ' was marked as sold on ' + current_date + '.' redirect_to bikes_url, notice: @bike.name + ' was marked as sold on ' + current_date + '.'
else else
render action: edit, notice: 'Bike sale date could not be updated' render action: edit, notice: 'Bike sale date could not be updated'
end end
end end
@ -82,7 +82,6 @@ class BikesController < ApplicationController
:log_number, :log_number,
:purpose, :purpose,
:serial_number, :serial_number,
:notes,
:tag_info, :tag_info,
:mechanic, :mechanic,
:completion_date, :completion_date,

2
app/controllers/clients_controller.rb

@ -22,7 +22,7 @@ class ClientsController < ApplicationController
if @client.save if @client.save
redirect_to @client, notice: 'Client was successfully created.' redirect_to @client, notice: 'Client was successfully created.'
else else
render action: 'new' render action: 'new'
end end
end end

8
app/views/bikes/_fields.html.haml

@ -67,14 +67,14 @@
= f.select :purpose, [["Freecyclery", "Freecyclery"], ["Sale", "Sale"]], {}, class: "selectpicker", disabled: disabled = f.select :purpose, [["Freecyclery", "Freecyclery"], ["Sale", "Sale"]], {}, class: "selectpicker", disabled: disabled
.form-group .form-group
= f.label "Tag Info", class: "col-sm-4 control-label" = f.label "New Parts", class: "col-sm-4 control-label"
.col-sm-6 .col-sm-6
= f.text_area :tag_info, class: "form-control", placeholder: "+ New Component ", disabled: disabled = f.text_area :new_parts, class: "form-control", placeholder: "+ New Component ", disabled: disabled
.form-group .form-group
= f.label "Notes", class: "col-sm-4 control-label" = f.label "Work Done", class: "col-sm-4 control-label"
.col-sm-6 .col-sm-6
= f.text_area :notes, class: "form-control", disabled: disabled = f.text_area :work_done, class: "form-control", disabled: disabled
.form-group .form-group
= f.label "Date Sold:", class: "col-sm-4 control-label" = f.label "Date Sold:", class: "col-sm-4 control-label"

4
app/views/bikes/print_labels.html.haml

@ -15,10 +15,10 @@
.col-xs-6 .col-xs-6
.desc .desc
.strong Work Done: .strong Work Done:
=bike.notes =simple_format(bike.work_done)
.col-xs-6 .col-xs-6
.desc .desc
.strong New Parts: .strong New Parts:
=bike.tag_info =simple_format(bike.new_parts)
.row .row
.col-xs-9.col-xs-offset-3.small= "Log Number: " + bike.log_number.to_s .col-xs-9.col-xs-offset-3.small= "Log Number: " + bike.log_number.to_s

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

@ -69,7 +69,8 @@
.form-group .form-group
= f.label "Notes:", class: "col-sm-2 control-label" = f.label "Notes:", class: "col-sm-2 control-label"
.col-sm-10 .col-sm-10
= f.text_area :notes, class: "form-control", disabled: disabled = f.text_area :notes, class: "form-control", disabled: disabled
.form-group .form-group
= f.label "Bike Fixed:", class: "col-sm-2 control-label" = f.label "Bike Fixed:", class: "col-sm-2 control-label"
.col-sm-10 .col-sm-10

4
app/views/static_pages/home.html.haml

@ -5,9 +5,9 @@
%br %br
= link_to "Log Bikes", new_bike_path = link_to "Log Bikes", new_bike_path
%br %br
= link_to "View All Bikes", bikes_path = link_to "View Bikes", bikes_path
%br %br
= link_to "Print Sale Bike Labels", print_select_bikes_path = link_to "Print Sale Labels", print_select_bikes_path
%br %br
%h2 Freecyclery %h2 Freecyclery
%br %br

6
db/migrate/20150918220734_remove_unused_bike_fields.rb

@ -0,0 +1,6 @@
class RemoveUnusedBikeFields < ActiveRecord::Migration
def change
remove_column :bikes, :work_done
remove_column :bikes, :new_parts
end
end

5
db/migrate/20150918220913_remove_unused_client_fields.rb

@ -0,0 +1,5 @@
class RemoveUnusedClientFields < ActiveRecord::Migration
def change
remove_column :clients, :weight
end
end

6
db/migrate/20150918221119_update_bike_field_names.rb

@ -0,0 +1,6 @@
class UpdateBikeFieldNames < ActiveRecord::Migration
def change
rename_column :bikes, :notes, :work_done
rename_column :bikes, :tag_info, :new_parts
end
end

9
db/schema.rb

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150807011518) do ActiveRecord::Schema.define(version: 20150918221119) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -34,8 +34,8 @@ ActiveRecord::Schema.define(version: 20150807011518) do
t.string "bike_type" t.string "bike_type"
t.string "color" t.string "color"
t.string "serial_number" t.string "serial_number"
t.text "notes" t.text "work_done"
t.text "tag_info" t.text "new_parts"
t.string "completion_date" t.string "completion_date"
t.string "price" t.string "price"
t.datetime "created_at" t.datetime "created_at"
@ -45,8 +45,6 @@ ActiveRecord::Schema.define(version: 20150807011518) do
t.integer "log_number" t.integer "log_number"
t.text "purpose" t.text "purpose"
t.text "mechanic" t.text "mechanic"
t.text "new_parts"
t.text "work_done"
t.date "date_sold" t.date "date_sold"
t.integer "bike_index_id" t.integer "bike_index_id"
end end
@ -57,7 +55,6 @@ ActiveRecord::Schema.define(version: 20150807011518) do
t.date "application_date" t.date "application_date"
t.string "gender" t.string "gender"
t.integer "age" t.integer "age"
t.integer "weight"
t.boolean "helmet" t.boolean "helmet"
t.boolean "lock" t.boolean "lock"
t.date "completion_date" t.date "completion_date"

4
notes.txt

@ -2,6 +2,8 @@ Integrate with autocomplete to get manufacturers & models
Freecyclery Receipts Freecyclery Receipts
enable posting to bike index when a bike is created
Reports Reports
General Reports General Reports
bikes donated per year bikes donated per year
@ -10,7 +12,7 @@ Reports
bikes donated by year or month. (With bar graph!?) bikes donated by year or month. (With bar graph!?)
bikes donated according to agency. (Graph?) bikes donated according to agency. (Graph?)
Add some way to navigate to client receipts Add way to navigate to client receipts
style client receipts style client receipts
assign a bike from the available freecyclery bikes page assign a bike from the available freecyclery bikes page

Loading…
Cancel
Save