Commit 2b37e4c1 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'master' into copy-as-md

# Conflicts:
#	app/assets/javascripts/lib/utils/common_utils.js.es6
parents f928e19c 52762df2
...@@ -62,7 +62,7 @@ Lint/UnusedMethodArgument: ...@@ -62,7 +62,7 @@ Lint/UnusedMethodArgument:
# Offense count: 93 # Offense count: 93
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/BlockLength: Metrics/BlockLength:
Max: 288 Enabled: false
# Offense count: 3 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -125,7 +125,7 @@ RSpec/MessageSpies: ...@@ -125,7 +125,7 @@ RSpec/MessageSpies:
# Offense count: 3036 # Offense count: 3036
RSpec/MultipleExpectations: RSpec/MultipleExpectations:
Max: 37 Enabled: false
# Offense count: 2133 # Offense count: 2133
RSpec/NamedSubject: RSpec/NamedSubject:
......
...@@ -252,10 +252,9 @@ end ...@@ -252,10 +252,9 @@ end
group :development do group :development do
gem 'foreman', '~> 0.78.0' gem 'foreman', '~> 0.78.0'
gem 'brakeman', '~> 3.3.0', require: false gem 'brakeman', '~> 3.4.0', require: false
gem 'letter_opener_web', '~> 1.3.0' gem 'letter_opener_web', '~> 1.3.0'
gem 'rerun', '~> 0.11.0'
gem 'bullet', '~> 5.2.0', require: false gem 'bullet', '~> 5.2.0', require: false
gem 'rblineprof', '~> 0.3.6', platform: :mri, require: false gem 'rblineprof', '~> 0.3.6', platform: :mri, require: false
gem 'web-console', '~> 2.0' gem 'web-console', '~> 2.0'
...@@ -286,7 +285,7 @@ group :development, :test do ...@@ -286,7 +285,7 @@ group :development, :test do
gem 'minitest', '~> 5.7.0' gem 'minitest', '~> 5.7.0'
# Generate Fake data # Generate Fake data
gem 'ffaker', '~> 2.0.0' gem 'ffaker', '~> 2.4'
gem 'capybara', '~> 2.6.2' gem 'capybara', '~> 2.6.2'
gem 'capybara-screenshot', '~> 1.0.0' gem 'capybara-screenshot', '~> 1.0.0'
......
...@@ -88,7 +88,7 @@ GEM ...@@ -88,7 +88,7 @@ GEM
bootstrap-sass (3.3.6) bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1) autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4) sass (>= 3.3.4)
brakeman (3.3.2) brakeman (3.4.1)
browser (2.2.0) browser (2.2.0)
builder (3.2.2) builder (3.2.2)
bullet (5.2.0) bullet (5.2.0)
...@@ -198,7 +198,7 @@ GEM ...@@ -198,7 +198,7 @@ GEM
faraday_middleware-multi_json (0.0.6) faraday_middleware-multi_json (0.0.6)
faraday_middleware faraday_middleware
multi_json multi_json
ffaker (2.0.0) ffaker (2.4.0)
ffi (1.9.10) ffi (1.9.10)
flay (2.6.1) flay (2.6.1)
ruby_parser (~> 3.0) ruby_parser (~> 3.0)
...@@ -407,9 +407,6 @@ GEM ...@@ -407,9 +407,6 @@ GEM
xml-simple xml-simple
licensee (8.0.0) licensee (8.0.0)
rugged (>= 0.24b) rugged (>= 0.24b)
listen (3.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
little-plugger (1.1.4) little-plugger (1.1.4)
logging (2.1.0) logging (2.1.0)
little-plugger (~> 1.1) little-plugger (~> 1.1)
...@@ -580,9 +577,6 @@ GEM ...@@ -580,9 +577,6 @@ GEM
rainbow (2.1.0) rainbow (2.1.0)
raindrops (0.17.0) raindrops (0.17.0)
rake (10.5.0) rake (10.5.0)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rblineprof (0.3.6) rblineprof (0.3.6)
debugger-ruby_core_source (~> 1.3) debugger-ruby_core_source (~> 1.3)
rdoc (4.2.2) rdoc (4.2.2)
...@@ -611,8 +605,6 @@ GEM ...@@ -611,8 +605,6 @@ GEM
redis-store (1.2.0) redis-store (1.2.0)
redis (>= 2.2) redis (>= 2.2)
request_store (1.3.1) request_store (1.3.1)
rerun (0.11.0)
listen (~> 3.0)
responders (2.3.0) responders (2.3.0)
railties (>= 4.2.0, < 5.1) railties (>= 4.2.0, < 5.1)
rest-client (2.0.0) rest-client (2.0.0)
...@@ -852,7 +844,7 @@ DEPENDENCIES ...@@ -852,7 +844,7 @@ DEPENDENCIES
better_errors (~> 1.0.1) better_errors (~> 1.0.1)
binding_of_caller (~> 0.7.2) binding_of_caller (~> 0.7.2)
bootstrap-sass (~> 3.3.0) bootstrap-sass (~> 3.3.0)
brakeman (~> 3.3.0) brakeman (~> 3.4.0)
browser (~> 2.2) browser (~> 2.2)
bullet (~> 5.2.0) bullet (~> 5.2.0)
bundler-audit (~> 0.5.0) bundler-audit (~> 0.5.0)
...@@ -877,7 +869,7 @@ DEPENDENCIES ...@@ -877,7 +869,7 @@ DEPENDENCIES
email_reply_trimmer (~> 0.1) email_reply_trimmer (~> 0.1)
email_spec (~> 1.6.0) email_spec (~> 1.6.0)
factory_girl_rails (~> 4.7.0) factory_girl_rails (~> 4.7.0)
ffaker (~> 2.0.0) ffaker (~> 2.4)
flay (~> 2.6.1) flay (~> 2.6.1)
fog-aws (~> 0.9) fog-aws (~> 0.9)
fog-core (~> 1.40) fog-core (~> 1.40)
...@@ -968,7 +960,6 @@ DEPENDENCIES ...@@ -968,7 +960,6 @@ DEPENDENCIES
redis-namespace (~> 1.5.2) redis-namespace (~> 1.5.2)
redis-rails (~> 5.0.1) redis-rails (~> 5.0.1)
request_store (~> 1.3) request_store (~> 1.3)
rerun (~> 0.11.0)
responders (~> 2.0) responders (~> 2.0)
rouge (~> 2.0) rouge (~> 2.0)
rqrcode-rails3 (~> 0.1.7) rqrcode-rails3 (~> 0.1.7)
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, max-len */
/* global Turbolinks */ /* global Turbolinks */
(function() { (function() {
...@@ -61,7 +61,5 @@ ...@@ -61,7 +61,5 @@
} }
return Admin; return Admin;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, quotes, object-shorthand, camelcase, no-var, comma-dangle, prefer-arrow-callback, indent, object-curly-spacing, quote-props, no-param-reassign, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, quotes, object-shorthand, camelcase, no-var, comma-dangle, prefer-arrow-callback, quote-props, no-param-reassign, max-len */
(function() { (function() {
var Api = { var Api = {
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
return $.ajax({ return $.ajax({
url: url, url: url,
data: $.extend({ data: $.extend({
search: query, search: query,
per_page: 20 per_page: 20
}, options), }, options),
dataType: "json" dataType: "json"
}).done(function(groups) { }).done(function(groups) {
return callback(groups); return callback(groups);
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
return $.ajax({ return $.ajax({
url: url, url: url,
type: "POST", type: "POST",
data: {'label': data}, data: { 'label': data },
dataType: "json" dataType: "json"
}).done(function(label) { }).done(function(label) {
return callback(label); return callback(label);
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, prefer-arrow-callback, no-var, one-var, one-var-declaration-per-line, no-else-return, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, prefer-arrow-callback, no-var, one-var, one-var-declaration-per-line, no-else-return, max-len */
(function() { (function() {
this.Aside = (function() { this.Aside = (function() {
function Aside() { function Aside() {
...@@ -21,7 +21,5 @@ ...@@ -21,7 +21,5 @@
} }
return Aside; return Aside;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-param-reassign, quotes, prefer-template, no-var, one-var, no-unused-vars, one-var-declaration-per-line, no-void, consistent-return, no-empty, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-param-reassign, quotes, prefer-template, no-var, one-var, no-unused-vars, one-var-declaration-per-line, no-void, consistent-return, no-empty, max-len */
(function() { (function() {
this.Autosave = (function() { this.Autosave = (function() {
function Autosave(field, key) { function Autosave(field, key) {
...@@ -58,7 +58,5 @@ ...@@ -58,7 +58,5 @@
}; };
return Autosave; return Autosave;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, no-var, spaced-comment, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-template, quotes, comma-dangle, no-param-reassign, no-void, radix, keyword-spacing, space-before-blocks, brace-style, no-underscore-dangle, no-plusplus, no-return-assign, camelcase, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, no-var, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-template, quotes, comma-dangle, no-param-reassign, no-void, brace-style, no-underscore-dangle, no-return-assign, camelcase */
/* global Cookies */ /* global Cookies */
(function() { (function() {
this.AwardsHandler = (function() { this.AwardsHandler = (function() {
var FROM_SENTENCE_REGEX = /(?:, and | and |, )/; //For separating lists produced by ruby's Array#toSentence var FROM_SENTENCE_REGEX = /(?:, and | and |, )/; // For separating lists produced by ruby's Array#toSentence
function AwardsHandler() { function AwardsHandler() {
this.aliases = gl.emojiAliases(); this.aliases = gl.emojiAliases();
$(document).off('click', '.js-add-award').on('click', '.js-add-award', (function(_this) { $(document).off('click', '.js-add-award').on('click', '.js-add-award', (function(_this) {
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
return this.decrementCounter($emojiButton, emoji); return this.decrementCounter($emojiButton, emoji);
} else { } else {
counter = $emojiButton.find('.js-counter'); counter = $emojiButton.find('.js-counter');
counter.text(parseInt(counter.text()) + 1); counter.text(parseInt(counter.text(), 10) + 1);
$emojiButton.addClass('active'); $emojiButton.addClass('active');
this.addYouToUserList(votesBlock, emoji); this.addYouToUserList(votesBlock, emoji);
return this.animateEmoji($emojiButton); return this.animateEmoji($emojiButton);
...@@ -211,10 +211,10 @@ ...@@ -211,10 +211,10 @@
}; };
AwardsHandler.prototype.toSentence = function(list) { AwardsHandler.prototype.toSentence = function(list) {
if(list.length <= 2){ if (list.length <= 2) {
return list.join(' and '); return list.join(' and ');
} }
else{ else {
return list.slice(0, -1).join(', ') + ', and ' + list[list.length - 1]; return list.slice(0, -1).join(', ') + ', and ' + list[list.length - 1];
} }
}; };
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
if (Cookies.get('frequently_used_emojis')) { if (Cookies.get('frequently_used_emojis')) {
frequentlyUsedEmojis = this.getFrequentlyUsedEmojis(); frequentlyUsedEmojis = this.getFrequentlyUsedEmojis();
ul = $("<ul class='clearfix emoji-menu-list frequent-emojis'>"); ul = $("<ul class='clearfix emoji-menu-list frequent-emojis'>");
for (i = 0, len = frequentlyUsedEmojis.length; i < len; i++) { for (i = 0, len = frequentlyUsedEmojis.length; i < len; i += 1) {
emoji = frequentlyUsedEmojis[i]; emoji = frequentlyUsedEmojis[i];
$(".emoji-menu-content [data-emoji='" + emoji + "']").closest('li').clone().appendTo(ul); $(".emoji-menu-content [data-emoji='" + emoji + "']").closest('li').clone().appendTo(ul);
} }
...@@ -374,7 +374,5 @@ ...@@ -374,7 +374,5 @@
}; };
return AwardsHandler; return AwardsHandler;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, consistent-return, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, consistent-return, max-len */
/* global autosize */ /* global autosize */
/*= require jquery.ba-resize */ /*= require jquery.ba-resize */
...@@ -26,5 +26,4 @@ ...@@ -26,5 +26,4 @@
autosize.update($fields); autosize.update($fields);
return $fields.css('resize', 'vertical'); return $fields.css('resize', 'vertical');
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, quotes, no-var, vars-on-top, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, quotes, no-var, vars-on-top, max-len */
(function() { (function() {
$(function() { $(function() {
$("body").on("click", ".js-details-target", function() { $("body").on("click", ".js-details-target", function() {
...@@ -23,5 +23,4 @@ ...@@ -23,5 +23,4 @@
return e.preventDefault(); return e.preventDefault();
}); });
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, camelcase, consistent-return, quotes, object-shorthand, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, camelcase, consistent-return, quotes, object-shorthand, comma-dangle, max-len */
// Quick Submit behavior // Quick Submit behavior
// //
...@@ -74,5 +74,4 @@ ...@@ -74,5 +74,4 @@
return $this.tooltip('hide'); return $this.tooltip('hide');
}); });
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, no-else-return, consistent-return, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, no-else-return, consistent-return, max-len */
// Requires Input behavior // Requires Input behavior
// //
// When called on a form with input fields with the `required` attribute, the // When called on a form with input fields with the `required` attribute, the
...@@ -59,5 +59,4 @@ ...@@ -59,5 +59,4 @@
return hideOrShowHelpBlock($form); return hideOrShowHelpBlock($form);
}); });
}); });
}).call(this); }).call(this);
/* eslint-disable padded-blocks, no-param-reassign, comma-dangle */ /* eslint-disable no-param-reassign, comma-dangle */
/* global Api */ /* global Api */
/*= require blob/template_selector */ /*= require blob/template_selector */
((global) => { ((global) => {
class BlobCiYamlSelector extends gl.TemplateSelector { class BlobCiYamlSelector extends gl.TemplateSelector {
requestFile(query) { requestFile(query) {
return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this)); return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this));
...@@ -39,5 +38,4 @@ ...@@ -39,5 +38,4 @@
} }
global.BlobCiYamlSelectors = BlobCiYamlSelectors; global.BlobCiYamlSelectors = BlobCiYamlSelectors;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, camelcase, object-shorthand, quotes, comma-dangle, prefer-arrow-callback, no-unused-vars, prefer-template, no-useless-escape, no-alert, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, camelcase, object-shorthand, quotes, comma-dangle, prefer-arrow-callback, no-unused-vars, prefer-template, no-useless-escape, no-alert, max-len */
/* global Dropzone */ /* global Dropzone */
(function() { (function() {
...@@ -62,7 +62,5 @@ ...@@ -62,7 +62,5 @@
} }
return BlobFileDropzone; return BlobFileDropzone;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-rest-params, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-rest-params */
/* global Api */ /* global Api */
/*= require blob/template_selector */ /*= require blob/template_selector */
...@@ -19,7 +19,5 @@ ...@@ -19,7 +19,5 @@
}; };
return BlobGitignoreSelector; return BlobGitignoreSelector;
})(gl.TemplateSelector); })(gl.TemplateSelector);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-unused-expressions, no-cond-assign, no-sequences, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-unused-expressions, no-cond-assign, no-sequences, comma-dangle, max-len */
/* global BlobGitignoreSelector */ /* global BlobGitignoreSelector */
(function() { (function() {
...@@ -22,7 +22,5 @@ ...@@ -22,7 +22,5 @@
} }
return BlobGitignoreSelectors; return BlobGitignoreSelectors;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-rest-params, comma-dangle, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-rest-params, comma-dangle */
/* global Api */ /* global Api */
/*= require blob/template_selector */ /*= require blob/template_selector */
...@@ -24,7 +24,5 @@ ...@@ -24,7 +24,5 @@
}; };
return BlobLicenseSelector; return BlobLicenseSelector;
})(gl.TemplateSelector); })(gl.TemplateSelector);
}).call(this); }).call(this);
/* eslint-disable no-unused-vars, no-param-reassign, padded-blocks */ /* eslint-disable no-unused-vars, no-param-reassign */
/* global BlobLicenseSelector */ /* global BlobLicenseSelector */
((global) => { ((global) => {
...@@ -20,5 +20,4 @@ ...@@ -20,5 +20,4 @@
} }
global.BlobLicenseSelectors = BlobLicenseSelectors; global.BlobLicenseSelectors = BlobLicenseSelectors;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable indent, comma-dangle, object-shorthand, func-names, space-before-function-paren, arrow-parens, no-unused-vars, class-methods-use-this, no-var, consistent-return, prefer-const, no-param-reassign, space-in-parens, max-len */ /* eslint-disable comma-dangle, object-shorthand, func-names, space-before-function-paren, arrow-parens, no-unused-vars, class-methods-use-this, no-var, consistent-return, no-param-reassign, max-len */
((global) => { ((global) => {
class TemplateSelector { class TemplateSelector {
constructor({ dropdown, data, pattern, wrapper, editor, fileEndpoint, $input } = {}) { constructor({ dropdown, data, pattern, wrapper, editor, fileEndpoint, $input } = {}) {
this.onClick = this.onClick.bind(this); this.onClick = this.onClick.bind(this);
this.dropdown = dropdown; this.dropdown = dropdown;
this.data = data; this.data = data;
this.pattern = pattern; this.pattern = pattern;
this.wrapper = wrapper; this.wrapper = wrapper;
this.editor = editor; this.editor = editor;
this.fileEndpoint = fileEndpoint; this.fileEndpoint = fileEndpoint;
this.$input = $input || $('#file_name'); this.$input = $input || $('#file_name');
this.dropdownIcon = $('.fa-chevron-down', this.dropdown); this.dropdownIcon = $('.fa-chevron-down', this.dropdown);
this.buildDropdown(); this.buildDropdown();
this.bindEvents(); this.bindEvents();
this.onFilenameUpdate(); this.onFilenameUpdate();
this.autosizeUpdateEvent = document.createEvent('Event'); this.autosizeUpdateEvent = document.createEvent('Event');
this.autosizeUpdateEvent.initEvent('autosize:update', true, false); this.autosizeUpdateEvent.initEvent('autosize:update', true, false);
} }
buildDropdown() { buildDropdown() {
return this.dropdown.glDropdown({ return this.dropdown.glDropdown({
data: this.data, data: this.data,
filterable: true, filterable: true,
selectable: true, selectable: true,
toggleLabel: this.toggleLabel, toggleLabel: this.toggleLabel,
search: { search: {
fields: ['name'] fields: ['name']
}, },
clicked: this.onClick, clicked: this.onClick,
text: function(item) { text: function(item) {
return item.name; return item.name;
} }
}); });
} }
bindEvents() { bindEvents() {
return this.$input.on('keyup blur', (e) => this.onFilenameUpdate()); return this.$input.on('keyup blur', (e) => this.onFilenameUpdate());
} }
toggleLabel(item) { toggleLabel(item) {
return item.name; return item.name;
} }
onFilenameUpdate() { onFilenameUpdate() {
var filenameMatches; var filenameMatches;
if (!this.$input.length) { if (!this.$input.length) {
return; return;
}
filenameMatches = this.pattern.test(this.$input.val().trim());
if (!filenameMatches) {
this.wrapper.addClass('hidden');
return;
}
return this.wrapper.removeClass('hidden');
} }
filenameMatches = this.pattern.test(this.$input.val().trim());
onClick(item, el, e) { if (!filenameMatches) {
e.preventDefault(); this.wrapper.addClass('hidden');
return this.requestFile(item); return;
} }
return this.wrapper.removeClass('hidden');
}
requestFile(item) { onClick(item, el, e) {
// This `requestFile` method is an abstract method that should e.preventDefault();
// be added by all subclasses. return this.requestFile(item);
} }
// To be implemented on the extending class requestFile(item) {
// e.g. // This `requestFile` method is an abstract method that should
// Api.gitignoreText item.name, @requestFileSuccess.bind(@) // be added by all subclasses.
requestFileSuccess(file, { skipFocus } = {}) { }
if (!file) return;
const oldValue = this.editor.getValue(); // To be implemented on the extending class
let newValue = file.content; // e.g.
// Api.gitignoreText item.name, @requestFileSuccess.bind(@)
requestFileSuccess(file, { skipFocus } = {}) {
if (!file) return;
this.editor.setValue(newValue, 1); const oldValue = this.editor.getValue();
if (!skipFocus) this.editor.focus(); const newValue = file.content;
if (this.editor instanceof jQuery) { this.editor.setValue(newValue, 1);
this.editor.get(0).dispatchEvent(this.autosizeUpdateEvent); if (!skipFocus) this.editor.focus();
}
}
startLoadingSpinner() { if (this.editor instanceof jQuery) {
this.dropdownIcon this.editor.get(0).dispatchEvent(this.autosizeUpdateEvent);
.addClass('fa-spinner fa-spin')
.removeClass('fa-chevron-down');
} }
}
stopLoadingSpinner() { startLoadingSpinner() {
this.dropdownIcon this.dropdownIcon
.addClass('fa-chevron-down') .addClass('fa-spinner fa-spin')
.removeClass('fa-spinner fa-spin'); .removeClass('fa-chevron-down');
} }
stopLoadingSpinner() {
this.dropdownIcon
.addClass('fa-chevron-down')
.removeClass('fa-spinner fa-spin');
} }
}
global.TemplateSelector = TemplateSelector; global.TemplateSelector = TemplateSelector;
})(window.gl || ( window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, vars-on-top, no-unused-vars, no-new, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, vars-on-top, no-unused-vars, no-new, max-len */
/* global EditBlob */ /* global EditBlob */
/* global NewCommitForm */ /* global NewCommitForm */
...@@ -12,5 +12,4 @@ ...@@ -12,5 +12,4 @@
var blob = new EditBlob(url, $('.js-edit-blob-form').data('blob-language')); var blob = new EditBlob(url, $('.js-edit-blob-form').data('blob-language'));
new NewCommitForm($('.js-edit-blob-form')); new NewCommitForm($('.js-edit-blob-form'));
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, camelcase, no-param-reassign, quotes, prefer-template, no-new, comma-dangle, one-var, one-var-declaration-per-line, prefer-arrow-callback, no-else-return, no-unused-vars, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, camelcase, no-param-reassign, quotes, prefer-template, no-new, comma-dangle, one-var, one-var-declaration-per-line, prefer-arrow-callback, no-else-return, no-unused-vars, max-len */
/* global ace */ /* global ace */
/* global BlobGitignoreSelectors */ /* global BlobGitignoreSelectors */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.EditBlob = (function() { this.EditBlob = (function() {
function EditBlob(assets_path, ace_mode) { function EditBlob(assets_path, ace_mode) {
...@@ -84,7 +84,5 @@ ...@@ -84,7 +84,5 @@
}; };
return EditBlob; return EditBlob;
})(); })();
}).call(this); }).call(this);
/* eslint-disable one-var, indent, quote-props, comma-dangle, space-before-function-paren */ /* eslint-disable one-var, quote-props, comma-dangle, space-before-function-paren */
/* global Vue */ /* global Vue */
/* global BoardService */ /* global BoardService */
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
//= require ./vue_resource_interceptor //= require ./vue_resource_interceptor
$(() => { $(() => {
const $boardApp = document.getElementById('board-app'), const $boardApp = document.getElementById('board-app');
Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {}; window.gl = window.gl || {};
......
/* eslint-disable comma-dangle, space-before-function-paren, one-var, indent, radix */ /* eslint-disable comma-dangle, space-before-function-paren, one-var */
/* global Vue */ /* global Vue */
/* global Sortable */ /* global Sortable */
...@@ -88,8 +88,8 @@ ...@@ -88,8 +88,8 @@
gl.issueBoards.onEnd(); gl.issueBoards.onEnd();
if (e.newIndex !== undefined && e.oldIndex !== e.newIndex) { if (e.newIndex !== undefined && e.oldIndex !== e.newIndex) {
const order = this.sortable.toArray(), const order = this.sortable.toArray();
list = Store.findList('id', parseInt(e.item.dataset.id)); const list = Store.findList('id', parseInt(e.item.dataset.id, 10));
this.$nextTick(() => { this.$nextTick(() => {
Store.moveList(list, order); Store.moveList(list, order);
......
/* eslint-disable space-before-function-paren, comma-dangle, semi */ /* eslint-disable space-before-function-paren, comma-dangle */
/* global Vue */ /* global Vue */
/* global ListLabel */ /* global ListLabel */
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
new ListLabel({ title: 'To Do', color: '#F0AD4E' }), new ListLabel({ title: 'To Do', color: '#F0AD4E' }),
new ListLabel({ title: 'Doing', color: '#5CB85C' }) new ListLabel({ title: 'Doing', color: '#5CB85C' })
] ]
} };
}, },
methods: { methods: {
addDefaultLists () { addDefaultLists () {
......
/* eslint-disable comma-dangle, space-before-function-paren, max-len, no-plusplus */ /* eslint-disable comma-dangle, space-before-function-paren, max-len */
/* global Vue */ /* global Vue */
/* global Sortable */ /* global Sortable */
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
issues () { issues () {
this.$nextTick(() => { this.$nextTick(() => {
if (this.scrollHeight() <= this.listHeight() && this.list.issuesSize > this.list.issues.length) { if (this.scrollHeight() <= this.listHeight() && this.list.issuesSize > this.list.issues.length) {
this.list.page++; this.list.page += 1;
this.list.getIssues(false); this.list.getIssues(false);
} }
......
/* eslint-disable comma-dangle, func-names, no-new, space-before-function-paren, one-var, indent */ /* eslint-disable comma-dangle, func-names, no-new, space-before-function-paren, one-var */
(() => { (() => {
window.gl = window.gl || {}; window.gl = window.gl || {};
...@@ -32,17 +32,17 @@ ...@@ -32,17 +32,17 @@
}); });
}, },
renderRow (label) { renderRow (label) {
const active = Store.findList('title', label.title), const active = Store.findList('title', label.title);
$li = $('<li />'), const $li = $('<li />');
$a = $('<a />', { const $a = $('<a />', {
class: (active ? `is-active js-board-list-${active.id}` : ''), class: (active ? `is-active js-board-list-${active.id}` : ''),
text: label.title, text: label.title,
href: '#' href: '#'
}), });
$labelColor = $('<span />', { const $labelColor = $('<span />', {
class: 'dropdown-label-box', class: 'dropdown-label-box',
style: `background-color: ${label.color}` style: `background-color: ${label.color}`
}); });
return $li.append($a.prepend($labelColor)); return $li.append($a.prepend($labelColor));
}, },
......
/* eslint-disable no-unused-vars, no-mixed-operators, prefer-const, comma-dangle, semi */ /* eslint-disable no-unused-vars, no-mixed-operators, comma-dangle */
/* global DocumentTouch */ /* global DocumentTouch */
((w) => { ((w) => {
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
gl.issueBoards.touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; gl.issueBoards.touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
gl.issueBoards.getBoardSortableDefaultOptions = (obj) => { gl.issueBoards.getBoardSortableDefaultOptions = (obj) => {
let defaultSortOptions = { const defaultSortOptions = {
animation: 200, animation: 200,
forceFallback: true, forceFallback: true,
fallbackClass: 'is-dragging', fallbackClass: 'is-dragging',
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
scrollSpeed: 20, scrollSpeed: 20,
onStart: gl.issueBoards.onStart, onStart: gl.issueBoards.onStart,
onEnd: gl.issueBoards.onEnd onEnd: gl.issueBoards.onEnd
} };
Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; }); Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; });
return defaultSortOptions; return defaultSortOptions;
......
/* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, space-in-parens, arrow-parens, comma-dangle, max-len */ /* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */
/* global Vue */ /* global Vue */
/* global ListLabel */ /* global ListLabel */
/* global ListMilestone */ /* global ListMilestone */
...@@ -37,12 +37,12 @@ class ListIssue { ...@@ -37,12 +37,12 @@ class ListIssue {
} }
findLabel (findLabel) { findLabel (findLabel) {
return this.labels.filter( label => label.title === findLabel.title )[0]; return this.labels.filter(label => label.title === findLabel.title)[0];
} }
removeLabel (removeLabel) { removeLabel (removeLabel) {
if (removeLabel) { if (removeLabel) {
this.labels = this.labels.filter( label => removeLabel.title !== label.title ); this.labels = this.labels.filter(label => removeLabel.title !== label.title);
} }
} }
...@@ -51,7 +51,7 @@ class ListIssue { ...@@ -51,7 +51,7 @@ class ListIssue {
} }
getLists () { getLists () {
return gl.issueBoards.BoardsStore.state.lists.filter( list => list.findIssue(this.id) ); return gl.issueBoards.BoardsStore.state.lists.filter(list => list.findIssue(this.id));
} }
update (url) { update (url) {
...@@ -60,7 +60,7 @@ class ListIssue { ...@@ -60,7 +60,7 @@ class ListIssue {
milestone_id: this.milestone ? this.milestone.id : null, milestone_id: this.milestone ? this.milestone.id : null,
due_date: this.dueDate, due_date: this.dueDate,
assignee_id: this.assignee ? this.assignee.id : null, assignee_id: this.assignee ? this.assignee.id : null,
label_ids: this.labels.map( (label) => label.id ) label_ids: this.labels.map((label) => label.id)
} }
}; };
......
/* eslint-disable space-before-function-paren, no-underscore-dangle, class-methods-use-this, consistent-return, no-plusplus, prefer-const, space-in-parens, no-shadow, no-param-reassign, max-len, no-unused-vars */ /* eslint-disable space-before-function-paren, no-underscore-dangle, class-methods-use-this, consistent-return, no-shadow, no-param-reassign, max-len, no-unused-vars */
/* global ListIssue */ /* global ListIssue */
/* global ListLabel */ /* global ListLabel */
...@@ -58,7 +58,7 @@ class List { ...@@ -58,7 +58,7 @@ class List {
nextPage () { nextPage () {
if (this.issuesSize > this.issues.length) { if (this.issuesSize > this.issues.length) {
this.page++; this.page += 1;
return this.getIssues(false); return this.getIssues(false);
} }
...@@ -66,12 +66,12 @@ class List { ...@@ -66,12 +66,12 @@ class List {
getIssues (emptyIssues = true) { getIssues (emptyIssues = true) {
const filters = this.filters; const filters = this.filters;
let data = { page: this.page }; const data = { page: this.page };
Object.keys(filters).forEach((key) => { data[key] = filters[key]; }); Object.keys(filters).forEach((key) => { data[key] = filters[key]; });
if (this.label) { if (this.label) {
data.label_name = data.label_name.filter( label => label !== this.label.title ); data.label_name = data.label_name.filter(label => label !== this.label.title);
} }
if (emptyIssues) { if (emptyIssues) {
...@@ -94,7 +94,7 @@ class List { ...@@ -94,7 +94,7 @@ class List {
newIssue (issue) { newIssue (issue) {
this.addIssue(issue); this.addIssue(issue);
this.issuesSize++; this.issuesSize += 1;
return gl.boardService.newIssue(this.id, issue) return gl.boardService.newIssue(this.id, issue)
.then((resp) => { .then((resp) => {
...@@ -122,7 +122,7 @@ class List { ...@@ -122,7 +122,7 @@ class List {
} }
if (listFrom) { if (listFrom) {
this.issuesSize++; this.issuesSize += 1;
gl.boardService.moveIssue(issue.id, listFrom.id, this.id) gl.boardService.moveIssue(issue.id, listFrom.id, this.id)
.then(() => { .then(() => {
listFrom.getIssues(false); listFrom.getIssues(false);
...@@ -132,7 +132,7 @@ class List { ...@@ -132,7 +132,7 @@ class List {
} }
findIssue (id) { findIssue (id) {
return this.issues.filter( issue => issue.id === id )[0]; return this.issues.filter(issue => issue.id === id)[0];
} }
removeIssue (removeIssue) { removeIssue (removeIssue) {
...@@ -140,7 +140,7 @@ class List { ...@@ -140,7 +140,7 @@ class List {
const matchesRemove = removeIssue.id === issue.id; const matchesRemove = removeIssue.id === issue.id;
if (matchesRemove) { if (matchesRemove) {
this.issuesSize--; this.issuesSize -= 1;
issue.removeLabel(this.label); issue.removeLabel(this.label);
} }
......
/* eslint-disable space-before-function-paren, comma-dangle, no-param-reassign, camelcase, prefer-const, no-extra-semi, max-len, no-unused-vars */ /* eslint-disable space-before-function-paren, comma-dangle, no-param-reassign, camelcase, max-len, no-unused-vars */
/* global Vue */ /* global Vue */
class BoardService { class BoardService {
...@@ -47,7 +47,7 @@ class BoardService { ...@@ -47,7 +47,7 @@ class BoardService {
} }
getIssuesForList (id, filter = {}) { getIssuesForList (id, filter = {}) {
let data = { id }; const data = { id };
Object.keys(filter).forEach((key) => { data[key] = filter[key]; }); Object.keys(filter).forEach((key) => { data[key] = filter[key]; });
return this.issues.get(data); return this.issues.get(data);
......
/* eslint-disable comma-dangle, space-before-function-paren, one-var, indent, space-in-parens, no-shadow, radix, dot-notation, semi, max-len */ /* eslint-disable comma-dangle, space-before-function-paren, one-var, no-shadow, dot-notation, max-len */
/* global Cookies */ /* global Cookies */
/* global List */ /* global List */
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
return list; return list;
}, },
new (listObj) { new (listObj) {
const list = this.addList(listObj), const list = this.addList(listObj);
backlogList = this.findList('type', 'backlog', 'backlog'); const backlogList = this.findList('type', 'backlog', 'backlog');
list list
.save() .save()
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
}, },
shouldAddBlankState () { shouldAddBlankState () {
// Decide whether to add the blank state // Decide whether to add the blank state
return !(this.state.lists.filter( list => list.type !== 'backlog' && list.type !== 'done' )[0]); return !(this.state.lists.filter(list => list.type !== 'backlog' && list.type !== 'done')[0]);
}, },
addBlankState () { addBlankState () {
if (!this.shouldAddBlankState() || this.welcomeIsHidden() || this.disabled) return; if (!this.shouldAddBlankState() || this.welcomeIsHidden() || this.disabled) return;
...@@ -82,20 +82,20 @@ ...@@ -82,20 +82,20 @@
if (!list) return; if (!list) return;
this.state.lists = this.state.lists.filter( list => list.id !== id ); this.state.lists = this.state.lists.filter(list => list.id !== id);
}, },
moveList (listFrom, orderLists) { moveList (listFrom, orderLists) {
orderLists.forEach((id, i) => { orderLists.forEach((id, i) => {
const list = this.findList('id', parseInt(id)); const list = this.findList('id', parseInt(id, 10));
list.position = i; list.position = i;
}); });
listFrom.update(); listFrom.update();
}, },
moveIssueToList (listFrom, listTo, issue, newIndex) { moveIssueToList (listFrom, listTo, issue, newIndex) {
const issueTo = listTo.findIssue(issue.id), const issueTo = listTo.findIssue(issue.id);
issueLists = issue.getLists(), const issueLists = issue.getLists();
listLabels = issueLists.map( listIssue => listIssue.label ); const listLabels = issueLists.map(listIssue => listIssue.label);
// Add to new lists issues if it doesn't already exist // Add to new lists issues if it doesn't already exist
if (!issueTo) { if (!issueTo) {
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
if (listTo.type === 'done' && listFrom.type !== 'backlog') { if (listTo.type === 'done' && listFrom.type !== 'backlog') {
issueLists.forEach((list) => { issueLists.forEach((list) => {
list.removeIssue(issue); list.removeIssue(issue);
}) });
issue.removeLabels(listLabels); issue.removeLabels(listLabels);
} else { } else {
listFrom.removeIssue(issue); listFrom.removeIssue(issue);
......
/* eslint-disable wrap-iife, func-names, strict, indent, no-tabs, no-var, vars-on-top, no-param-reassign, object-shorthand, no-shadow, comma-dangle, prefer-template, consistent-return, no-mixed-operators, no-unused-vars, object-curly-spacing, no-unused-expressions, prefer-arrow-callback, max-len */ /* eslint-disable wrap-iife, func-names, strict, no-var, vars-on-top, no-param-reassign, object-shorthand, no-shadow, comma-dangle, prefer-template, consistent-return, no-mixed-operators, no-unused-vars, no-unused-expressions, prefer-arrow-callback, max-len */
(function () { (function () {
'use strict'; 'use strict';
function simulateEvent(el, type, options) { function simulateEvent(el, type, options) {
var event; var event;
if (!el) return; if (!el) return;
var ownerDocument = el.ownerDocument; var ownerDocument = el.ownerDocument;
options = options || {}; options = options || {};
if (/^mouse/.test(type)) { if (/^mouse/.test(type)) {
event = ownerDocument.createEvent('MouseEvents'); event = ownerDocument.createEvent('MouseEvents');
event.initMouseEvent(type, true, true, ownerDocument.defaultView, event.initMouseEvent(type, true, true, ownerDocument.defaultView,
options.button, options.screenX, options.screenY, options.clientX, options.clientY, options.button, options.screenX, options.screenY, options.clientX, options.clientY,
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, el); options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, el);
} else { } else {
event = ownerDocument.createEvent('CustomEvent'); event = ownerDocument.createEvent('CustomEvent');
event.initCustomEvent(type, true, true, ownerDocument.defaultView, event.initCustomEvent(type, true, true, ownerDocument.defaultView,
options.button, options.screenX, options.screenY, options.clientX, options.clientY, options.button, options.screenX, options.screenY, options.clientX, options.clientY,
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, el); options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, el);
event.dataTransfer = { event.dataTransfer = {
data: {}, data: {},
setData: function (type, val) { setData: function (type, val) {
this.data[type] = val; this.data[type] = val;
}, },
getData: function (type) { getData: function (type) {
return this.data[type]; return this.data[type];
} }
}; };
} }
if (el.dispatchEvent) { if (el.dispatchEvent) {
el.dispatchEvent(event); el.dispatchEvent(event);
} else if (el.fireEvent) { } else if (el.fireEvent) {
el.fireEvent('on' + type, event); el.fireEvent('on' + type, event);
} }
return event; return event;
} }
function getTraget(target) { function getTraget(target) {
var el = typeof target.el === 'string' ? document.getElementById(target.el.substr(1)) : target.el; var el = typeof target.el === 'string' ? document.getElementById(target.el.substr(1)) : target.el;
var children = el.children; var children = el.children;
return ( return (
children[target.index] || children[target.index] ||
children[target.index === 'first' ? 0 : -1] || children[target.index === 'first' ? 0 : -1] ||
children[target.index === 'last' ? children.length - 1 : -1] children[target.index === 'last' ? children.length - 1 : -1]
); );
} }
function getRect(el) { function getRect(el) {
var rect = el.getBoundingClientRect(); var rect = el.getBoundingClientRect();
var width = rect.right - rect.left; var width = rect.right - rect.left;
var height = rect.bottom - rect.top; var height = rect.bottom - rect.top;
return { return {
x: rect.left, x: rect.left,
y: rect.top, y: rect.top,
cx: rect.left + width / 2, cx: rect.left + width / 2,
cy: rect.top + height / 2, cy: rect.top + height / 2,
w: width, w: width,
h: height, h: height,
hw: width / 2, hw: width / 2,
wh: height / 2 wh: height / 2
}; };
} }
function simulateDrag(options, callback) { function simulateDrag(options, callback) {
options.to.el = options.to.el || options.from.el; options.to.el = options.to.el || options.from.el;
var fromEl = getTraget(options.from); var fromEl = getTraget(options.from);
var toEl = getTraget(options.to); var toEl = getTraget(options.to);
var scrollable = options.scrollable; var scrollable = options.scrollable;
var fromRect = getRect(fromEl); var fromRect = getRect(fromEl);
var toRect = getRect(toEl); var toRect = getRect(toEl);
var startTime = new Date().getTime(); var startTime = new Date().getTime();
var duration = options.duration || 1000; var duration = options.duration || 1000;
simulateEvent(fromEl, 'mousedown', {button: 0}); simulateEvent(fromEl, 'mousedown', { button: 0 });
options.ontap && options.ontap(); options.ontap && options.ontap();
window.SIMULATE_DRAG_ACTIVE = 1; window.SIMULATE_DRAG_ACTIVE = 1;
var dragInterval = setInterval(function loop() { var dragInterval = setInterval(function loop() {
var progress = (new Date().getTime() - startTime) / duration; var progress = (new Date().getTime() - startTime) / duration;
var x = (fromRect.cx + (toRect.cx - fromRect.cx) * progress) - scrollable.scrollLeft; var x = (fromRect.cx + (toRect.cx - fromRect.cx) * progress) - scrollable.scrollLeft;
var y = (fromRect.cy + (toRect.cy - fromRect.cy) * progress) - scrollable.scrollTop; var y = (fromRect.cy + (toRect.cy - fromRect.cy) * progress) - scrollable.scrollTop;
var overEl = fromEl.ownerDocument.elementFromPoint(x, y); var overEl = fromEl.ownerDocument.elementFromPoint(x, y);
simulateEvent(overEl, 'mousemove', { simulateEvent(overEl, 'mousemove', {
clientX: x, clientX: x,
clientY: y clientY: y
}); });
if (progress >= 1) { if (progress >= 1) {
options.ondragend && options.ondragend(); options.ondragend && options.ondragend();
simulateEvent(toEl, 'mouseup'); simulateEvent(toEl, 'mouseup');
clearInterval(dragInterval); clearInterval(dragInterval);
window.SIMULATE_DRAG_ACTIVE = 0; window.SIMULATE_DRAG_ACTIVE = 0;
} }
}, 100); }, 100);
return { return {
target: fromEl, target: fromEl,
fromList: fromEl.parentNode, fromList: fromEl.parentNode,
toList: toEl.parentNode toList: toEl.parentNode
}; };
} }
// Export
// Export window.simulateEvent = simulateEvent;
window.simulateEvent = simulateEvent; window.simulateDrag = simulateDrag;
window.simulateDrag = simulateDrag;
})(); })();
/* eslint-disable func-names, prefer-arrow-callback, no-unused-vars, no-plusplus */ /* eslint-disable func-names, prefer-arrow-callback, no-unused-vars */
/* global Vue */ /* global Vue */
Vue.http.interceptors.push((request, next) => { Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1; Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
next(function (response) { next(function (response) {
Vue.activeResources--; Vue.activeResources -= 1;
}); });
}); });
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, quotes, no-shadow, prefer-arrow-callback, prefer-template, consistent-return, padded-blocks, no-return-assign, new-parens, no-param-reassign, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, quotes, no-shadow, prefer-arrow-callback, prefer-template, consistent-return, no-return-assign, new-parens, no-param-reassign, max-len */
(function() { (function() {
var Breakpoints = (function() { var Breakpoints = (function() {
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
}; };
return BreakpointInstance; return BreakpointInstance;
})(); })();
Breakpoints.get = function() { Breakpoints.get = function() {
...@@ -60,7 +59,6 @@ ...@@ -60,7 +59,6 @@
}; };
return Breakpoints; return Breakpoints;
})(); })();
$((function(_this) { $((function(_this) {
......
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, no-else-return, object-shorthand, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, no-else-return, object-shorthand, comma-dangle, max-len */
(function() { (function() {
$(function() { $(function() {
var previewPath; var previewPath;
...@@ -31,5 +31,4 @@ ...@@ -31,5 +31,4 @@
} }
}); });
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, no-use-before-define, no-param-reassign, quotes, yoda, no-else-return, consistent-return, comma-dangle, semi, object-shorthand, prefer-template, one-var, one-var-declaration-per-line, no-unused-vars, max-len, vars-on-top, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-use-before-define, no-param-reassign, quotes, yoda, no-else-return, consistent-return, comma-dangle, object-shorthand, prefer-template, one-var, one-var-declaration-per-line, no-unused-vars, max-len, vars-on-top */
/* global Breakpoints */ /* global Breakpoints */
/* global Turbolinks */ /* global Turbolinks */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
var AUTO_SCROLL_OFFSET = 75; var AUTO_SCROLL_OFFSET = 75;
var DOWN_BUILD_TRACE = '#down-build-trace'; var DOWN_BUILD_TRACE = '#down-build-trace';
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
this.$sidebar = $('.js-build-sidebar'); this.$sidebar = $('.js-build-sidebar');
this.sidebarTranslationLimits = { this.sidebarTranslationLimits = {
min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight()
} };
this.sidebarTranslationLimits.max = this.sidebarTranslationLimits.min + $('.scrolling-tabs-container').outerHeight(); this.sidebarTranslationLimits.max = this.sidebarTranslationLimits.min + $('.scrolling-tabs-container').outerHeight();
this.$sidebar.css({ this.$sidebar.css({
top: this.sidebarTranslationLimits.max top: this.sidebarTranslationLimits.max
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
}; };
Build.prototype.getInitialBuildTrace = function() { Build.prototype.getInitialBuildTrace = function() {
var removeRefreshStatuses = ['success', 'failed', 'canceled', 'skipped'] var removeRefreshStatuses = ['success', 'failed', 'canceled', 'skipped'];
return $.ajax({ return $.ajax({
url: this.buildUrl, url: this.buildUrl,
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
this.$scrollTopBtn.hide(); this.$scrollTopBtn.hide();
this.$scrollBottomBtn.hide(); this.$scrollBottomBtn.hide();
this.$autoScrollContainer.hide(); this.$autoScrollContainer.hide();
} };
// Page scroll listener to detect if user has scrolling page // Page scroll listener to detect if user has scrolling page
// and handle following cases // and handle following cases
...@@ -291,7 +291,5 @@ ...@@ -291,7 +291,5 @@
}; };
return Build; return Build;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, no-unused-vars, no-return-assign, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, no-unused-vars, no-return-assign, max-len */
(function() { (function() {
this.BuildArtifacts = (function() { this.BuildArtifacts = (function() {
function BuildArtifacts() { function BuildArtifacts() {
...@@ -22,7 +22,5 @@ ...@@ -22,7 +22,5 @@
}; };
return BuildArtifacts; return BuildArtifacts;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, prefer-arrow-callback, space-before-blocks, space-before-function-paren, comma-spacing, max-len */ /* eslint-disable func-names, prefer-arrow-callback, space-before-function-paren */
$(function(){ $(function() {
$('.reveal-variables').off('click').on('click',function(){ $('.reveal-variables').off('click').on('click', function() {
$('.js-build').toggle().niceScroll(); $('.js-build').toggle().niceScroll();
$(this).hide(); $(this).hide();
}); });
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, wrap-iife */
/* global CommitFile */ /* global CommitFile */
(function() { (function() {
...@@ -10,7 +10,5 @@ ...@@ -10,7 +10,5 @@
} }
return Commit; return Commit;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-new, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-new */
/* global ImageFile */ /* global ImageFile */
(function() { (function() {
...@@ -10,7 +10,5 @@ ...@@ -10,7 +10,5 @@
} }
return CommitFile; return CommitFile;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-use-before-define, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, quotes, one-var, one-var-declaration-per-line, no-unused-vars, no-return-assign, comma-dangle, quote-props, no-unused-expressions, no-sequences, object-shorthand, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-use-before-define, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, quotes, one-var, one-var-declaration-per-line, no-unused-vars, no-return-assign, comma-dangle, quote-props, no-unused-expressions, no-sequences, object-shorthand, max-len */
(function() { (function() {
gl.ImageFile = (function() { gl.ImageFile = (function() {
var prepareFrames; var prepareFrames;
...@@ -172,7 +172,5 @@ ...@@ -172,7 +172,5 @@
}; };
return ImageFile; return ImageFile;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, consistent-return, no-return-assign, no-param-reassign, one-var, no-var, one-var-declaration-per-line, no-unused-vars, prefer-template, object-shorthand, comma-dangle, padded-blocks, max-len, prefer-arrow-callback */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, consistent-return, no-return-assign, no-param-reassign, one-var, no-var, one-var-declaration-per-line, no-unused-vars, prefer-template, object-shorthand, comma-dangle, max-len, prefer-arrow-callback */
/* global Pager */ /* global Pager */
(function() { (function() {
...@@ -58,7 +58,5 @@ ...@@ -58,7 +58,5 @@
}; };
return CommitsList; return CommitsList;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, object-shorthand, consistent-return, no-unused-vars, comma-dangle, vars-on-top, prefer-template, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, object-shorthand, consistent-return, no-unused-vars, comma-dangle, vars-on-top, prefer-template, max-len */
(function() { (function() {
this.Compare = (function() { this.Compare = (function() {
function Compare(opts) { function Compare(opts) {
...@@ -87,7 +87,5 @@ ...@@ -87,7 +87,5 @@
}; };
return Compare; return Compare;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, prefer-arrow-callback, no-else-return, newline-per-chained-call, no-dupe-keys, wrap-iife, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, prefer-arrow-callback, no-else-return, newline-per-chained-call, wrap-iife, max-len */
(function() { (function() {
this.CompareAutocomplete = (function() { this.CompareAutocomplete = (function() {
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
selectable: true, selectable: true,
filterable: true, filterable: true,
filterByText: true, filterByText: true,
toggleLabel: true,
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('field-name'),
filterInput: 'input[type="search"]', filterInput: 'input[type="search"]',
renderRow: function(ref) { renderRow: function(ref) {
...@@ -66,7 +65,5 @@ ...@@ -66,7 +65,5 @@
}; };
return CompareAutocomplete; return CompareAutocomplete;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, camelcase, one-var-declaration-per-line, no-else-return, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, camelcase, one-var-declaration-per-line, no-else-return, max-len */
(function() { (function() {
this.ConfirmDangerModal = (function() { this.ConfirmDangerModal = (function() {
function ConfirmDangerModal(form, text) { function ConfirmDangerModal(form, text) {
...@@ -27,7 +27,5 @@ ...@@ -27,7 +27,5 @@
} }
return ConfirmDangerModal; return ConfirmDangerModal;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, prefer-arrow-callback, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, prefer-arrow-callback, max-len */
/* global Clipboard */ /* global Clipboard */
/*= require clipboard */ /*= require clipboard */
...@@ -46,5 +46,4 @@ ...@@ -46,5 +46,4 @@
clipboard.on('success', genericSuccess); clipboard.on('success', genericSuccess);
return clipboard.on('error', genericError); return clipboard.on('error', genericError);
}); });
}).call(this); }).call(this);
/* eslint-disable comma-dangle, object-shorthand, func-names, no-else-return, quotes, no-lonely-if, semi, max-len */ /* eslint-disable comma-dangle, object-shorthand, func-names, no-else-return, quotes, no-lonely-if, max-len */
/* global Vue */ /* global Vue */
/* global CommentsStore */ /* global CommentsStore */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
data() { data() {
return { return {
textareaIsEmpty: true textareaIsEmpty: true
} };
}, },
computed: { computed: {
discussion: function () { discussion: function () {
......
/* eslint-disable comma-dangle, object-shorthand, func-names, no-else-return, guard-for-in, no-restricted-syntax, one-var, indent, space-before-function-paren, no-plusplus, no-lonely-if, no-continue, brace-style, max-len, quotes, semi */ /* eslint-disable comma-dangle, object-shorthand, func-names, no-else-return, guard-for-in, no-restricted-syntax, one-var, space-before-function-paren, no-lonely-if, no-continue, brace-style, max-len, quotes */
/* global Vue */ /* global Vue */
/* global DiscussionMixins */ /* global DiscussionMixins */
/* global CommentsStore */ /* global CommentsStore */
...@@ -46,13 +46,13 @@ ...@@ -46,13 +46,13 @@
}, },
methods: { methods: {
jumpToNextUnresolvedDiscussion: function () { jumpToNextUnresolvedDiscussion: function () {
let discussionsSelector, let discussionsSelector;
discussionIdsInScope, let discussionIdsInScope;
firstUnresolvedDiscussionId, let firstUnresolvedDiscussionId;
nextUnresolvedDiscussionId, let nextUnresolvedDiscussionId;
activeTab = window.mrTabs.currentAction, let activeTab = window.mrTabs.currentAction;
hasDiscussionsToJumpTo = true, let hasDiscussionsToJumpTo = true;
jumpToFirstDiscussion = !this.discussionId; let jumpToFirstDiscussion = !this.discussionId;
const discussionIdsForElements = function(elements) { const discussionIdsForElements = function(elements) {
return elements.map(function() { return elements.map(function() {
...@@ -68,11 +68,11 @@ ...@@ -68,11 +68,11 @@
let unresolvedDiscussionCount = 0; let unresolvedDiscussionCount = 0;
for (let i = 0; i < discussionIdsInScope.length; i++) { for (let i = 0; i < discussionIdsInScope.length; i += 1) {
const discussionId = discussionIdsInScope[i]; const discussionId = discussionIdsInScope[i];
const discussion = discussions[discussionId]; const discussion = discussions[discussionId];
if (discussion && !discussion.isResolved()) { if (discussion && !discussion.isResolved()) {
unresolvedDiscussionCount++; unresolvedDiscussionCount += 1;
} }
} }
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
} }
let currentDiscussionFound = false; let currentDiscussionFound = false;
for (let i = 0; i < discussionIdsInScope.length; i++) { for (let i = 0; i < discussionIdsInScope.length; i += 1) {
const discussionId = discussionIdsInScope[i]; const discussionId = discussionIdsInScope[i];
const discussion = discussions[discussionId]; const discussion = discussions[discussionId];
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
// If the next discussion is closed, toggle it open. // If the next discussion is closed, toggle it open.
if ($target.find('.js-toggle-content').is(':hidden')) { if ($target.find('.js-toggle-content').is(':hidden')) {
$target.find('.js-toggle-button i').trigger('click') $target.find('.js-toggle-button i').trigger('click');
} }
} else if (activeTab === 'diffs') { } else if (activeTab === 'diffs') {
// Resolved discussions are hidden in the diffs tab by default. // Resolved discussions are hidden in the diffs tab by default.
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
// If we are on the diffs tab, we don't scroll to the discussion itself, but to // If we are on the diffs tab, we don't scroll to the discussion itself, but to
// 4 diff lines above it: the line the discussion was in response to + 3 context // 4 diff lines above it: the line the discussion was in response to + 3 context
let prevEl; let prevEl;
for (let i = 0; i < 4; i++) { for (let i = 0; i < 4; i += 1) {
prevEl = $target.prev(); prevEl = $target.prev();
// If the discussion doesn't have 4 lines above it, we'll have to do with fewer. // If the discussion doesn't have 4 lines above it, we'll have to do with fewer.
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* global Vue */ /* global Vue */
/* global ResolveCount */ /* global ResolveCount */
//= require vue
//= require vue-resource
//= require_directory ./models //= require_directory ./models
//= require_directory ./stores //= require_directory ./stores
//= require_directory ./services //= require_directory ./services
......
/* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, comma-dangle, no-plusplus, no-param-reassign, max-len */ /* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, comma-dangle, no-param-reassign, max-len */
((w) => { ((w) => {
w.DiscussionMixins = { w.DiscussionMixins = {
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
const discussion = this.discussions[discussionId]; const discussion = this.discussions[discussionId];
if (discussion.isResolved()) { if (discussion.isResolved()) {
resolvedCount++; resolvedCount += 1;
} }
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
const discussion = this.discussions[discussionId]; const discussion = this.discussions[discussionId];
if (!discussion.isResolved()) { if (!discussion.isResolved()) {
unresolvedCount++; unresolvedCount += 1;
} }
} }
......
/* eslint-disable class-methods-use-this, one-var, indent, camelcase, no-new, comma-dangle, semi, no-param-reassign, max-len */ /* eslint-disable class-methods-use-this, one-var, camelcase, no-new, comma-dangle, no-param-reassign, max-len */
/* global Vue */ /* global Vue */
/* global Flash */ /* global Flash */
/* global CommentsStore */ /* global CommentsStore */
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
} }
toggleResolveForDiscussion(projectPath, mergeRequestId, discussionId) { toggleResolveForDiscussion(projectPath, mergeRequestId, discussionId) {
const discussion = CommentsStore.state[discussionId], const discussion = CommentsStore.state[discussionId];
isResolved = discussion.isResolved(); const isResolved = discussion.isResolved();
let promise; let promise;
if (isResolved) { if (isResolved) {
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
} else { } else {
new Flash('An error occurred when trying to resolve a discussion. Please try again.', 'alert'); new Flash('An error occurred when trying to resolve a discussion. Please try again.', 'alert');
} }
}) });
} }
resolveAll(projectPath, mergeRequestId, discussionId) { resolveAll(projectPath, mergeRequestId, discussionId) {
......
/* eslint-disable object-shorthand, func-names, camelcase, prefer-const, no-restricted-syntax, guard-for-in, comma-dangle, max-len, no-param-reassign */ /* eslint-disable object-shorthand, func-names, camelcase, no-restricted-syntax, guard-for-in, comma-dangle, max-len, no-param-reassign */
/* global Vue */ /* global Vue */
/* global DiscussionModel */ /* global DiscussionModel */
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
} }
}, },
unresolvedDiscussionIds: function () { unresolvedDiscussionIds: function () {
let ids = []; const ids = [];
for (const discussionId in this.state) { for (const discussionId in this.state) {
const discussion = this.state[discussionId]; const discussion = this.state[discussionId];
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
/* global UsernameValidator */ /* global UsernameValidator */
/* global ActiveTabMemoizer */ /* global ActiveTabMemoizer */
/* global ShortcutsNavigation */ /* global ShortcutsNavigation */
...@@ -372,7 +372,5 @@ ...@@ -372,7 +372,5 @@
}; };
return Dispatcher; return Dispatcher;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, one-var, no-var, one-var-declaration-per-line, no-unused-vars, camelcase, quotes, no-useless-concat, prefer-template, quote-props, comma-dangle, object-shorthand, consistent-return, no-plusplus, prefer-arrow-callback, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, one-var, no-var, one-var-declaration-per-line, no-unused-vars, camelcase, quotes, no-useless-concat, prefer-template, quote-props, comma-dangle, object-shorthand, consistent-return, prefer-arrow-callback */
/* global Dropzone */ /* global Dropzone */
/*= require preview_markdown */ /*= require preview_markdown */
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
if (item.type.indexOf("image") !== -1) { if (item.type.indexOf("image") !== -1) {
return item; return item;
} }
i++; i += 1;
} }
return false; return false;
}; };
...@@ -215,7 +215,5 @@ ...@@ -215,7 +215,5 @@
} }
return DropzoneInput; return DropzoneInput;
})(); })();
}).call(this); }).call(this);
/* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, prefer-const, padded-blocks, no-unused-vars, no-underscore-dangle, no-new, max-len, semi, no-sequences, no-unused-expressions, no-param-reassign */ /* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */
(function(global) { (function(global) {
class DueDateSelect { class DueDateSelect {
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
this.$sidebarValue = $('.js-due-date-sidebar-value', $block); this.$sidebarValue = $('.js-due-date-sidebar-value', $block);
this.fieldName = $dropdown.data('field-name'), this.fieldName = $dropdown.data('field-name'),
this.abilityName = $dropdown.data('ability-name'), this.abilityName = $dropdown.data('ability-name'),
this.issueUpdateURL = $dropdown.data('issue-update') this.issueUpdateURL = $dropdown.data('issue-update');
this.rawSelectedDate = null; this.rawSelectedDate = null;
this.displayedDate = null; this.displayedDate = null;
...@@ -135,7 +135,6 @@ ...@@ -135,7 +135,6 @@
return selectedDateValue.length ? return selectedDateValue.length ?
$('.js-remove-due-date-holder').removeClass('hidden') : $('.js-remove-due-date-holder').removeClass('hidden') :
$('.js-remove-due-date-holder').addClass('hidden'); $('.js-remove-due-date-holder').addClass('hidden');
} }
}).done((data) => { }).done((data) => {
if (isDropdown) { if (isDropdown) {
...@@ -179,5 +178,4 @@ ...@@ -179,5 +178,4 @@
} }
global.DueDateSelectors = DueDateSelectors; global.DueDateSelectors = DueDateSelectors;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable no-extend-native, func-names, space-before-function-paren, semi, space-infix-ops, max-len */ /* eslint-disable no-extend-native, func-names, space-before-function-paren, space-infix-ops, max-len */
Array.prototype.first = function() { Array.prototype.first = function() {
return this[0]; return this[0];
} };
Array.prototype.last = function() { Array.prototype.last = function() {
return this[this.length-1]; return this[this.length-1];
} };
Array.prototype.find = Array.prototype.find || function(predicate, ...args) { Array.prototype.find = Array.prototype.find || function(predicate, ...args) {
if (!this) throw new TypeError('Array.prototype.find called on null or undefined'); if (!this) throw new TypeError('Array.prototype.find called on null or undefined');
......
/* global Element */ /* global Element */
/* eslint-disable consistent-return, max-len, no-empty, no-plusplus, func-names */ /* eslint-disable consistent-return, max-len, no-empty, func-names */
Element.prototype.closest = Element.prototype.closest || function closest(selector, selectedElement = this) { Element.prototype.closest = Element.prototype.closest || function closest(selector, selectedElement = this) {
if (!selectedElement) return; if (!selectedElement) return;
...@@ -14,7 +14,7 @@ Element.prototype.matches = Element.prototype.matches || ...@@ -14,7 +14,7 @@ Element.prototype.matches = Element.prototype.matches ||
Element.prototype.webkitMatchesSelector || Element.prototype.webkitMatchesSelector ||
function (s) { function (s) {
const matches = (this.document || this.ownerDocument).querySelectorAll(s); const matches = (this.document || this.ownerDocument).querySelectorAll(s);
let i = matches.length; let i = matches.length - 1;
while (--i >= 0 && matches.item(i) !== this) {} while (i >= 0 && matches.item(i) !== this) { i -= 1; }
return i > -1; return i > -1;
}; };
/* eslint-disable func-names, space-before-function-paren, object-shorthand, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, object-shorthand, comma-dangle, max-len */
// Disable an element and add the 'disabled' Bootstrap class // Disable an element and add the 'disabled' Bootstrap class
(function() { (function() {
$.fn.extend({ $.fn.extend({
...@@ -13,5 +13,4 @@ ...@@ -13,5 +13,4 @@
return $(this).removeAttr('disabled').removeClass('disabled'); return $(this).removeAttr('disabled').removeClass('disabled');
} }
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, max-len, one-var, one-var-declaration-per-line, quotes, prefer-template, newline-per-chained-call, comma-dangle, new-cap, no-else-return, padded-blocks, consistent-return */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, max-len, one-var, one-var-declaration-per-line, quotes, prefer-template, newline-per-chained-call, comma-dangle, new-cap, no-else-return, consistent-return */
/* global FilesCommentButton */ /* global FilesCommentButton */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.FilesCommentButton = (function() { this.FilesCommentButton = (function() {
var COMMENT_BUTTON_CLASS, COMMENT_BUTTON_TEMPLATE, DEBOUNCE_TIMEOUT_DURATION, EMPTY_CELL_CLASS, LINE_COLUMN_CLASSES, LINE_CONTENT_CLASS, LINE_HOLDER_CLASS, LINE_NUMBER_CLASS, OLD_LINE_CLASS, TEXT_FILE_SELECTOR, UNFOLDABLE_LINE_CLASS; var COMMENT_BUTTON_CLASS, COMMENT_BUTTON_TEMPLATE, DEBOUNCE_TIMEOUT_DURATION, EMPTY_CELL_CLASS, LINE_COLUMN_CLASSES, LINE_CONTENT_CLASS, LINE_HOLDER_CLASS, LINE_NUMBER_CLASS, OLD_LINE_CLASS, TEXT_FILE_SELECTOR, UNFOLDABLE_LINE_CLASS;
...@@ -132,7 +132,6 @@ ...@@ -132,7 +132,6 @@
}; };
return FilesCommentButton; return FilesCommentButton;
})(); })();
$.fn.filesCommentButton = function() { $.fn.filesCommentButton = function() {
...@@ -145,5 +144,4 @@ ...@@ -145,5 +144,4 @@
} }
}); });
}; };
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, no-param-reassign, quotes, quote-props, prefer-template, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, no-param-reassign, quotes, quote-props, prefer-template, comma-dangle, max-len */
(function() { (function() {
this.Flash = (function() { this.Flash = (function() {
var hideFlash; var hideFlash;
...@@ -38,7 +38,5 @@ ...@@ -38,7 +38,5 @@
} }
return Flash; return Flash;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-template-curly-in-string, comma-dangle, object-shorthand, quotes, dot-notation, no-else-return, one-var, no-var, no-underscore-dangle, one-var-declaration-per-line, no-param-reassign, no-useless-escape, prefer-template, consistent-return, wrap-iife, prefer-arrow-callback, camelcase, no-unused-vars, no-useless-return, padded-blocks, vars-on-top, indent, no-extra-semi, no-multi-spaces, semi, max-len */ /* eslint-disable func-names, space-before-function-paren, no-template-curly-in-string, comma-dangle, object-shorthand, quotes, dot-notation, no-else-return, one-var, no-var, no-underscore-dangle, one-var-declaration-per-line, no-param-reassign, no-useless-escape, prefer-template, consistent-return, wrap-iife, prefer-arrow-callback, camelcase, no-unused-vars, no-useless-return, vars-on-top, max-len */
// Creates the variables for setting up GFM auto-completion // Creates the variables for setting up GFM auto-completion
(function() { (function() {
...@@ -48,8 +48,9 @@ ...@@ -48,8 +48,9 @@
}, },
DefaultOptions: { DefaultOptions: {
sorter: function(query, items, searchKey) { sorter: function(query, items, searchKey) {
this.setting.highlightFirst = query.length > 0; this.setting.highlightFirst = this.setting.alwaysHighlightFirst || query.length > 0;
if (gl.GfmAutoComplete.isLoading(items)) { if (gl.GfmAutoComplete.isLoading(items)) {
this.setting.highlightFirst = false;
return items; return items;
} }
return $.fn.atwho["default"].callbacks.sorter(query, items, searchKey); return $.fn.atwho["default"].callbacks.sorter(query, items, searchKey);
...@@ -153,7 +154,7 @@ ...@@ -153,7 +154,7 @@
return { return {
username: m.username, username: m.username,
avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar, avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar,
title: sanitize(title), title: sanitize(title),
search: sanitize(m.username + " " + m.name) search: sanitize(m.username + " " + m.name)
}; };
...@@ -334,7 +335,7 @@ ...@@ -334,7 +335,7 @@
}); });
}, },
matcher: function(flag, subtext, should_startWithSpace, acceptSpaceBar) { matcher: function(flag, subtext, should_startWithSpace, acceptSpaceBar) {
var regexp = /(?:^|\n)\/([A-Za-z_]*)$/gi var regexp = /(?:^|\n)\/([A-Za-z_]*)$/gi;
var match = regexp.exec(subtext); var match = regexp.exec(subtext);
if (match) { if (match) {
return match[1]; return match[1];
...@@ -371,5 +372,4 @@ ...@@ -371,5 +372,4 @@
return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0]; return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0];
} }
}; };
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, space-before-blocks, prefer-rest-params, max-len, vars-on-top, no-plusplus, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, semi, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, padded-blocks, prefer-template, no-param-reassign, no-loop-func, no-extra-semi, keyword-spacing, no-mixed-operators */ /* eslint-disable func-names, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, prefer-rest-params, max-len, vars-on-top, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func, no-mixed-operators */
/* global fuzzaldrinPlus */ /* global fuzzaldrinPlus */
/* global Turbolinks */ /* global Turbolinks */
(function() { (function() {
var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote, var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; },
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i += 1) { if (i in this && this[i] === item) return i; } return -1; };
GitLabDropdownFilter = (function() { GitLabDropdownFilter = (function() {
var ARROW_KEY_CODES, BLUR_KEYCODES, HAS_VALUE_CLASS; var ARROW_KEY_CODES, BLUR_KEYCODES, HAS_VALUE_CLASS;
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
.on('keydown', function (e) { .on('keydown', function (e) {
var keyCode = e.which; var keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) { if (keyCode === 13 && !options.elIsInput) {
e.preventDefault() e.preventDefault();
} }
}) })
.on('input', function() { .on('input', function() {
...@@ -133,7 +133,6 @@ ...@@ -133,7 +133,6 @@
}; };
return GitLabDropdownFilter; return GitLabDropdownFilter;
})(); })();
GitLabDropdownRemote = (function() { GitLabDropdownRemote = (function() {
...@@ -186,7 +185,6 @@ ...@@ -186,7 +185,6 @@
}; };
return GitLabDropdownRemote; return GitLabDropdownRemote;
})(); })();
GitLabDropdown = (function() { GitLabDropdown = (function() {
...@@ -206,7 +204,7 @@ ...@@ -206,7 +204,7 @@
SELECTABLE_CLASSES = ".dropdown-content li:not(" + NON_SELECTABLE_CLASSES + ", .option-hidden)"; SELECTABLE_CLASSES = ".dropdown-content li:not(" + NON_SELECTABLE_CLASSES + ", .option-hidden)";
CURSOR_SELECT_SCROLL_PADDING = 5 CURSOR_SELECT_SCROLL_PADDING = 5;
FILTER_INPUT = '.dropdown-input .dropdown-input-field'; FILTER_INPUT = '.dropdown-input .dropdown-input-field';
...@@ -223,7 +221,7 @@ ...@@ -223,7 +221,7 @@
this.dropdown = selector != null ? $(selector) : $(this.el).parent(); this.dropdown = selector != null ? $(selector) : $(this.el).parent();
// Set Defaults // Set Defaults
this.filterInput = this.options.filterInput || this.getElement(FILTER_INPUT); this.filterInput = this.options.filterInput || this.getElement(FILTER_INPUT);
this.highlight = !!this.options.highlight this.highlight = !!this.options.highlight;
this.filterInputBlur = this.options.filterInputBlur != null this.filterInputBlur = this.options.filterInputBlur != null
? this.options.filterInputBlur ? this.options.filterInputBlur
: true; : true;
...@@ -494,7 +492,7 @@ ...@@ -494,7 +492,7 @@
} else { } else {
var ul = document.createElement('ul'); var ul = document.createElement('ul');
for (var i = 0; i < html.length; i++) { for (var i = 0; i < html.length; i += 1) {
var el = html[i]; var el = html[i];
if (el instanceof jQuery) { if (el instanceof jQuery) {
...@@ -550,7 +548,7 @@ ...@@ -550,7 +548,7 @@
value = this.options.id ? this.options.id(data) : data.id; value = this.options.id ? this.options.id(data) : data.id;
fieldName = this.options.fieldName; fieldName = this.options.fieldName;
if (value) { value = value.toString().replace(/'/g, '\\\'') }; if (value) { value = value.toString().replace(/'/g, '\\\''); }
field = this.dropdown.parent().find("input[name='" + fieldName + "'][value='" + value + "']"); field = this.dropdown.parent().find("input[name='" + fieldName + "'][value='" + value + "']");
if (field.length) { if (field.length) {
...@@ -641,7 +639,7 @@ ...@@ -641,7 +639,7 @@
: selectedObject.id; : selectedObject.id;
if (isInput) { if (isInput) {
field = $(this.el); field = $(this.el);
} else if(value) { } else if (value) {
field = this.dropdown.parent().find("input[name='" + fieldName + "'][value='" + value.toString().replace(/'/g, '\\\'') + "']"); field = this.dropdown.parent().find("input[name='" + fieldName + "'][value='" + value.toString().replace(/'/g, '\\\'') + "']");
} }
...@@ -695,8 +693,8 @@ ...@@ -695,8 +693,8 @@
}; };
GitLabDropdown.prototype.focusTextInput = function() { GitLabDropdown.prototype.focusTextInput = function() {
if (this.options.filterable) { this.filterInput.focus() } if (this.options.filterable) { this.filterInput.focus(); }
} };
GitLabDropdown.prototype.addInput = function(fieldName, value, selectedObject) { GitLabDropdown.prototype.addInput = function(fieldName, value, selectedObject) {
var $input; var $input;
...@@ -802,7 +800,7 @@ ...@@ -802,7 +800,7 @@
listItemBottom = listItemTop + listItemHeight; listItemBottom = listItemTop + listItemHeight;
if (!index) { if (!index) {
// Scroll the dropdown content to the top // Scroll the dropdown content to the top
$dropdownContent.scrollTop(0) $dropdownContent.scrollTop(0);
} else if (index === ($listItems.length - 1)) { } else if (index === ($listItems.length - 1)) {
// Scroll the dropdown content to the bottom // Scroll the dropdown content to the bottom
$dropdownContent.scrollTop($dropdownContent.prop('scrollHeight')); $dropdownContent.scrollTop($dropdownContent.prop('scrollHeight'));
...@@ -829,7 +827,6 @@ ...@@ -829,7 +827,6 @@
}; };
return GitLabDropdown; return GitLabDropdown;
})(); })();
$.fn.glDropdown = function(opts) { $.fn.glDropdown = function(opts) {
...@@ -839,5 +836,4 @@ ...@@ -839,5 +836,4 @@
} }
}); });
}; };
}).call(this); }).call(this);
/* eslint-disable comma-dangle, class-methods-use-this, max-len, space-before-function-paren, arrow-parens, no-param-reassign, padded-blocks */ /* eslint-disable comma-dangle, class-methods-use-this, max-len, space-before-function-paren, arrow-parens, no-param-reassign */
//= require gl_field_error //= require gl_field_error
...@@ -45,5 +45,4 @@ ...@@ -45,5 +45,4 @@
} }
global.GlFieldErrors = GlFieldErrors; global.GlFieldErrors = GlFieldErrors;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-new, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-new, max-len */
/* global GitLab */ /* global GitLab */
/* global DropzoneInput */ /* global DropzoneInput */
/* global autosize */ /* global autosize */
...@@ -58,7 +58,5 @@ ...@@ -58,7 +58,5 @@
}; };
return GLForm; return GLForm;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-return-assign, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-return-assign, max-len */
(function() { (function() {
this.StatGraph = (function() { this.StatGraph = (function() {
function StatGraph() {} function StatGraph() {}
...@@ -14,7 +14,5 @@ ...@@ -14,7 +14,5 @@
}; };
return StatGraph; return StatGraph;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign, padded-blocks */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign */
/* global ContributorsGraph */ /* global ContributorsGraph */
/* global ContributorsAuthorGraph */ /* global ContributorsAuthorGraph */
/* global ContributorsMasterGraph */ /* global ContributorsMasterGraph */
...@@ -112,7 +112,5 @@ ...@@ -112,7 +112,5 @@
}; };
return ContributorsStatGraph; return ContributorsStatGraph;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, space-before-blocks, prefer-rest-params, max-len, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, comma-dangle, no-return-assign, prefer-arrow-callback, quotes, prefer-template, padded-blocks, newline-per-chained-call, no-else-return */ /* eslint-disable func-names, space-before-function-paren, one-var, no-var, prefer-rest-params, max-len, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, comma-dangle, no-return-assign, prefer-arrow-callback, quotes, prefer-template, newline-per-chained-call, no-else-return */
/* global d3 */ /* global d3 */
/* global ContributorsGraph */ /* global ContributorsGraph */
/*= require d3 */ /*= require d3 */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; },
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty; hasProp = {}.hasOwnProperty;
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
}; };
return ContributorsGraph; return ContributorsGraph;
})(); })();
this.ContributorsMasterGraph = (function(superClass) { this.ContributorsMasterGraph = (function(superClass) {
...@@ -196,7 +195,6 @@ ...@@ -196,7 +195,6 @@
}; };
return ContributorsMasterGraph; return ContributorsMasterGraph;
})(ContributorsGraph); })(ContributorsGraph);
this.ContributorsAuthorGraph = (function(superClass) { this.ContributorsAuthorGraph = (function(superClass) {
...@@ -274,7 +272,5 @@ ...@@ -274,7 +272,5 @@
}; };
return ContributorsAuthorGraph; return ContributorsAuthorGraph;
})(ContributorsGraph); })(ContributorsGraph);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, object-shorthand, no-var, one-var, camelcase, one-var-declaration-per-line, no-plusplus, comma-dangle, no-param-reassign, no-return-assign, quotes, prefer-arrow-callback, wrap-iife, consistent-return, no-unused-vars, max-len, no-cond-assign, no-else-return, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, object-shorthand, no-var, one-var, camelcase, one-var-declaration-per-line, comma-dangle, no-param-reassign, no-return-assign, quotes, prefer-arrow-callback, wrap-iife, consistent-return, no-unused-vars, max-len, no-cond-assign, no-else-return, max-len */
(function() { (function() {
window.ContributorsStatGraphUtil = { window.ContributorsStatGraphUtil = {
parse_log: function(log) { parse_log: function(log) {
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
total = {}; total = {};
by_author = {}; by_author = {};
by_email = {}; by_email = {};
for (i = 0, len = log.length; i < len; i++) { for (i = 0, len = log.length; i < len; i += 1) {
entry = log[i]; entry = log[i];
if (total[entry.date] == null) { if (total[entry.date] == null) {
this.add_date(entry.date, total); this.add_date(entry.date, total);
...@@ -135,5 +135,4 @@ ...@@ -135,5 +135,4 @@
} }
} }
}; };
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, one-var, one-var-declaration-per-line, no-useless-escape, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, one-var, one-var-declaration-per-line, no-useless-escape, max-len */
(function() { (function() {
this.GroupAvatar = (function() { this.GroupAvatar = (function() {
function GroupAvatar() { function GroupAvatar() {
...@@ -16,7 +16,5 @@ ...@@ -16,7 +16,5 @@
} }
return GroupAvatar; return GroupAvatar;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, object-shorthand, comma-dangle, wrap-iife, space-before-function-paren, no-param-reassign, padded-blocks, max-len */ /* eslint-disable func-names, object-shorthand, comma-dangle, wrap-iife, space-before-function-paren, no-param-reassign, max-len */
(function(global) { (function(global) {
class GroupLabelSubscription { class GroupLabelSubscription {
...@@ -50,5 +50,4 @@ ...@@ -50,5 +50,4 @@
} }
global.GroupLabelSubscription = GroupLabelSubscription; global.GroupLabelSubscription = GroupLabelSubscription;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, no-var, wrap-iife, one-var, camelcase, one-var-declaration-per-line, quotes, object-shorthand, prefer-arrow-callback, comma-dangle, consistent-return, yoda, prefer-rest-params, prefer-spread, no-unused-vars, prefer-template, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, wrap-iife, one-var, camelcase, one-var-declaration-per-line, quotes, object-shorthand, prefer-arrow-callback, comma-dangle, consistent-return, yoda, prefer-rest-params, prefer-spread, no-unused-vars, prefer-template, max-len */
/* global Api */ /* global Api */
(function() { (function() {
...@@ -67,7 +67,5 @@ ...@@ -67,7 +67,5 @@
}; };
return GroupsSelect; return GroupsSelect;
})(); })();
}).call(this); }).call(this);
/* eslint-disable wrap-iife, func-names, space-before-function-paren, padded-blocks, prefer-arrow-callback, no-var, max-len */ /* eslint-disable wrap-iife, func-names, space-before-function-paren, prefer-arrow-callback, no-var, max-len */
(function() { (function() {
$(document).on('todo:toggle', function(e, count) { $(document).on('todo:toggle', function(e, count) {
var $todoPendingCount = $('.todos-pending-count'); var $todoPendingCount = $('.todos-pending-count');
$todoPendingCount.text(gl.text.addDelimiter(count)); $todoPendingCount.text(gl.text.addDelimiter(count));
$todoPendingCount.toggleClass('hidden', count === 0); $todoPendingCount.toggleClass('hidden', count === 0);
}); });
})(); })();
/* eslint-disable func-names, space-before-function-paren, wrap-iife, camelcase, no-var, one-var, one-var-declaration-per-line, prefer-template, quotes, object-shorthand, comma-dangle, no-unused-vars, prefer-arrow-callback, no-else-return, padded-blocks, vars-on-top, no-new, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, camelcase, no-var, one-var, one-var-declaration-per-line, prefer-template, quotes, object-shorthand, comma-dangle, no-unused-vars, prefer-arrow-callback, no-else-return, vars-on-top, no-new, max-len */
(function() { (function() {
window.ImporterStatus = (function() { window.ImporterStatus = (function() {
...@@ -68,7 +68,6 @@ ...@@ -68,7 +68,6 @@
}; };
return ImporterStatus; return ImporterStatus;
})(); })();
$(function() { $(function() {
......
/* eslint-disable no-param-reassign, func-names, no-var, camelcase, no-unused-vars, object-shorthand, space-before-function-paren, no-return-assign, comma-dangle, consistent-return, one-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, prefer-const, padded-blocks, wrap-iife, max-len */ /* eslint-disable no-param-reassign, func-names, no-var, camelcase, no-unused-vars, object-shorthand, space-before-function-paren, no-return-assign, comma-dangle, consistent-return, one-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, wrap-iife, max-len */
/* global Issuable */ /* global Issuable */
/* global Turbolinks */ /* global Turbolinks */
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
e.preventDefault(); e.preventDefault();
debouncedExecSearch(e); debouncedExecSearch(e);
}); });
}, },
initSearchState: function($searchInput) { initSearchState: function($searchInput) {
const currentSearchVal = $searchInput.val(); const currentSearchVal = $searchInput.val();
...@@ -152,7 +151,7 @@ ...@@ -152,7 +151,7 @@
this.issuableBulkActions.setOriginalDropdownData(); this.issuableBulkActions.setOriginalDropdownData();
if ($checkedIssues.length > 0) { if ($checkedIssues.length > 0) {
let ids = $.map($checkedIssues, function(value) { const ids = $.map($checkedIssues, function(value) {
return $(value).data('id'); return $(value).data('id');
}); });
$updateIssuesIds.val(ids); $updateIssuesIds.val(ids);
...@@ -187,5 +186,4 @@ ...@@ -187,5 +186,4 @@
}); });
} }
}; };
})(window); })(window);
//= require ./time_tracking/time_tracking_bundle
/* global Vue */
//= require lib/utils/pretty_time
(() => {
Vue.component('time-tracking-collapsed-state', {
name: 'time-tracking-collapsed-state',
props: [
'showComparisonState',
'showSpentOnlyState',
'showEstimateOnlyState',
'showNoTimeTrackingState',
'timeSpentHumanReadable',
'timeEstimateHumanReadable',
'stopwatchSvg',
],
methods: {
abbreviateTime(timeStr) {
return gl.utils.prettyTime.abbreviateTime(timeStr);
},
},
template: `
<div class='sidebar-collapsed-icon'>
<div v-html='stopwatchSvg'></div>
<div class='time-tracking-collapsed-summary'>
<div class='compare' v-if='showComparisonState'>
<span>{{ abbreviateTime(timeSpentHumanReadable) }} / {{ abbreviateTime(timeEstimateHumanReadable) }}</span>
</div>
<div class='estimate-only' v-if='showEstimateOnlyState'>
<span class='bold'>-- / {{ abbreviateTime(timeEstimateHumanReadable) }}</span>
</div>
<div class='spend-only' v-if='showSpentOnlyState'>
<span class='bold'>{{ abbreviateTime(timeSpentHumanReadable) }} / --</span>
</div>
<div class='no-tracking' v-if='showNoTimeTrackingState'>
<span class='no-value'>None</span>
</div>
</div>
</div>
`,
});
})();
/* global Vue */
//= require lib/utils/pretty_time
(() => {
const prettyTime = gl.utils.prettyTime;
Vue.component('time-tracking-comparison-pane', {
name: 'time-tracking-comparison-pane',
props: [
'timeSpent',
'timeEstimate',
'timeSpentHumanReadable',
'timeEstimateHumanReadable',
],
computed: {
parsedRemaining() {
const diffSeconds = this.timeEstimate - this.timeSpent;
return prettyTime.parseSeconds(diffSeconds);
},
timeRemainingHumanReadable() {
return prettyTime.stringifyTime(this.parsedRemaining);
},
timeRemainingTooltip() {
const prefix = this.timeRemainingMinutes < 0 ? 'Over by' : 'Time remaining:';
return `${prefix} ${this.timeRemainingHumanReadable}`;
},
/* Diff values for comparison meter */
timeRemainingMinutes() {
return this.timeEstimate - this.timeSpent;
},
timeRemainingPercent() {
return `${Math.floor((this.timeSpent / this.timeEstimate) * 100)}%`;
},
timeRemainingStatusClass() {
return this.timeEstimate >= this.timeSpent ? 'within_estimate' : 'over_estimate';
},
/* Parsed time values */
parsedEstimate() {
return prettyTime.parseSeconds(this.timeEstimate);
},
parsedSpent() {
return prettyTime.parseSeconds(this.timeSpent);
},
},
template: `
<div class='time-tracking-comparison-pane'>
<div class='compare-meter' data-toggle='tooltip' data-placement='top' role='timeRemainingDisplay'
:aria-valuenow='timeRemainingTooltip'
:title='timeRemainingTooltip'
:data-original-title='timeRemainingTooltip'
:class='timeRemainingStatusClass'>
<div class='meter-container' role='timeSpentPercent' :aria-valuenow='timeRemainingPercent'>
<div :style='{ width: timeRemainingPercent }' class='meter-fill'></div>
</div>
<div class='compare-display-container'>
<div class='compare-display pull-left'>
<span class='compare-label'>Spent</span>
<span class='compare-value spent'>{{ timeSpentHumanReadable }}</span>
</div>
<div class='compare-display estimated pull-right'>
<span class='compare-label'>Est</span>
<span class='compare-value'>{{ timeEstimateHumanReadable }}</span>
</div>
</div>
</div>
</div>
`,
});
})();
/* global Vue */
(() => {
Vue.component('time-tracking-estimate-only-pane', {
name: 'time-tracking-estimate-only-pane',
props: ['timeEstimateHumanReadable'],
template: `
<div class='time-tracking-estimate-only-pane'>
<span class='bold'>Estimated:</span>
{{ timeEstimateHumanReadable }}
</div>
`,
});
})();
/* global Vue */
(() => {
Vue.component('time-tracking-help-state', {
name: 'time-tracking-help-state',
props: ['docsUrl'],
template: `
<div class='time-tracking-help-state'>
<div class='time-tracking-info'>
<h4>Track time with slash commands</h4>
<p>Slash commands can be used in the issues description and comment boxes.</p>
<p>
<code>/estimate</code>
will update the estimated time with the latest command.
</p>
<p>
<code>/spend</code>
will update the sum of the time spent.
</p>
<a class='btn btn-default learn-more-button' :href='docsUrl'>Learn more</a>
</div>
</div>
`,
});
})();
/* global Vue */
(() => {
Vue.component('time-tracking-no-tracking-pane', {
name: 'time-tracking-no-tracking-pane',
template: `
<div class='time-tracking-no-tracking-pane'>
<span class='no-value'>No estimate or time spent</span>
</div>
`,
});
})();
/* global Vue */
(() => {
Vue.component('time-tracking-spent-only-pane', {
name: 'time-tracking-spent-only-pane',
props: ['timeSpentHumanReadable'],
template: `
<div class='time-tracking-spend-only-pane'>
<span class='bold'>Spent:</span>
{{ timeSpentHumanReadable }}
</div>
`,
});
})();
/* global Vue */
//= require ./help_state
//= require ./collapsed_state
//= require ./spent_only_pane
//= require ./no_tracking_pane
//= require ./estimate_only_pane
//= require ./comparison_pane
(() => {
Vue.component('issuable-time-tracker', {
name: 'issuable-time-tracker',
props: [
'time_estimate',
'time_spent',
'human_time_estimate',
'human_time_spent',
'stopwatchSvg',
'docsUrl',
],
data() {
return {
showHelp: false,
};
},
computed: {
timeSpent() {
return this.time_spent;
},
timeEstimate() {
return this.time_estimate;
},
timeEstimateHumanReadable() {
return this.human_time_estimate;
},
timeSpentHumanReadable() {
return this.human_time_spent;
},
hasTimeSpent() {
return !!this.timeSpent;
},
hasTimeEstimate() {
return !!this.timeEstimate;
},
showComparisonState() {
return this.hasTimeEstimate && this.hasTimeSpent;
},
showEstimateOnlyState() {
return this.hasTimeEstimate && !this.hasTimeSpent;
},
showSpentOnlyState() {
return this.hasTimeSpent && !this.hasTimeEstimate;
},
showNoTimeTrackingState() {
return !this.hasTimeEstimate && !this.hasTimeSpent;
},
showHelpState() {
return !!this.showHelp;
},
},
methods: {
toggleHelpState(show) {
this.showHelp = show;
},
},
template: `
<div class='time_tracker time-tracking-component-wrap' v-cloak>
<time-tracking-collapsed-state
:show-comparison-state='showComparisonState'
:show-help-state='showHelpState'
:show-spent-only-state='showSpentOnlyState'
:show-estimate-only-state='showEstimateOnlyState'
:time-spent-human-readable='timeSpentHumanReadable'
:time-estimate-human-readable='timeEstimateHumanReadable'
:stopwatch-svg='stopwatchSvg'>
</time-tracking-collapsed-state>
<div class='title hide-collapsed'>
Time tracking
<div class='help-button pull-right'
v-if='!showHelpState'
@click='toggleHelpState(true)'>
<i class='fa fa-question-circle'></i>
</div>
<div class='close-help-button pull-right'
v-if='showHelpState'
@click='toggleHelpState(false)'>
<i class='fa fa-close'></i>
</div>
</div>
<div class='time-tracking-content hide-collapsed'>
<time-tracking-estimate-only-pane
v-if='showEstimateOnlyState'
:time-estimate-human-readable='timeEstimateHumanReadable'>
</time-tracking-estimate-only-pane>
<time-tracking-spent-only-pane
v-if='showSpentOnlyState'
:time-spent-human-readable='timeSpentHumanReadable'>
</time-tracking-spent-only-pane>
<time-tracking-no-tracking-pane
v-if='showNoTimeTrackingState'>
</time-tracking-no-tracking-pane>
<time-tracking-comparison-pane
v-if='showComparisonState'
:time-estimate='timeEstimate'
:time-spent='timeSpent'
:time-spent-human-readable='timeSpentHumanReadable'
:time-estimate-human-readable='timeEstimateHumanReadable'>
</time-tracking-comparison-pane>
<transition name='help-state-toggle'>
<time-tracking-help-state
v-if='showHelpState'
:docs-url='docsUrl'>
</time-tracking-help-state>
</transition>
</div>
</div>
`,
});
})();
/* global Vue */
//= require ./components/time_tracker
//= require smart_interval
//= require subbable_resource
(() => {
/* This Vue instance represents what will become the parent instance for the
* sidebar. It will be responsible for managing `issuable` state and propagating
* changes to sidebar components. We will want to create a separate service to
* interface with the server at that point.
*/
class IssuableTimeTracking {
constructor(issuableJSON) {
const parsedIssuable = JSON.parse(issuableJSON);
return this.initComponent(parsedIssuable);
}
initComponent(parsedIssuable) {
this.parentInstance = new Vue({
el: '#issuable-time-tracker',
data: {
issuable: parsedIssuable,
},
methods: {
fetchIssuable() {
return gl.IssuableResource.get.call(gl.IssuableResource, {
type: 'GET',
url: gl.IssuableResource.endpoint,
});
},
updateState(data) {
this.issuable = data;
},
subscribeToUpdates() {
gl.IssuableResource.subscribe(data => this.updateState(data));
},
listenForSlashCommands() {
$(document).on('ajax:success', '.gfm-form', (e, data) => {
const subscribedCommands = ['spend_time', 'time_estimate'];
const changedCommands = data.commands_changes;
if (changedCommands && _.intersection(subscribedCommands, changedCommands).length) {
this.fetchIssuable();
}
});
},
},
created() {
this.fetchIssuable();
},
mounted() {
this.subscribeToUpdates();
this.listenForSlashCommands();
},
});
}
}
gl.IssuableTimeTracking = IssuableTimeTracking;
})(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-new, comma-dangle, quotes, prefer-arrow-callback, consistent-return, one-var, no-var, one-var-declaration-per-line, no-underscore-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-new, comma-dangle, quotes, prefer-arrow-callback, consistent-return, one-var, no-var, one-var-declaration-per-line, no-underscore-dangle, max-len */
/* global UsersSelect */ /* global UsersSelect */
(function() { (function() {
...@@ -66,7 +66,5 @@ ...@@ -66,7 +66,5 @@
}; };
return IssuableContext; return IssuableContext;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, no-use-before-define, no-useless-escape, no-new, quotes, object-shorthand, no-unused-vars, comma-dangle, radix, no-alert, consistent-return, no-else-return, prefer-template, one-var, one-var-declaration-per-line, curly, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-use-before-define, no-useless-escape, no-new, quotes, object-shorthand, no-unused-vars, comma-dangle, no-alert, consistent-return, no-else-return, prefer-template, one-var, one-var-declaration-per-line, curly, max-len */
/* global GitLab */ /* global GitLab */
/* global UsersSelect */ /* global UsersSelect */
/* global ZenMode */ /* global ZenMode */
/* global Autosave */ /* global Autosave */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.IssuableForm = (function() { this.IssuableForm = (function() {
IssuableForm.prototype.issueMoveConfirmMsg = 'Are you sure you want to move this issue to another project?'; IssuableForm.prototype.issueMoveConfirmMsg = 'Are you sure you want to move this issue to another project?';
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
IssuableForm.prototype.handleSubmit = function() { IssuableForm.prototype.handleSubmit = function() {
var fieldId = (this.issueMoveField != null) ? this.issueMoveField.val() : null; var fieldId = (this.issueMoveField != null) ? this.issueMoveField.val() : null;
if ((parseInt(fieldId) || 0) > 0) { if ((parseInt(fieldId, 10) || 0) > 0) {
if (!confirm(this.issueMoveConfirmMsg)) { if (!confirm(this.issueMoveConfirmMsg)) {
return false; return false;
} }
...@@ -150,7 +150,5 @@ ...@@ -150,7 +150,5 @@
}; };
return IssuableForm; return IssuableForm;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, one-var, no-underscore-dangle, one-var-declaration-per-line, object-shorthand, no-unused-vars, no-new, comma-dangle, consistent-return, quotes, dot-notation, quote-props, prefer-arrow-callback, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, no-underscore-dangle, one-var-declaration-per-line, object-shorthand, no-unused-vars, no-new, comma-dangle, consistent-return, quotes, dot-notation, quote-props, prefer-arrow-callback, max-len */
/* global Flash */ /* global Flash */
/*= require flash */ /*= require flash */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
/*= require task_list */ /*= require task_list */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Issue = (function() { this.Issue = (function() {
function Issue() { function Issue() {
...@@ -151,7 +151,5 @@ ...@@ -151,7 +151,5 @@
}; };
return Issue; return Issue;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, object-shorthand, no-unused-vars, no-shadow, one-var, one-var-declaration-per-line, comma-dangle, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, object-shorthand, no-unused-vars, no-shadow, one-var, one-var-declaration-per-line, comma-dangle, max-len */
(function() { (function() {
this.IssueStatusSelect = (function() { this.IssueStatusSelect = (function() {
function IssueStatusSelect() { function IssueStatusSelect() {
...@@ -30,7 +30,5 @@ ...@@ -30,7 +30,5 @@
} }
return IssueStatusSelect; return IssueStatusSelect;
})(); })();
}).call(this); }).call(this);
/* eslint-disable comma-dangle, quotes, consistent-return, func-names, array-callback-return, space-before-function-paren, prefer-arrow-callback, radix, max-len, padded-blocks, no-unused-expressions, no-sequences, no-underscore-dangle, no-unused-vars, no-param-reassign */ /* eslint-disable comma-dangle, quotes, consistent-return, func-names, array-callback-return, space-before-function-paren, prefer-arrow-callback, max-len, no-unused-expressions, no-sequences, no-underscore-dangle, no-unused-vars, no-param-reassign */
/* global Issuable */ /* global Issuable */
/* global Flash */ /* global Flash */
((global) => { ((global) => {
class IssuableBulkActions { class IssuableBulkActions {
constructor({ container, form, issues, prefixId } = {}) { constructor({ container, form, issues, prefixId } = {}) {
this.prefixId = prefixId || 'issue_'; this.prefixId = prefixId || 'issue_';
...@@ -163,5 +162,4 @@ ...@@ -163,5 +162,4 @@
} }
global.IssuableBulkActions = IssuableBulkActions; global.IssuableBulkActions = IssuableBulkActions;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable comma-dangle, class-methods-use-this, no-underscore-dangle, no-param-reassign, no-unused-vars, consistent-return, func-names, space-before-function-paren, padded-blocks, max-len */ /* eslint-disable comma-dangle, class-methods-use-this, no-underscore-dangle, no-param-reassign, no-unused-vars, consistent-return, func-names, space-before-function-paren, max-len */
/* global Flash */ /* global Flash */
((global) => { ((global) => {
class LabelManager { class LabelManager {
constructor({ togglePriorityButton, prioritizedLabels, otherLabels } = {}) { constructor({ togglePriorityButton, prioritizedLabels, otherLabels } = {}) {
this.togglePriorityButton = togglePriorityButton || $('.js-toggle-priority'); this.togglePriorityButton = togglePriorityButton || $('.js-toggle-priority');
...@@ -104,5 +103,4 @@ ...@@ -104,5 +103,4 @@
} }
gl.LabelManager = LabelManager; gl.LabelManager = LabelManager;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, vars-on-top, no-unused-vars, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, vars-on-top, no-unused-vars, max-len */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Labels = (function() { this.Labels = (function() {
function Labels() { function Labels() {
...@@ -42,7 +42,5 @@ ...@@ -42,7 +42,5 @@
}; };
return Labels; return Labels;
})(); })();
}).call(this); }).call(this);
/* eslint-disable no-useless-return, func-names, space-before-function-paren, wrap-iife, no-var, no-underscore-dangle, prefer-arrow-callback, max-len, one-var, no-unused-vars, one-var-declaration-per-line, prefer-template, no-new, consistent-return, object-shorthand, comma-dangle, no-shadow, no-param-reassign, brace-style, vars-on-top, quotes, no-lonely-if, no-else-return, semi, dot-notation, no-empty, no-return-assign, camelcase, prefer-spread, padded-blocks */ /* eslint-disable no-useless-return, func-names, space-before-function-paren, wrap-iife, no-var, no-underscore-dangle, prefer-arrow-callback, max-len, one-var, no-unused-vars, one-var-declaration-per-line, prefer-template, no-new, consistent-return, object-shorthand, comma-dangle, no-shadow, no-param-reassign, brace-style, vars-on-top, quotes, no-lonely-if, no-else-return, dot-notation, no-empty, no-return-assign, camelcase, prefer-spread */
/* global Issuable */ /* global Issuable */
/* global ListLabel */ /* global ListLabel */
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) { if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) {
$dropdown.parent() $dropdown.parent()
.find('.dropdown-clear-active') .find('.dropdown-clear-active')
.removeClass('is-active') .removeClass('is-active');
} }
if ($dropdown.hasClass('js-filter-bulk-update') || $dropdown.hasClass('js-issuable-form-dropdown')) { if ($dropdown.hasClass('js-filter-bulk-update') || $dropdown.hasClass('js-issuable-form-dropdown')) {
...@@ -484,5 +484,4 @@ ...@@ -484,5 +484,4 @@
return LabelsSelect; return LabelsSelect;
})(); })();
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, no-unused-vars, one-var, one-var-declaration-per-line, indent, vars-on-top, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, no-unused-vars, one-var, one-var-declaration-per-line, vars-on-top, max-len */
(function() { (function() {
var hideEndFade; var hideEndFade;
...@@ -27,10 +28,10 @@ ...@@ -27,10 +28,10 @@
}); });
$scrollingTabs.each(function () { $scrollingTabs.each(function () {
var $this = $(this), var $this = $(this);
scrollingTabWidth = $this.width(), var scrollingTabWidth = $this.width();
$active = $this.find('.active'), var $active = $this.find('.active');
activeWidth = $active.width(); var activeWidth = $active.width();
if ($active.length) { if ($active.length) {
var offset = $active.offset().left + activeWidth; var offset = $active.offset().left + activeWidth;
...@@ -43,5 +44,4 @@ ...@@ -43,5 +44,4 @@
} }
}); });
}); });
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-param-reassign, no-void, prefer-template, no-var, new-cap, prefer-arrow-callback, consistent-return, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-param-reassign, no-void, prefer-template, no-var, new-cap, prefer-arrow-callback, consistent-return, max-len */
(function() { (function() {
(function(w) { (function(w) {
if (w.gl == null) { if (w.gl == null) {
...@@ -46,5 +46,4 @@ ...@@ -46,5 +46,4 @@
return dfd.promise(); return dfd.promise();
}; };
})(window); })(window);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-unused-expressions, no-param-reassign, no-else-return, quotes, object-shorthand, comma-dangle, camelcase, one-var, vars-on-top, one-var-declaration-per-line, no-return-assign, consistent-return, padded-blocks, max-len, prefer-template */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-unused-expressions, no-param-reassign, no-else-return, quotes, object-shorthand, comma-dangle, camelcase, one-var, vars-on-top, one-var-declaration-per-line, no-return-assign, consistent-return, max-len, prefer-template */
(function() { (function() {
(function(w) { (function(w) {
var base; var base;
...@@ -216,5 +216,4 @@ ...@@ -216,5 +216,4 @@
return Array.prototype.indexOf.call(matchingNodes, node) !== -1; return Array.prototype.indexOf.call(matchingNodes, node) !== -1;
}; };
})(window); })(window);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, comma-dangle, no-unused-expressions, prefer-template, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, comma-dangle, no-unused-expressions, prefer-template, max-len */
/* global timeago */ /* global timeago */
/* global dateFormat */ /* global dateFormat */
...@@ -97,7 +97,5 @@ ...@@ -97,7 +97,5 @@
return Math.floor((date2 - date1) / millisecondsPerDay); return Math.floor((date2 - date1) / millisecondsPerDay);
}; };
})(window); })(window);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, consistent-return, prefer-arrow-callback, no-return-assign, object-shorthand, comma-dangle, no-param-reassign, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, consistent-return, prefer-arrow-callback, no-return-assign, object-shorthand, comma-dangle, no-param-reassign, max-len */
(function() { (function() {
(function(w) { (function(w) {
...@@ -44,5 +44,4 @@ ...@@ -44,5 +44,4 @@
w.notify = notifyMe; w.notify = notifyMe;
return w.notifyPermissions = notifyPermissions; return w.notifyPermissions = notifyPermissions;
})(window); })(window);
}).call(this); }).call(this);
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
* stringifyTime condensed or non-condensed, abbreviateTimelengths) * stringifyTime condensed or non-condensed, abbreviateTimelengths)
* */ * */
class PrettyTime { const utils = window.gl.utils = gl.utils || {};
const prettyTime = utils.prettyTime = {
/* /*
* Accepts seconds and returns a timeObject { weeks: #, days: #, hours: #, minutes: # } * Accepts seconds and returns a timeObject { weeks: #, days: #, hours: #, minutes: # }
* Seconds can be negative or positive, zero or non-zero. * Seconds can be negative or positive, zero or non-zero.
*/ */
static parseSeconds(seconds) { parseSeconds(seconds) {
const DAYS_PER_WEEK = 5; const DAYS_PER_WEEK = 5;
const HOURS_PER_DAY = 8; const HOURS_PER_DAY = 8;
const MINUTES_PER_HOUR = 60; const MINUTES_PER_HOUR = 60;
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
minutes: 1, minutes: 1,
}; };
let unorderedMinutes = PrettyTime.secondsToMinutes(seconds); let unorderedMinutes = prettyTime.secondsToMinutes(seconds);
return _.mapObject(timePeriodConstraints, (minutesPerPeriod) => { return _.mapObject(timePeriodConstraints, (minutesPerPeriod) => {
const periodCount = Math.floor(unorderedMinutes / minutesPerPeriod); const periodCount = Math.floor(unorderedMinutes / minutesPerPeriod);
...@@ -33,35 +33,33 @@ ...@@ -33,35 +33,33 @@
return periodCount; return periodCount;
}); });
} },
/* /*
* Accepts a timeObject and returns a condensed string representation of it * Accepts a timeObject and returns a condensed string representation of it
* (e.g. '1w 2d 3h 1m' or '1h 30m'). Zero value units are not included. * (e.g. '1w 2d 3h 1m' or '1h 30m'). Zero value units are not included.
*/ */
static stringifyTime(timeObject) { stringifyTime(timeObject) {
const reducedTime = _.reduce(timeObject, (memo, unitValue, unitName) => { const reducedTime = _.reduce(timeObject, (memo, unitValue, unitName) => {
const isNonZero = !!unitValue; const isNonZero = !!unitValue;
return isNonZero ? `${memo} ${unitValue}${unitName.charAt(0)}` : memo; return isNonZero ? `${memo} ${unitValue}${unitName.charAt(0)}` : memo;
}, '').trim(); }, '').trim();
return reducedTime.length ? reducedTime : '0m'; return reducedTime.length ? reducedTime : '0m';
} },
/* /*
* Accepts a time string of any size (e.g. '1w 2d 3h 5m' or '1w 2d') and returns * Accepts a time string of any size (e.g. '1w 2d 3h 5m' or '1w 2d') and returns
* the first non-zero unit/value pair. * the first non-zero unit/value pair.
*/ */
static abbreviateTime(timeStr) { abbreviateTime(timeStr) {
return timeStr.split(' ') return timeStr.split(' ')
.filter(unitStr => unitStr.charAt(0) !== '0')[0]; .filter(unitStr => unitStr.charAt(0) !== '0')[0];
} },
static secondsToMinutes(seconds) { secondsToMinutes(seconds) {
return Math.abs(seconds / 60); return Math.abs(seconds / 60);
} },
} };
gl.PrettyTime = PrettyTime;
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, semi, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, max-len */
(function() { (function() {
(function(w) { (function(w) {
var base; var base;
...@@ -10,7 +11,7 @@ ...@@ -10,7 +11,7 @@
} }
gl.text.addDelimiter = function(text) { gl.text.addDelimiter = function(text) {
return text ? text.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : text; return text ? text.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : text;
} };
gl.text.randomString = function() { gl.text.randomString = function() {
return Math.random().toString(36).substring(7); return Math.random().toString(36).substring(7);
}; };
...@@ -159,10 +160,9 @@ ...@@ -159,10 +160,9 @@
}; };
gl.text.humanize = function(string) { gl.text.humanize = function(string) {
return string.charAt(0).toUpperCase() + string.replace(/_/g, ' ').slice(1); return string.charAt(0).toUpperCase() + string.replace(/_/g, ' ').slice(1);
} };
return gl.text.truncate = function(string, maxLength) { return gl.text.truncate = function(string, maxLength) {
return string.substr(0, (maxLength - 3)) + '...'; return string.substr(0, (maxLength - 3)) + '...';
}; };
})(window); })(window);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, no-return-assign, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, no-return-assign, max-len */
(function() { (function() {
(function(w) { (function(w) {
var base; var base;
...@@ -12,5 +12,4 @@ ...@@ -12,5 +12,4 @@
return (obj != null) && (obj.constructor === Object); return (obj != null) && (obj.constructor === Object);
}; };
})(window); })(window);
}).call(this); }).call(this);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, one-var, one-var-declaration-per-line, no-void, no-plusplus, guard-for-in, no-restricted-syntax, prefer-template, quotes, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, one-var, one-var-declaration-per-line, no-void, guard-for-in, no-restricted-syntax, prefer-template, quotes, max-len */
(function() { (function() {
(function(w) { (function(w) {
var base; var base;
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
if (sParameterName[0] === sParam) { if (sParameterName[0] === sParam) {
values.push(sParameterName[1].replace(/\+/g, ' ')); values.push(sParameterName[1].replace(/\+/g, ' '));
} }
i++; i += 1;
} }
return values; return values;
}; };
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
return ((function() { return ((function() {
var j, len, results; var j, len, results;
results = []; results = [];
for (j = 0, len = urlVariables.length; j < len; j++) { for (j = 0, len = urlVariables.length; j < len; j += 1) {
variables = urlVariables[j]; variables = urlVariables[j];
if (variables.indexOf(param) === -1) { if (variables.indexOf(param) === -1) {
results.push(variables); results.push(variables);
...@@ -77,5 +77,4 @@ ...@@ -77,5 +77,4 @@
return hashIndex === -1 ? null : url.substring(hashIndex + 1); return hashIndex === -1 ? null : url.substring(hashIndex + 1);
}; };
})(window); })(window);
}).call(this); }).call(this);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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