summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-25 16:03:18 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-25 16:03:18 -0400
commit1e1785cc1699f33e4c1f98cde71fc19d1be10d6a (patch)
treea71bf50b6ac9f3e480bafb398d35386da3c696a8
parent96593d79f93ad1ae18ad24545adc0e16c4a7e4ff (diff)
downloadgitlab-ce-rs-minor-styles.tar.gz
Place the logo's tooltip dynamicallyrs-minor-styles
When collapsed it's on the right like everything else, when expanded it's on the bottom.
-rw-r--r--app/assets/javascripts/application.js.coffee8
-rw-r--r--app/views/layouts/_head_panel.html.haml2
2 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index eb6ecaa4835..bb9da147018 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -134,6 +134,14 @@ $ ->
# Initialize tooltips
$('body').tooltip({
selector: '.has_tooltip, [data-toggle="tooltip"], .page-sidebar-collapsed .nav-sidebar a'
+ placement: (_, el) ->
+ $el = $(el)
+ if $el.attr('id') == 'js-shortcuts-home'
+ # Place the logo tooltip on the right when collapsed, bottom when expanded
+ $el.parents('header').hasClass('header-collapsed') and 'right' or 'bottom'
+ else
+ # Otherwise use the data-placement attribute like normal
+ $el.data('placement')
})
# Form submitter
diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml
index 83387ad9026..8d4c7b39b19 100644
--- a/app/views/layouts/_head_panel.html.haml
+++ b/app/views/layouts/_head_panel.html.haml
@@ -2,7 +2,7 @@
.navbar-inner
.container
%div.app_logo
- = link_to root_path, class: 'home', title: 'Dashboard', data: {toggle: 'tooltip', placement: 'bottom'} do
+ = link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do
= brand_header_logo
%h3 GitLab
%h1.title= title