Commit 59fa98dd authored by Fatih Acet's avatar Fatih Acet

Enable ESLint and fix minor code style stuff in project_variables.js.es6.

parent 1fa55069
/* eslint-disable */ (() => {
((global) => {
const HIDDEN_VALUE_TEXT = '******'; const HIDDEN_VALUE_TEXT = '******';
class ProjectVariables { class ProjectVariables {
constructor() { constructor() {
this.$reveal = $('.js-btn-toggle-reveal-values'); this.$revealBtn = $('.js-btn-toggle-reveal-values');
this.$revealBtn.on('click', this.toggleRevealState.bind(this));
this.$reveal.on('click', this.toggleRevealState.bind(this));
} }
toggleRevealState(event) { toggleRevealState(e) {
event.preventDefault(); e.preventDefault();
const $btn = $(event.currentTarget); const oldStatus = this.$revealBtn.attr('data-status');
const oldStatus = $btn.attr('data-status'); let newStatus = 'hidden';
let newAction = 'Reveal Values';
if (oldStatus == 'hidden') { if (oldStatus === 'hidden') {
[newStatus, newAction] = ['revealed', 'Hide Values']; newStatus = 'revealed';
} else { newAction = 'Hide Values';
[newStatus, newAction] = ['hidden', 'Reveal Values'];
} }
$btn.attr('data-status', newStatus); this.$revealBtn.attr('data-status', newStatus);
let $variables = $('.variable-value'); const $variables = $('.variable-value');
$variables.each(function (_, variable) { $variables.each((_, variable) => {
let $variable = $(variable); const $variable = $(variable);
let newText = HIDDEN_VALUE_TEXT; let newText = HIDDEN_VALUE_TEXT;
if (newStatus == 'revealed') { if (newStatus === 'revealed') {
newText = $variable.attr('data-value'); newText = $variable.attr('data-value');
} }
$variable.text(newText); $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;
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment