From 2c98232f461fba759e4af1242804284d72bfa463 Mon Sep 17 00:00:00 2001 From: Louis Knapp Date: Fri, 18 Sep 2015 17:25:06 -0500 Subject: [PATCH] lk | remove unused fields on bikes & fix some formatting --- app/controllers/bikes_controller.rb | 5 ++--- app/controllers/clients_controller.rb | 2 +- app/views/bikes/_fields.html.haml | 8 ++++---- app/views/bikes/print_labels.html.haml | 4 ++-- app/views/clients/_fields.html.haml | 3 ++- app/views/static_pages/home.html.haml | 4 ++-- db/migrate/20150918220734_remove_unused_bike_fields.rb | 6 ++++++ db/migrate/20150918220913_remove_unused_client_fields.rb | 5 +++++ db/migrate/20150918221119_update_bike_field_names.rb | 6 ++++++ db/schema.rb | 9 +++------ notes.txt | 4 +++- 11 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20150918220734_remove_unused_bike_fields.rb create mode 100644 db/migrate/20150918220913_remove_unused_client_fields.rb create mode 100644 db/migrate/20150918221119_update_bike_field_names.rb diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb index 3296802..8886ea7 100644 --- a/app/controllers/bikes_controller.rb +++ b/app/controllers/bikes_controller.rb @@ -51,12 +51,12 @@ class BikesController < ApplicationController end 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]) if @bike.update_attribute(:date_sold, current_date) redirect_to bikes_url, notice: @bike.name + ' was marked as sold on ' + current_date + '.' 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 @@ -82,7 +82,6 @@ class BikesController < ApplicationController :log_number, :purpose, :serial_number, - :notes, :tag_info, :mechanic, :completion_date, diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 2d16b65..94b00e2 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -22,7 +22,7 @@ class ClientsController < ApplicationController if @client.save redirect_to @client, notice: 'Client was successfully created.' else - render action: 'new' + render action: 'new' end end diff --git a/app/views/bikes/_fields.html.haml b/app/views/bikes/_fields.html.haml index a000b2a..da1d8f3 100644 --- a/app/views/bikes/_fields.html.haml +++ b/app/views/bikes/_fields.html.haml @@ -67,14 +67,14 @@ = f.select :purpose, [["Freecyclery", "Freecyclery"], ["Sale", "Sale"]], {}, class: "selectpicker", disabled: disabled .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 - = 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 - = f.label "Notes", class: "col-sm-4 control-label" + = f.label "Work Done", class: "col-sm-4 control-label" .col-sm-6 - = f.text_area :notes, class: "form-control", disabled: disabled + = f.text_area :work_done, class: "form-control", disabled: disabled .form-group = f.label "Date Sold:", class: "col-sm-4 control-label" diff --git a/app/views/bikes/print_labels.html.haml b/app/views/bikes/print_labels.html.haml index 8b732d2..4451437 100644 --- a/app/views/bikes/print_labels.html.haml +++ b/app/views/bikes/print_labels.html.haml @@ -15,10 +15,10 @@ .col-xs-6 .desc .strong Work Done: - =bike.notes + =simple_format(bike.work_done) .col-xs-6 .desc .strong New Parts: - =bike.tag_info + =simple_format(bike.new_parts) .row .col-xs-9.col-xs-offset-3.small= "Log Number: " + bike.log_number.to_s diff --git a/app/views/clients/_fields.html.haml b/app/views/clients/_fields.html.haml index 5d315ab..e1e8cb9 100644 --- a/app/views/clients/_fields.html.haml +++ b/app/views/clients/_fields.html.haml @@ -69,7 +69,8 @@ .form-group = f.label "Notes:", class: "col-sm-2 control-label" .col-sm-10 - = f.text_area :notes, class: "form-control", disabled: disabled + = f.text_area :notes, class: "form-control", disabled: disabled + .form-group = f.label "Bike Fixed:", class: "col-sm-2 control-label" .col-sm-10 diff --git a/app/views/static_pages/home.html.haml b/app/views/static_pages/home.html.haml index 53c7ac7..cd0481d 100644 --- a/app/views/static_pages/home.html.haml +++ b/app/views/static_pages/home.html.haml @@ -5,9 +5,9 @@ %br = link_to "Log Bikes", new_bike_path %br - = link_to "View All Bikes", bikes_path + = link_to "View Bikes", bikes_path %br - = link_to "Print Sale Bike Labels", print_select_bikes_path + = link_to "Print Sale Labels", print_select_bikes_path %br %h2 Freecyclery %br diff --git a/db/migrate/20150918220734_remove_unused_bike_fields.rb b/db/migrate/20150918220734_remove_unused_bike_fields.rb new file mode 100644 index 0000000..27ff1fb --- /dev/null +++ b/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 diff --git a/db/migrate/20150918220913_remove_unused_client_fields.rb b/db/migrate/20150918220913_remove_unused_client_fields.rb new file mode 100644 index 0000000..93ae3b6 --- /dev/null +++ b/db/migrate/20150918220913_remove_unused_client_fields.rb @@ -0,0 +1,5 @@ +class RemoveUnusedClientFields < ActiveRecord::Migration + def change + remove_column :clients, :weight + end +end diff --git a/db/migrate/20150918221119_update_bike_field_names.rb b/db/migrate/20150918221119_update_bike_field_names.rb new file mode 100644 index 0000000..cdaa989 --- /dev/null +++ b/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 diff --git a/db/schema.rb b/db/schema.rb index 4a17497..b92e8aa 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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 enable_extension "plpgsql" @@ -34,8 +34,8 @@ ActiveRecord::Schema.define(version: 20150807011518) do t.string "bike_type" t.string "color" t.string "serial_number" - t.text "notes" - t.text "tag_info" + t.text "work_done" + t.text "new_parts" t.string "completion_date" t.string "price" t.datetime "created_at" @@ -45,8 +45,6 @@ ActiveRecord::Schema.define(version: 20150807011518) do t.integer "log_number" t.text "purpose" t.text "mechanic" - t.text "new_parts" - t.text "work_done" t.date "date_sold" t.integer "bike_index_id" end @@ -57,7 +55,6 @@ ActiveRecord::Schema.define(version: 20150807011518) do t.date "application_date" t.string "gender" t.integer "age" - t.integer "weight" t.boolean "helmet" t.boolean "lock" t.date "completion_date" diff --git a/notes.txt b/notes.txt index 1e6ac0e..856639a 100644 --- a/notes.txt +++ b/notes.txt @@ -2,6 +2,8 @@ Integrate with autocomplete to get manufacturers & models Freecyclery Receipts +enable posting to bike index when a bike is created + Reports General Reports bikes donated per year @@ -10,7 +12,7 @@ Reports bikes donated by year or month. (With bar 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 assign a bike from the available freecyclery bikes page