From 2dd48c5b657eb9a7a0008c4f550d693d5b27567e Mon Sep 17 00:00:00 2001 From: Ilya Konanykhin Date: Thu, 22 Dec 2016 20:57:42 +0600 Subject: [PATCH] BS3: dashboard. --- app/assets/stylesheets/frontend.scss | 2 +- app/views/site/index.html.haml | 45 +++++++++++++++++----------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/frontend.scss b/app/assets/stylesheets/frontend.scss index 991a1ec..e573657 100644 --- a/app/assets/stylesheets/frontend.scss +++ b/app/assets/stylesheets/frontend.scss @@ -6,7 +6,7 @@ body { white-space: nowrap; } -fieldset { +fieldset, .fieldset { margin-top: $line-height-computed; margin-bottom: $line-height-computed; } \ No newline at end of file diff --git a/app/views/site/index.html.haml b/app/views/site/index.html.haml index 50e7697..2f155a1 100644 --- a/app/views/site/index.html.haml +++ b/app/views/site/index.html.haml @@ -1,20 +1,31 @@ -%h2 Dashboard +%h1 Dashboard -%p - %p - %a{class: "btn btn-lg btn-block btn-primary", href: new_time_entry_path} Add Time Entry - %p - %a{class: "btn btn-lg btn-block btn-primary", href: time_entries_path} View Timesheet -- if can? :manage, Bike - %p - %a{class: "btn btn-lg btn-block btn-primary", href: new_bike_path} Add Bike +.row.fieldset + .col-xs-8.col-sm-3.col-lg-2 + %p= link_to 'Add Time Entry', new_time_entry_path, class: 'btn btn-default btn-block' + .col-xs-8.col-sm-3.col-lg-2 + %p= link_to 'View Timesheet', time_entries_path, class: 'btn btn-default btn-block' -- if !@bike.nil? - %p - %a{class: "btn btn-lg btn-block btn-primary", href: bike_path(@bike)} View Your Bike +- can_manage_bike = can? :manage, Bike +- has_bike = !@bike.nil? +- if can_manage_bike || has_bike + .row.fieldset + - if can_manage_bike + .col-xs-8.col-sm-3.col-lg-2 + %p + = link_to 'Add Bike', new_bike_path, class: 'btn btn-default btn-block' -%p - %p - %a{class: "btn btn-lg btn-block btn-primary hidden-xs", href: admin_index_path} Desktop View - %p - %input{id: "index_logout", value: "Logout", type: "button", class: "btn btn-lg btn-block btn-danger", "data-url" => destroy_user_session_path } + - if has_bike + .col-xs-8.col-sm-3.col-lg-2 + %p + = link_to 'View Your Bike', bike_path(@bike), class: 'btn btn-default btn-block' + +.row.fieldset.hidden-xs + .col-xs-8.col-sm-3.col-lg-2 + %p + = link_to 'Desktop View', admin_index_path, class: 'btn btn-default btn-block' + +.row.fieldset + .col-xs-8.col-sm-3.col-lg-2 + %p + %input{id: 'index_logout', value: 'Logout', type: 'button', class: 'btn btn-danger btn-block', 'data-url' => destroy_user_session_path} \ No newline at end of file