Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2018-05-28 14:05:40 +0300
committerLuke Bennett <lukeeeebennettplus@gmail.com>2018-05-28 14:05:40 +0300
commit778e9d90da9ccc7a4b79860a98e84356dd3adaf2 (patch)
treedbe789ff4e7c655ed808da8616b716fc2b4f6e55 /app/assets/javascripts/project_label_subscription.js
parente56c0a4763c5b1718bbaace8cd8189f1cbf27a2f (diff)
Fix tooltips
Diffstat (limited to 'app/assets/javascripts/project_label_subscription.js')
-rw-r--r--app/assets/javascripts/project_label_subscription.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/project_label_subscription.js b/app/assets/javascripts/project_label_subscription.js
index c5607a3cada..72f03b02131 100644
--- a/app/assets/javascripts/project_label_subscription.js
+++ b/app/assets/javascripts/project_label_subscription.js
@@ -35,15 +35,22 @@ export default class ProjectLabelSubscription {
this.$buttons.attr('data-status', newStatus);
this.$buttons.find('> span').text(newAction);
- this.$buttons.map((button) => {
+ this.$buttons.map((i, button) => {
const $button = $(button);
+ const originalTitle = $button.attr('data-original-title');
- if ($button.attr('data-original-title')) {
- $button.tooltip('hide').attr('data-original-title', newAction).tooltip('fixTitle');
- }
+ if (originalTitle) ProjectLabelSubscription.setNewTitle($button, originalTitle, newStatus, newAction);
return button;
});
}).catch(() => flash(__('There was an error subscribing to this label.')));
}
+
+ static setNewTitle($button, originalTitle, newStatus, newAction) {
+ const newStatusVerb = newStatus.slice(0, -1);
+ const actionRegexp = new RegExp(newStatusVerb, 'i');
+ const newTitle = originalTitle.replace(actionRegexp, newAction);
+
+ $button.tooltip('hide').attr('data-original-title', newTitle).tooltip('fixTitle');
+ }
}