summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-23 17:32:56 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-25 14:03:40 -0400
commite8faf9178aa853b8f58f6f5e3b417afcead0ce4c (patch)
treec861846e90c91c4146fe64fe1324cacc47f02ebd
parentc597b5d09d7ce9d91d6e4e171302611298f59d35 (diff)
downloadgitlab-ce-e8faf9178aa853b8f58f6f5e3b417afcead0ce4c.tar.gz
Remove the `has_bottom_tooltip` class
Bootstrap's tooltip JS can read the placement from a `data-placement` attribute. Further, when we supply the `selector` option to `tooltip`, tooltips will be added to any dynamically-added elements matching the selector, without us having to re-call the `tooltip` method.
-rw-r--r--app/assets/javascripts/application.js.coffee7
-rw-r--r--app/views/layouts/_head_panel.html.haml20
-rw-r--r--app/views/profiles/update.js.erb3
3 files changed, 13 insertions, 17 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 020c103dbc5..652dc292421 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -132,10 +132,9 @@ $ ->
), 1
# Initialize tooltips
- $('.has_tooltip').tooltip()
-
- # Bottom tooltip
- $('.has_bottom_tooltip').tooltip(placement: 'bottom')
+ $('body').tooltip({
+ selector: '.has_tooltip, [data-toggle="tooltip"]'
+ })
# Form submitter
$('.trigger-submit').on 'change', ->
diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml
index b8f96787e76..83387ad9026 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 has_bottom_tooltip', title: 'Dashboard' do
+ = link_to root_path, class: 'home', title: 'Dashboard', data: {toggle: 'tooltip', placement: 'bottom'} do
= brand_header_logo
%h3 GitLab
%h1.title= title
@@ -16,33 +16,33 @@
%li.hidden-sm.hidden-xs
= render 'layouts/search'
%li.visible-sm.visible-xs
- = link_to search_path, title: 'Search', class: 'has_bottom_tooltip' do
+ = link_to search_path, title: 'Search', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('search')
%li
- = link_to help_path, title: 'Help', class: 'has_bottom_tooltip' do
+ = link_to help_path, title: 'Help', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('question-circle')
%li
- = link_to explore_root_path, title: 'Explore', class: 'has_bottom_tooltip' do
+ = link_to explore_root_path, title: 'Explore', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('globe')
%li
- = link_to user_snippets_path(current_user), title: 'Your snippets', class: 'has_bottom_tooltip' do
+ = link_to user_snippets_path(current_user), title: 'Your snippets', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('clipboard')
- if current_user.is_admin?
%li
- = link_to admin_root_path, title: 'Admin area', class: 'has_bottom_tooltip' do
+ = link_to admin_root_path, title: 'Admin area', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('cogs')
- if current_user.can_create_project?
%li
- = link_to new_project_path, title: 'New project', class: 'has_bottom_tooltip' do
+ = link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('plus')
%li
- = link_to profile_path, title: 'Profile settings', class: 'has_bottom_tooltip' do
+ = link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('user')
%li
- = link_to destroy_user_session_path, class: 'logout', method: :delete, title: 'Sign out', class: 'has_bottom_tooltip' do
+ = link_to destroy_user_session_path, class: 'logout', method: :delete, title: 'Sign out', data: {toggle: 'tooltip', placement: 'bottom'} do
= icon('sign-out')
%li.hidden-xs
- = link_to current_user, class: 'profile-pic has_bottom_tooltip', id: 'profile-pic' do
+ = link_to current_user, class: 'profile-pic', id: 'profile-pic', data: {toggle: 'tooltip', placement: 'bottom'} do
= image_tag avatar_icon(current_user.email, 60), alt: 'User activity'
= render 'shared/outdated_browser'
diff --git a/app/views/profiles/update.js.erb b/app/views/profiles/update.js.erb
index f3729058e76..fc82b45a499 100644
--- a/app/views/profiles/update.js.erb
+++ b/app/views/profiles/update.js.erb
@@ -4,6 +4,3 @@ $('body').addClass('<%= app_theme %> <%= theme_type %>')
// Re-render the header to reflect the new theme
$('header').html('<%= escape_javascript(render("layouts/head_panel", title: "Profile")) %>')
-
-// Re-initialize header tooltips
-$('.has_bottom_tooltip').tooltip({placement: 'bottom'})