Skip to content
Snippets Groups Projects
Commit fe27de8b authored by Phil Hughes's avatar Phil Hughes
Browse files

moved some code into new files

fixed duplication of code
parent 205090fc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -30,7 +30,6 @@
/* global IssuableContext */
/* global IssueStatusSelect */
/* global SubscriptionSelect */
/* global Notes */
 
import Issue from './issue';
import BindInOut from './behaviors/bind_in_out';
Loading
Loading
@@ -66,6 +65,9 @@ import initSettingsPanels from './settings_panels';
import initExperimentalFlags from './experimental_flags';
import OAuthRememberMe from './oauth_remember_me';
import PerformanceBar from './performance_bar';
import initNotes from './init_notes';
import initLegacyFilters from './init_legacy_filters';
import initIssuableSidebar from './init_issuable_sidebar';
 
(function() {
var Dispatcher;
Loading
Loading
@@ -130,42 +132,6 @@ import PerformanceBar from './performance_bar';
.init();
}
 
function initIssuableSidebar() {
new MilestoneSelect({
full_path: gl.sidebarOptions.fullPath,
});
new LabelsSelect();
new IssuableContext(gl.sidebarOptions.currentUser);
gl.Subscription.bindAll('.subscription');
new gl.DueDateSelectors();
window.sidebar = new Sidebar();
}
function initLegacyFilters() {
new UsersSelect();
new LabelsSelect();
new MilestoneSelect();
new IssueStatusSelect();
new SubscriptionSelect();
$('form.filter-form').on('submit', function (event) {
event.preventDefault();
gl.utils.visitUrl(`${this.action}&${$(this).serialize()}`);
});
}
function initNotes() {
const dataEl = document.querySelector('.js-notes-data');
const {
notesUrl,
notesIds,
now,
diffView,
autocomplete,
} = JSON.parse(dataEl.innerHTML);
window.notes = new Notes(notesUrl, notesIds, now, diffView, autocomplete);
}
switch (page) {
case 'profiles:preferences:show':
initExperimentalFlags();
Loading
Loading
/* eslint-disable no-new */
/* global MilestoneSelect */
/* global LabelsSelect */
/* global IssuableContext */
/* global Sidebar */
export default () => {
new MilestoneSelect({
full_path: gl.sidebarOptions.fullPath,
});
new LabelsSelect();
new IssuableContext(gl.sidebarOptions.currentUser);
gl.Subscription.bindAll('.subscription');
new gl.DueDateSelectors();
window.sidebar = new Sidebar();
};
/* eslint-disable no-new */
/* global UsersSelect */
/* global LabelsSelect */
/* global MilestoneSelect */
/* global IssueStatusSelect */
/* global SubscriptionSelect */
export default () => {
new UsersSelect();
new LabelsSelect();
new MilestoneSelect();
new IssueStatusSelect();
new SubscriptionSelect();
};
/* global Notes */
export default () => {
const dataEl = document.querySelector('.js-notes-data');
const {
notesUrl,
notesIds,
now,
diffView,
autocomplete,
} = JSON.parse(dataEl.innerHTML);
window.notes = new Notes(notesUrl, notesIds, now, diffView, autocomplete);
};
Loading
Loading
@@ -346,4 +346,9 @@ $(function () {
gl.utils.renderTimeago();
 
$(document).trigger('init.scrolling-tabs');
$('form.filter-form').on('submit', function (event) {
event.preventDefault();
gl.utils.visitUrl(`${this.action}&${$(this).serialize()}`);
});
});
Loading
Loading
@@ -37,10 +37,6 @@ export default class Todos {
this.initFilterDropdown($('.js-type-search'), 'type');
this.initFilterDropdown($('.js-action-search'), 'action_id');
 
$('form.filter-form').on('submit', function applyFilters(event) {
event.preventDefault();
gl.utils.visitUrl(`${this.action}&${$(this).serialize()}`);
});
return new UsersSelect();
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment