From 1106e080986ea6db0abffe1a1676d7922e27015c Mon Sep 17 00:00:00 2001 From: Ilya Konanykhin Date: Thu, 22 Dec 2016 23:47:11 +0600 Subject: [PATCH] BS3: show bike. --- app/assets/stylesheets/frontend.scss | 6 +++++ app/controllers/bikes_controller.rb | 2 +- app/views/bikes/show.html.haml | 37 +++++++++++++++++++--------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/assets/stylesheets/frontend.scss b/app/assets/stylesheets/frontend.scss index 0511002..95aba83 100644 --- a/app/assets/stylesheets/frontend.scss +++ b/app/assets/stylesheets/frontend.scss @@ -15,4 +15,10 @@ fieldset, .fieldset { .form-group { vertical-align: top; } +} + +.bike-color { + display: inline-block; + padding-left: 6px; + padding-right: 6px; } \ No newline at end of file diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb index 981ccd3..4be68b9 100644 --- a/app/controllers/bikes_controller.rb +++ b/app/controllers/bikes_controller.rb @@ -9,7 +9,7 @@ class BikesController < AuthenticatedController def show @bike = Bike.find_by_id(params[:id]) - @task_list_id = @bike.task_list.id + @task_list = @bike.task_list @show_add_bike = true if params[:add_bike] end diff --git a/app/views/bikes/show.html.haml b/app/views/bikes/show.html.haml index 941ac5b..047a575 100644 --- a/app/views/bikes/show.html.haml +++ b/app/views/bikes/show.html.haml @@ -4,24 +4,37 @@ = top_menu link_to_dashboard, btn -%h2 #{@bike.shop_id}: #{@bike.bike_brand} -%h2 #{@bike.model} +%h1 #{@bike.shop_id}: #{@bike.bike_brand} +%h4= @bike.model %dl.dl-horizontal %dt Type - %dd #{@bike.bike_style} + %dd= @bike.bike_style + %dt Wheel Size - %dd #{@bike.bike_wheel_size.display_string} + %dd= @bike.bike_wheel_size.display_string + %dt Condition - %dd #{@bike.bike_condition} + %dd= @bike.bike_condition + %dt Seat Tube (cm) - %dd #{@bike.seat_tube_height} + %dd= @bike.seat_tube_height + %dt Purpose - %dd #{@bike.bike_purpose} - - if !@bike.value.nil? + %dd= @bike.bike_purpose + + - unless @bike.value.nil? %dt Value - %dd #{@bike.value} - - if !@bike.color.nil? + %dd= @bike.value + + - unless @bike.color.nil? %dt Color - %dd{ style: "width: 50px; background-color: ##{@bike.color}; border: black; border-width: 1px; border-style: solid;"} #{@bike.color} -%a{class: "btn btn-lg btn-block btn-primary", href: edit_task_list_path(@task_list_id) } View Checklist + %dd + .bike-color{style: "background-color: ##{@bike.color}"} #{@bike.color} + + - if @task_list + - tasks = @task_list.tasks.to_a + %dt Task list + %dd + = link_to edit_task_list_path(@task_list.id) do + #{tasks.select(&:done).count}/#{tasks.count} \ No newline at end of file