Skip to content

Commit

Permalink
Merge pull request #116 from ilya-konanykhin/issue-115
Browse files Browse the repository at this point in the history
Issue #115: New top menu for desktop & mobile.
  • Loading branch information
spacemunkay authored Jan 23, 2017
2 parents 6786bf3 + 56ca135 commit 9df4aa3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 17 deletions.
9 changes: 9 additions & 0 deletions app/assets/stylesheets/frontend.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@ fieldset, .fieldset {
display: inline-block;
padding-left: 6px;
padding-right: 6px;
}

.navbar-default {
.navbar-text {
width: 100%;
font-size: 150%;
margin-top: 10px;
margin-bottom: 10px;
}
}
28 changes: 17 additions & 11 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ def link_to_add_fields(name, f, association)
link_to(name, '#', id: "add_#{association.to_s.singularize}" , class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
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
def top_menu(right = nil)
content_tag :nav, class: 'navbar navbar-default' do
content_tag :div, class: 'container-fluid' do
content_tag :div, class: 'row' do
[
content_tag(:div, link_to_dashboard, class: 'col-xs-3'),
content_tag(:div, header_logo, class: 'col-xs-6'),
content_tag(:div, class: 'col-xs-3') { content_tag :div, right, class: 'pull-right' },
].join.html_safe
end
end
end
end

def link_to_dashboard
content_tag :p do
content_tag :a, href: root_path, class: 'btn btn-default', title: 'Back to dashboard' do
content_tag :span, '', class: 'glyphicon glyphicon-home'
end
link_to root_path, class: 'navbar-brand', title: 'Back to dashboard' do
content_tag :i, '', class: "glyphicon glyphicon-home"
end
end

def header_logo
content_tag :div, 'Velocipede', class: 'navbar-text text-center'
end
end
2 changes: 1 addition & 1 deletion app/views/bikes/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= top_menu link_to_dashboard
= top_menu

%h1 Add Bike

Expand Down
6 changes: 4 additions & 2 deletions app/views/bikes/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
- btn = if @show_add_bike
- capture do
= link_to 'Add Another Bike?', new_bike_path, class: 'btn btn-default'
= link_to 'Add Another Bike?', new_bike_path, class: 'btn btn-default navbar-btn hidden-xs'
= link_to new_bike_path, class: 'navbar-brand visible-xs', title: 'Add Another Bike?' do
%i.glyphicon.glyphicon-plus

= top_menu link_to_dashboard, btn
= top_menu btn

%h1 #{@bike.shop_id}: #{@bike.bike_brand}
%h4= @bike.model
Expand Down
2 changes: 1 addition & 1 deletion app/views/task_lists/edit.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= top_menu link_to_dashboard
= top_menu

%h1 Task List

Expand Down
2 changes: 1 addition & 1 deletion app/views/time_entries/index.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= top_menu link_to_dashboard
= top_menu

%h1 Your Timesheet

Expand Down
2 changes: 1 addition & 1 deletion app/views/time_entries/new.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= top_menu link_to_dashboard
= top_menu

%h1 Add Time Entry
- time = Time.now
Expand Down

0 comments on commit 9df4aa3

Please sign in to comment.