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-06-05 12:47:43 +0300
committerLuke Bennett <lukeeeebennettplus@gmail.com>2018-06-05 12:47:43 +0300
commit7e36fa398b6f2e0304d852b7c77ef30d83e62ed4 (patch)
treedb6326dc53cbf5e5be5350dcf0389f43eed9b8a1 /app/assets/javascripts/project_label_subscription.js
parent9b9cdc984cb785ceee4ed1902625c65492640621 (diff)
FE review changes
Diffstat (limited to 'app/assets/javascripts/project_label_subscription.js')
-rw-r--r--app/assets/javascripts/project_label_subscription.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/app/assets/javascripts/project_label_subscription.js b/app/assets/javascripts/project_label_subscription.js
index a5e68d1b0a0..35a76875a7a 100644
--- a/app/assets/javascripts/project_label_subscription.js
+++ b/app/assets/javascripts/project_label_subscription.js
@@ -3,6 +3,17 @@ import { __ } from './locale';
import axios from './lib/utils/axios_utils';
import flash from './flash';
+const tooltipTitles = {
+ group: {
+ subscribed: __('Unsubscribe at group level'),
+ unsubscribed: __('Subscribe at group level'),
+ },
+ project: {
+ subscribed: __('Unsubscribe at project level'),
+ unsubscribed: __('Subscribe at project level'),
+ },
+};
+
export default class ProjectLabelSubscription {
constructor(container) {
this.$container = $(container);
@@ -48,11 +59,10 @@ export default class ProjectLabelSubscription {
}).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);
+ static setNewTitle($button, originalTitle, newStatus) {
+ const type = /group/.test(originalTitle) ? 'group' : 'project';
+ const newTitle = tooltipTitles[type][newStatus];
- $button.tooltip('hide').attr('data-original-title', newTitle).tooltip('_fixTitle');
+ $button.tooltip('hide').attr('title', newTitle).tooltip('_fixTitle');
}
}