summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-11-29 01:13:54 +0300
committerFatih Acet <acetfatih@gmail.com>2016-11-29 01:15:23 +0300
commit59fa98dd8462fa2f7865828275b5e80e362e4a6e (patch)
tree36c9bf91618502ecd0e2aae0a0b0938a08cd7ef4
parent1fa55069745163e70f01349f71798e2a214ae28e (diff)
downloadgitlab-ce-hide-project-variables.tar.gz
Enable ESLint and fix minor code style stuff in project_variables.js.es6.hide-project-variables
-rw-r--r--app/assets/javascripts/project_variables.js.es641
1 files changed, 20 insertions, 21 deletions
diff --git a/app/assets/javascripts/project_variables.js.es6 b/app/assets/javascripts/project_variables.js.es6
index 6c905f58c85..4ee2e49306d 100644
--- a/app/assets/javascripts/project_variables.js.es6
+++ b/app/assets/javascripts/project_variables.js.es6
@@ -1,44 +1,43 @@
-/* eslint-disable */
-((global) => {
+(() => {
const HIDDEN_VALUE_TEXT = '******';
class ProjectVariables {
constructor() {
- this.$reveal = $('.js-btn-toggle-reveal-values');
-
- this.$reveal.on('click', this.toggleRevealState.bind(this));
+ this.$revealBtn = $('.js-btn-toggle-reveal-values');
+ this.$revealBtn.on('click', this.toggleRevealState.bind(this));
}
- toggleRevealState(event) {
- event.preventDefault();
+ toggleRevealState(e) {
+ e.preventDefault();
- const $btn = $(event.currentTarget);
- const oldStatus = $btn.attr('data-status');
+ const oldStatus = this.$revealBtn.attr('data-status');
+ let newStatus = 'hidden';
+ let newAction = 'Reveal Values';
- if (oldStatus == 'hidden') {
- [newStatus, newAction] = ['revealed', 'Hide Values'];
- } else {
- [newStatus, newAction] = ['hidden', 'Reveal Values'];
+ if (oldStatus === 'hidden') {
+ newStatus = 'revealed';
+ newAction = 'Hide Values';
}
- $btn.attr('data-status', newStatus);
+ this.$revealBtn.attr('data-status', newStatus);
- let $variables = $('.variable-value');
+ const $variables = $('.variable-value');
- $variables.each(function (_, variable) {
- let $variable = $(variable);
+ $variables.each((_, variable) => {
+ const $variable = $(variable);
let newText = HIDDEN_VALUE_TEXT;
- if (newStatus == 'revealed') {
+ if (newStatus === 'revealed') {
newText = $variable.attr('data-value');
}
$variable.text(newText);
});
- $btn.text(newAction);
+ this.$revealBtn.text(newAction);
}
}
- global.ProjectVariables = ProjectVariables;
-})(window.gl || (window.gl = {}));
+ window.gl = window.gl || {};
+ window.gl.ProjectVariables = ProjectVariables;
+})();