Browse Source

BS3: top menu.

master
Ilya Konanykhin 8 years ago
parent
commit
e8506f6fbc
  1. 10
      app/helpers/application_helper.rb
  2. 2
      app/views/bikes/new.html.haml
  3. 8
      app/views/bikes/show.html.haml
  4. 2
      app/views/task_lists/edit.haml
  5. 2
      app/views/time_entries/index.haml
  6. 2
      app/views/time_entries/new.haml

10
app/helpers/application_helper.rb

@ -8,6 +8,16 @@ module ApplicationHelper
link_to(name, '#', id: "add_#{association.to_s.singularize}" , class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")}) link_to(name, '#', id: "add_#{association.to_s.singularize}" , class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
end end
def top_menu(left, right = nil)
content_tag :div do
[
content_tag(:div, left, class: 'pull-left'),
content_tag(:div, right, class: 'pull-right'),
content_tag(:div, nil, class: 'clearfix'),
].join.html_safe
end
end
def link_to_dashboard def link_to_dashboard
content_tag :p do content_tag :p do
content_tag :a, href: root_path, class: 'btn btn-default', title: 'Back to dashboard' do content_tag :a, href: root_path, class: 'btn btn-default', title: 'Back to dashboard' do

2
app/views/bikes/new.html.haml

@ -1,4 +1,4 @@
= link_to_dashboard = top_menu link_to_dashboard
%h2 Add Bike %h2 Add Bike

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

@ -1,8 +1,8 @@
- if @show_add_bike - btn = if @show_add_bike
%p - capture do
%a{class: "btn btn-lg btn-block btn-info", href: new_bike_path} Add Another Bike? = link_to 'Add Another Bike?', new_bike_path, class: 'btn btn-default'
= link_to_dashboard = top_menu link_to_dashboard, btn
%h2 #{@bike.shop_id}: #{@bike.bike_brand} %h2 #{@bike.shop_id}: #{@bike.bike_brand}
%h2 #{@bike.model} %h2 #{@bike.model}

2
app/views/task_lists/edit.haml

@ -1,4 +1,4 @@
= link_to_dashboard = top_menu link_to_dashboard
%h1 Task List %h1 Task List

2
app/views/time_entries/index.haml

@ -1,4 +1,4 @@
= link_to_dashboard = top_menu link_to_dashboard
%h1 Your Timesheet %h1 Your Timesheet

2
app/views/time_entries/new.haml

@ -1,4 +1,4 @@
= link_to_dashboard = top_menu link_to_dashboard
%h1 Add Time Entry %h1 Add Time Entry

Loading…
Cancel
Save