Commit 030de8b3 authored by Filipa Lacerda's avatar Filipa Lacerda

Export code as ES6 modules

parent 2b594daf
/* 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 NewCommitForm */
import NewCommitForm from '../new_commit_form';
import EditBlob from './edit_blob';
import BlobFileDropzone from '../blob/blob_file_dropzone';
......
......@@ -2,11 +2,11 @@
import { s__ } from './locale';
import projectSelect from './project_select';
import IssuableIndex from './issuable_index';
/* global Milestone */
import Milestone from './milestone';
import IssuableForm from './issuable_form';
import LabelsSelect from './labels_select';
/* global MilestoneSelect */
/* global NewBranchForm */
import NewBranchForm from './new_branch_form';
/* global NotificationsForm */
/* global NotificationsDropdown */
import groupAvatar from './group_avatar';
......@@ -18,8 +18,7 @@ import groupsSelect from './groups_select';
/* global Search */
/* global Admin */
import NamespaceSelect from './namespace_select';
/* global NewCommitForm */
/* global NewBranchForm */
import NewCommitForm from './new_commit_form';
import Project from './project';
import projectAvatar from './project_avatar';
/* global MergeRequest */
......
/* eslint-disable no-new */
import LabelsSelect from './labels_select';
/* global MilestoneSelect */
/* global SubscriptionSelect */
import subscriptionSelect from './subscription_select';
import UsersSelect from './users_select';
import issueStatusSelect from './issue_status_select';
......@@ -11,5 +10,5 @@ export default () => {
new LabelsSelect();
new MilestoneSelect();
issueStatusSelect();
new SubscriptionSelect();
subscriptionSelect();
};
/* eslint-disable class-methods-use-this, no-new */
/* global MilestoneSelect */
/* global SubscriptionSelect */
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
import './milestone_select';
import issueStatusSelect from './issue_status_select';
import './subscription_select';
import subscriptionSelect from './subscription_select';
import LabelsSelect from './labels_select';
const HIDDEN_CLASS = 'hidden';
......@@ -48,7 +47,7 @@ export default class IssuableBulkUpdateSidebar {
new LabelsSelect();
new MilestoneSelect();
issueStatusSelect();
new SubscriptionSelect();
subscriptionSelect();
}
setupBulkUpdateActions() {
......
......@@ -58,11 +58,7 @@ import './line_highlighter';
import initLogoAnimation from './logo';
import './merge_request';
import './merge_request_tabs';
import './milestone';
import './milestone_select';
import './namespace_select';
import './new_branch_form';
import './new_commit_form';
import './notes';
import './notifications_dropdown';
import './notifications_form';
......@@ -78,8 +74,6 @@ import './render_gfm';
import './right_sidebar';
import './search';
import './search_autocomplete';
import './smart_interval';
import './subscription_select';
import initBreadcrumbs from './breadcrumb';
import './dispatcher';
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-use-before-define, camelcase, quotes, object-shorthand, no-shadow, no-unused-vars, comma-dangle, no-var, prefer-template, no-underscore-dangle, consistent-return, one-var, one-var-declaration-per-line, default-case, prefer-arrow-callback, max-len */
/* global Sortable */
import Flash from './flash';
(function() {
this.Milestone = (function() {
function Milestone() {
export default class Milestone {
constructor() {
this.bindTabsSwitching();
// Load merge request tab if it is active
......@@ -15,24 +13,24 @@ import Flash from './flash';
this.loadInitialTab();
}
Milestone.prototype.bindTabsSwitching = function() {
bindTabsSwitching() {
return $('a[data-toggle="tab"]').on('show.bs.tab', (e) => {
const $target = $(e.target);
location.hash = $target.attr('href');
this.loadTab($target);
});
};
Milestone.prototype.loadInitialTab = function() {
}
// eslint-disable-next-line class-methods-use-this
loadInitialTab() {
const $target = $(`.js-milestone-tabs a[href="${location.hash}"]`);
if ($target.length) {
$target.tab('show');
}
};
Milestone.prototype.loadTab = function($target) {
}
// eslint-disable-next-line class-methods-use-this
loadTab($target) {
const endpoint = $target.data('endpoint');
const tabElId = $target.attr('href');
......@@ -47,8 +45,5 @@ import Flash from './flash';
$target.addClass('is-loaded');
});
}
};
return Milestone;
})();
}).call(window);
}
}
/* eslint-disable func-names, space-before-function-paren, no-var, one-var, prefer-rest-params, max-len, vars-on-top, wrap-iife, consistent-return, comma-dangle, one-var-declaration-per-line, quotes, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, max-len, object-shorthand */
import RefSelectDropdown from '~/ref_select_dropdown';
import RefSelectDropdown from './ref_select_dropdown';
(function() {
this.NewBranchForm = (function() {
function NewBranchForm(form, availableRefs) {
export default class NewBranchForm {
constructor(form, availableRefs) {
this.validate = this.validate.bind(this);
this.branchNameError = form.find('.js-branch-name-error');
this.name = form.find('.js-branch-name');
......@@ -14,17 +13,17 @@ import RefSelectDropdown from '~/ref_select_dropdown';
this.init();
}
NewBranchForm.prototype.addBinding = function() {
addBinding() {
return this.name.on('blur', this.validate);
};
}
NewBranchForm.prototype.init = function() {
init() {
if (this.name.length && this.name.val().length > 0) {
return this.name.trigger('blur');
}
};
}
NewBranchForm.prototype.setupRestrictions = function() {
setupRestrictions() {
var endsWith, invalid, single, startsWith;
startsWith = {
pattern: /^(\/|\.)/g,
......@@ -47,9 +46,9 @@ import RefSelectDropdown from '~/ref_select_dropdown';
conjunction: "or"
};
return this.restrictions = [startsWith, invalid, endsWith, single];
};
}
NewBranchForm.prototype.validate = function() {
validate() {
var errorMessage, errors, formatter, unique, validator;
const indexOf = [].indexOf;
......@@ -90,8 +89,5 @@ import RefSelectDropdown from '~/ref_select_dropdown';
errorMessage = $("<span/>").text(errors.join(', '));
return this.branchNameError.append(errorMessage);
}
};
return NewBranchForm;
})();
}).call(window);
}
}
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-return-assign, max-len */
(function() {
this.NewCommitForm = (function() {
function NewCommitForm(form) {
export default class NewCommitForm {
constructor(form) {
this.form = form;
this.renderDestination = this.renderDestination.bind(this);
this.branchName = form.find('.js-branch-name');
......@@ -12,7 +11,7 @@
this.renderDestination();
}
NewCommitForm.prototype.renderDestination = function() {
renderDestination() {
var different;
different = this.branchName.val() !== this.originalBranch.val();
if (different) {
......@@ -25,8 +24,5 @@
this.createMergeRequest.prop('checked', false);
}
return this.wasDifferent = different;
};
return NewCommitForm;
})();
}).call(window);
}
}
/* 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 */
export default function subscriptionSelect() {
$('.js-subscription-event').each((i, element) => {
const fieldName = $(element).data('field-name');
class SubscriptionSelect {
constructor() {
$('.js-subscription-event').each(function(i, el) {
var fieldName;
fieldName = $(el).data("field-name");
return $(el).glDropdown({
return $(element).glDropdown({
selectable: true,
fieldName: fieldName,
toggleLabel: (function(_this) {
return function(selected, el, instance) {
var $item, label;
label = 'Subscription';
$item = instance.dropdown.find('.is-active');
fieldName,
toggleLabel(selected, el, instance) {
let label = 'Subscription';
const $item = instance.dropdown.find('.is-active');
if ($item.length) {
label = $item.text();
}
return label;
};
})(this),
clicked: function(options) {
},
clicked(options) {
return options.e.preventDefault();
},
id: function(obj, el) {
return $(el).data("id");
}
id(obj, el) {
return $(el).data('id');
},
});
});
}
}
window.SubscriptionSelect = SubscriptionSelect;
/* eslint-disable space-before-function-paren, one-var, no-var, one-var-declaration-per-line, no-return-assign, quotes, max-len */
/* global NewBranchForm */
import '~/new_branch_form';
import NewBranchForm from '~/new_branch_form';
(function() {
describe('Branch', function() {
......
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