From 1699d651c5595d6c2aa73cf18deca58d082bcb87 Mon Sep 17 00:00:00 2001 From: Louis Knapp Date: Fri, 21 Jul 2017 11:56:22 -0500 Subject: [PATCH] lk | add button for the usual repairs & asterisks for required bike fields --- app/assets/javascripts/bikes.coffee | 8 ++------ app/assets/stylesheets/bikes.css.scss | 4 ++++ app/views/bikes/_fields.html.haml | 27 ++++++++++++++------------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/assets/javascripts/bikes.coffee b/app/assets/javascripts/bikes.coffee index 8cb0589..fd649da 100644 --- a/app/assets/javascripts/bikes.coffee +++ b/app/assets/javascripts/bikes.coffee @@ -1,6 +1,2 @@ -seatTubeIn = $(".seat-tube-in") -seatTubeCm = $(".seat-tube-cm") - -seatTubeIn.on("change", () -> - seatTubeCm.val(parseFloat(seatTubeIn.val())*2.54) -) +theUsualRepairs = "- Trued Front & Rear Wheels\n- Adjusted Front & Rear Gears\n- Adjusted Front & Rear Brakes" +$(document).on('click', '#the-usual', () -> $("#bike_work_done").val(theUsualRepairs) ) diff --git a/app/assets/stylesheets/bikes.css.scss b/app/assets/stylesheets/bikes.css.scss index b5d47a4..99a7a44 100644 --- a/app/assets/stylesheets/bikes.css.scss +++ b/app/assets/stylesheets/bikes.css.scss @@ -5,3 +5,7 @@ .bottom-nav-links { padding-bottom: 5rem; } + +#the-usual { + color: purple; +} diff --git a/app/views/bikes/_fields.html.haml b/app/views/bikes/_fields.html.haml index a0d80b4..d1edfbe 100644 --- a/app/views/bikes/_fields.html.haml +++ b/app/views/bikes/_fields.html.haml @@ -3,7 +3,7 @@ .row .col-sm-6 .form-group - = f.label "Log Number", class: "col-sm-4 control-label" + = f.label "Log Number*", class: "col-sm-4 control-label" .col-sm-6 - if @log_number = f.text_field :log_number, class: "form-control", disabled: disabled, value: @log_number @@ -11,58 +11,58 @@ = f.text_field :log_number, class: "form-control", disabled: disabled .form-group - = f.label "Brand:", class: "col-sm-4 control-label" + = f.label "Brand*", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :brand, class: "col-sm-6 form-control", disabled: disabled .form-group - = f.label "Model:", class: "col-sm-4 control-label" + = f.label "Model*", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :model, class: "form-control", disabled: disabled .form-group - = f.label "Type:", class: "col-sm-4 control-label" + = f.label "Type*", class: "col-sm-4 control-label" .col-sm-6 = f.select :bike_type, options_for_select( Bike.bike_types + [[@bike.bike_type, @bike.bike_type]], @bike.bike_type), {}, class: "selectpicker", disabled: disabled .form-group - = f.label "Color:", class: "col-sm-4 control-label" + = f.label "Color*", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :color, class: "form-control", disabled: disabled .form-group - = f.label "Purpose:", class: "col-sm-4 control-label" + = f.label "Purpose", class: "col-sm-4 control-label" .col-sm-6 = f.select :purpose, [["Freecyclery", "Freecyclery"], ["Sale", "Sale"]], {}, class: "selectpicker", disabled: disabled .col-sm-6 .form-group - = f.label "Mechanic:", class: "col-sm-4 control-label" + = f.label "Mechanic", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :mechanic, class: "form-control", disabled: disabled .form-group - = f.label "Seat Tube Length (cm):", class: "col-sm-4 control-label" + = f.label "Seat Tube Length (cm)", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :seat_tube_size, class: "form-control seat-tube-cm", disabled: disabled .form-group - = f.label "Top Tube Length:", class: "col-sm-4 control-label" + = f.label "Top Tube Length", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :top_tube_size, class: "form-control", disabled: disabled .form-group - = f.label "Serial Number", class: "col-sm-4 control-label" + = f.label "Serial Number*", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :serial_number, class: "form-control", disabled: disabled .form-group - = f.label "Date Fixed:", class: "col-sm-4 control-label" + = f.label "Date Fixed", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :fixed_at, class: "form-control datepicker", :value => @bike.fixed_at ? @bike.fixed_at.strftime("%m/%d/%Y") : "", disabled: disabled .form-group - = f.label "Time Spent (Hours):", class: "col-sm-4 control-label" + = f.label "Time Spent (Hours)", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :time_spent, class: "form-control", type: "number", disabled: disabled @@ -76,6 +76,7 @@ .form-group = f.label "Work Done", class: "col-sm-4 control-label" + %span#the-usual (The Usual) .col-sm-6 = f.text_area :work_done, class: "form-control", disabled: disabled @@ -88,7 +89,7 @@ %a{href: "http://www.bicyclebluebook.com/SearchBikes.aspx"} Look It Up .form-group - = f.label "Date Sold:", class: "col-sm-4 control-label" + = f.label "Date Sold", class: "col-sm-4 control-label" .col-sm-6 = f.text_field :date_sold, :value => @bike.date_sold ? @bike.date_sold.strftime("%m/%d/%Y") : "", class: "form-control datepicker", disabled: disabled