Set defaults in constructor, in case opts are undefined.
This commit is contained in:
parent
7beb9f3483
commit
b3917d4868
6 changed files with 15 additions and 22 deletions
|
@ -14,9 +14,9 @@
|
|||
global.BlobCiYamlSelector = BlobCiYamlSelector;
|
||||
|
||||
class BlobCiYamlSelectors {
|
||||
constructor({ editor, $dropdowns = $('.js-gitlab-ci-yml-selector') }) {
|
||||
constructor({ editor, $dropdowns }) {
|
||||
this.editor = editor;
|
||||
this.$dropdowns = $dropdowns;
|
||||
this.$dropdowns = $dropdowns || $('.js-gitlab-ci-yml-selector');
|
||||
this.initSelectors();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
((global) => {
|
||||
|
||||
class Profile {
|
||||
constructor({ form = $('.edit-user') } = {}) {
|
||||
constructor({ form }) {
|
||||
this.onSubmitForm = this.onSubmitForm.bind(this);
|
||||
this.form = form;
|
||||
this.form = form || $('.edit-user');
|
||||
this.bindEvents();
|
||||
this.initAvatarGlCrop();
|
||||
}
|
||||
|
|
|
@ -9,20 +9,13 @@
|
|||
};
|
||||
|
||||
class SearchAutocomplete {
|
||||
constructor({
|
||||
wrap = $('.search'),
|
||||
optsEl = wrap.find('.search-autocomplete-opts'),
|
||||
autocompletePath = optsEl.data('autocomplete-path'),
|
||||
projectId = (optsEl.data('autocomplete-project-id') || ''),
|
||||
projectRef = (optsEl.data('autocomplete-project-ref') || '')
|
||||
} = {}) {
|
||||
|
||||
constructor({ wrap, optsEl, autocompletePath, projectId, projectRef }) {
|
||||
this.bindEventContext();
|
||||
this.wrap = wrap;
|
||||
this.optsEl = optsEl;
|
||||
this.autocompletePath = autocompletePath;
|
||||
this.projectId = projectId;
|
||||
this.projectRef = projectRef;
|
||||
this.wrap = wrap || $('.search');
|
||||
this.optsEl = optsEl || wrap.find('.search-autocomplete-opts');
|
||||
this.autocompletePath = autocompletePath || optsEl.data('autocomplete-path');
|
||||
this.projectId = projectId || (optsEl.data('autocomplete-project-id') || '');
|
||||
this.projectRef = projectRef || (optsEl.data('autocomplete-project-ref') || '');
|
||||
this.dropdown = wrap.find('.dropdown');
|
||||
this.dropdownContent = this.dropdown.find('.dropdown-content');
|
||||
this.locationBadgeEl = this.getElement('.location-badge');
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
((global) => {
|
||||
|
||||
class Todos {
|
||||
constructor({ el = $('.js-todos-options') }) {
|
||||
constructor({ el }) {
|
||||
this.allDoneClicked = this.allDoneClicked.bind(this);
|
||||
this.doneClicked = this.doneClicked.bind(this);
|
||||
this.el = el;
|
||||
this.el = el || $('.js-todos-options');
|
||||
this.perPage = el.data('perPage');
|
||||
this.clearListeners();
|
||||
this.initBtnListeners();
|
||||
|
|
|
@ -59,10 +59,10 @@ content on the Users#show page.
|
|||
*/
|
||||
((global) => {
|
||||
class UserTabs {
|
||||
constructor ({ defaultAction = 'activity', action = defaultAction, parentEl }) {
|
||||
constructor ({ defaultAction, action, parentEl }) {
|
||||
this.loaded = {};
|
||||
this.defaultAction = defaultAction;
|
||||
this.action = action;
|
||||
this.defaultAction = defaultAction || 'activity';
|
||||
this.action = action || this.defaultAction;
|
||||
this.$parentEl = $(parentEl) || $(document);
|
||||
this._location = window.location;
|
||||
this.$parentEl.find('.nav-links a')
|
||||
|
|
Loading…
Reference in a new issue