Commit 1f7631e3 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'remove-iife-boards-bundle' into 'master'

Remove IIFEs in boards_bundle.js

See merge request !10612
parents 9daf4f64 6c4d6117
...@@ -7,13 +7,12 @@ import boardBlankState from './board_blank_state'; ...@@ -7,13 +7,12 @@ import boardBlankState from './board_blank_state';
require('./board_delete'); require('./board_delete');
require('./board_list'); require('./board_list');
(() => { const Store = gl.issueBoards.BoardsStore;
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.Board = Vue.extend({ gl.issueBoards.Board = Vue.extend({
template: '#js-board-template', template: '#js-board-template',
components: { components: {
boardList, boardList,
...@@ -102,5 +101,4 @@ require('./board_list'); ...@@ -102,5 +101,4 @@ require('./board_list');
this.sortable = Sortable.create(this.$el.parentNode, this.sortableOptions); this.sortable = Sortable.create(this.$el.parentNode, this.sortableOptions);
}, },
}); });
})();
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
import Vue from 'vue'; import Vue from 'vue';
(() => { window.gl = window.gl || {};
window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardDelete = Vue.extend({ gl.issueBoards.BoardDelete = Vue.extend({
props: { props: {
list: Object list: Object
}, },
...@@ -19,5 +18,4 @@ import Vue from 'vue'; ...@@ -19,5 +18,4 @@ import Vue from 'vue';
} }
} }
} }
}); });
})();
...@@ -8,13 +8,12 @@ import Vue from 'vue'; ...@@ -8,13 +8,12 @@ import Vue from 'vue';
require('./sidebar/remove_issue'); require('./sidebar/remove_issue');
(() => { const Store = gl.issueBoards.BoardsStore;
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardSidebar = Vue.extend({ gl.issueBoards.BoardSidebar = Vue.extend({
props: { props: {
currentUser: Object currentUser: Object
}, },
...@@ -69,5 +68,4 @@ require('./sidebar/remove_issue'); ...@@ -69,5 +68,4 @@ require('./sidebar/remove_issue');
components: { components: {
removeBtn: gl.issueBoards.RemoveIssueBtn, removeBtn: gl.issueBoards.RemoveIssueBtn,
}, },
}); });
})();
import Vue from 'vue'; import Vue from 'vue';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
(() => { const Store = gl.issueBoards.BoardsStore;
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.IssueCardInner = Vue.extend({ gl.issueBoards.IssueCardInner = Vue.extend({
props: { props: {
issue: { issue: {
type: Object, type: Object,
...@@ -137,5 +136,4 @@ import eventHub from '../eventhub'; ...@@ -137,5 +136,4 @@ import eventHub from '../eventhub';
</div> </div>
</div> </div>
`, `,
}); });
})();
import Vue from 'vue'; import Vue from 'vue';
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalEmptyState = Vue.extend({ gl.issueBoards.ModalEmptyState = Vue.extend({
mixins: [gl.issueBoards.ModalMixins], mixins: [gl.issueBoards.ModalMixins],
data() { data() {
return ModalStore.store; return ModalStore.store;
...@@ -67,5 +66,4 @@ import Vue from 'vue'; ...@@ -67,5 +66,4 @@ import Vue from 'vue';
</div> </div>
</section> </section>
`, `,
}); });
})();
...@@ -5,10 +5,9 @@ import Vue from 'vue'; ...@@ -5,10 +5,9 @@ import Vue from 'vue';
require('./lists_dropdown'); require('./lists_dropdown');
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalFooter = Vue.extend({ gl.issueBoards.ModalFooter = Vue.extend({
mixins: [gl.issueBoards.ModalMixins], mixins: [gl.issueBoards.ModalMixins],
data() { data() {
return { return {
...@@ -80,5 +79,4 @@ require('./lists_dropdown'); ...@@ -80,5 +79,4 @@ require('./lists_dropdown');
</button> </button>
</footer> </footer>
`, `,
}); });
})();
...@@ -3,10 +3,9 @@ import modalFilters from './filters'; ...@@ -3,10 +3,9 @@ import modalFilters from './filters';
require('./tabs'); require('./tabs');
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalHeader = Vue.extend({ gl.issueBoards.ModalHeader = Vue.extend({
mixins: [gl.issueBoards.ModalMixins], mixins: [gl.issueBoards.ModalMixins],
props: { props: {
projectId: { projectId: {
...@@ -78,5 +77,4 @@ require('./tabs'); ...@@ -78,5 +77,4 @@ require('./tabs');
</div> </div>
</div> </div>
`, `,
}); });
})();
...@@ -8,10 +8,9 @@ require('./list'); ...@@ -8,10 +8,9 @@ require('./list');
require('./footer'); require('./footer');
require('./empty_state'); require('./empty_state');
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.IssuesModal = Vue.extend({ gl.issueBoards.IssuesModal = Vue.extend({
props: { props: {
blankStateImage: { blankStateImage: {
type: String, type: String,
...@@ -163,5 +162,4 @@ require('./empty_state'); ...@@ -163,5 +162,4 @@ require('./empty_state');
</div> </div>
</div> </div>
`, `,
}); });
})();
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
import Vue from 'vue'; import Vue from 'vue';
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalList = Vue.extend({ gl.issueBoards.ModalList = Vue.extend({
props: { props: {
issueLinkBase: { issueLinkBase: {
type: String, type: String,
...@@ -157,5 +156,4 @@ import Vue from 'vue'; ...@@ -157,5 +156,4 @@ import Vue from 'vue';
</div> </div>
</section> </section>
`, `,
}); });
})();
import Vue from 'vue'; import Vue from 'vue';
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalFooterListsDropdown = Vue.extend({ gl.issueBoards.ModalFooterListsDropdown = Vue.extend({
data() { data() {
return { return {
modal: ModalStore.store, modal: ModalStore.store,
...@@ -53,5 +52,4 @@ import Vue from 'vue'; ...@@ -53,5 +52,4 @@ import Vue from 'vue';
</div> </div>
</div> </div>
`, `,
}); });
})();
import Vue from 'vue'; import Vue from 'vue';
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalTabs = Vue.extend({ gl.issueBoards.ModalTabs = Vue.extend({
mixins: [gl.issueBoards.ModalMixins], mixins: [gl.issueBoards.ModalMixins],
data() { data() {
return ModalStore.store; return ModalStore.store;
...@@ -44,5 +43,4 @@ import Vue from 'vue'; ...@@ -44,5 +43,4 @@ import Vue from 'vue';
</ul> </ul>
</div> </div>
`, `,
}); });
})();
/* eslint-disable comma-dangle, func-names, no-new, space-before-function-paren, one-var */ /* eslint-disable comma-dangle, func-names, no-new, space-before-function-paren, one-var */
(() => { window.gl = window.gl || {};
window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
$(document).off('created.label').on('created.label', (e, label) => { $(document).off('created.label').on('created.label', (e, label) => {
Store.new({ Store.new({
title: label.title, title: label.title,
position: Store.state.lists.length - 2, position: Store.state.lists.length - 2,
...@@ -17,9 +16,9 @@ ...@@ -17,9 +16,9 @@
color: label.color color: label.color
} }
}); });
}); });
gl.issueBoards.newListDropdownInit = () => { gl.issueBoards.newListDropdownInit = () => {
$('.js-new-board-list').each(function () { $('.js-new-board-list').each(function () {
const $this = $(this); const $this = $(this);
new gl.CreateLabelDropdown($this.closest('.dropdown').find('.dropdown-new-label'), $this.data('namespace-path'), $this.data('project-path')); new gl.CreateLabelDropdown($this.closest('.dropdown').find('.dropdown-new-label'), $this.data('namespace-path'), $this.data('project-path'));
...@@ -72,5 +71,4 @@ ...@@ -72,5 +71,4 @@
} }
}); });
}); });
}; };
})();
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
import Vue from 'vue'; import Vue from 'vue';
(() => { const Store = gl.issueBoards.BoardsStore;
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.RemoveIssueBtn = Vue.extend({ gl.issueBoards.RemoveIssueBtn = Vue.extend({
props: { props: {
issue: { issue: {
type: Object, type: Object,
...@@ -57,5 +56,4 @@ import Vue from 'vue'; ...@@ -57,5 +56,4 @@ import Vue from 'vue';
</button> </button>
</div> </div>
`, `,
}); });
})();
(() => { const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalMixins = { gl.issueBoards.ModalMixins = {
methods: { methods: {
toggleModal(toggle) { toggleModal(toggle) {
ModalStore.store.showAddIssuesModal = toggle; ModalStore.store.showAddIssuesModal = toggle;
...@@ -10,5 +9,4 @@ ...@@ -10,5 +9,4 @@
ModalStore.store.activeTab = tab; ModalStore.store.activeTab = tab;
}, },
}, },
}; };
})();
/* eslint-disable no-unused-vars, no-mixed-operators, comma-dangle */ /* eslint-disable no-unused-vars, no-mixed-operators, comma-dangle */
/* global DocumentTouch */ /* global DocumentTouch */
((w) => { window.gl = window.gl || {};
window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.onStart = () => { gl.issueBoards.onStart = () => {
$('.has-tooltip').tooltip('hide') $('.has-tooltip').tooltip('hide')
.tooltip('disable'); .tooltip('disable');
document.body.classList.add('is-dragging'); document.body.classList.add('is-dragging');
}; };
gl.issueBoards.onEnd = () => { gl.issueBoards.onEnd = () => {
$('.has-tooltip').tooltip('enable'); $('.has-tooltip').tooltip('enable');
document.body.classList.remove('is-dragging'); document.body.classList.remove('is-dragging');
}; };
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) => {
const defaultSortOptions = { const defaultSortOptions = {
animation: 200, animation: 200,
forceFallback: true, forceFallback: true,
...@@ -35,5 +34,4 @@ ...@@ -35,5 +34,4 @@
Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; }); Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; });
return defaultSortOptions; return defaultSortOptions;
}; };
})(window);
...@@ -3,11 +3,10 @@ ...@@ -3,11 +3,10 @@
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
(() => { window.gl = window.gl || {};
window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardsStore = { gl.issueBoards.BoardsStore = {
disabled: false, disabled: false,
filter: { filter: {
path: '', path: '',
...@@ -123,5 +122,4 @@ import Cookies from 'js-cookie'; ...@@ -123,5 +122,4 @@ import Cookies from 'js-cookie';
updateFiltersUrl () { updateFiltersUrl () {
history.pushState(null, null, `?${this.filter.path}`); history.pushState(null, null, `?${this.filter.path}`);
} }
}; };
})();
(() => { window.gl = window.gl || {};
window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
class ModalStore { class ModalStore {
constructor() { constructor() {
this.store = { this.store = {
columns: 3, columns: 3,
...@@ -94,7 +93,6 @@ ...@@ -94,7 +93,6 @@
return this.store.selectedIssues return this.store.selectedIssues
.filter(filteredIssue => filteredIssue.id === issue.id)[0]; .filter(filteredIssue => filteredIssue.id === issue.id)[0];
} }
} }
gl.issueBoards.ModalStore = new ModalStore(); gl.issueBoards.ModalStore = new ModalStore();
})();
/* 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 */ /* 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() { var base;
(function(w) { var w = window;
var base; if (w.gl == null) {
if (w.gl == null) {
w.gl = {}; w.gl = {};
} }
if ((base = w.gl).utils == null) { if ((base = w.gl).utils == null) {
base.utils = {}; base.utils = {};
} }
// Returns an array containing the value(s) of the // Returns an array containing the value(s) of the
// of the key passed as an argument // of the key passed as an argument
w.gl.utils.getParameterValues = function(sParam) { w.gl.utils.getParameterValues = function(sParam) {
var i, sPageURL, sParameterName, sURLVariables, values; var i, sPageURL, sParameterName, sURLVariables, values;
sPageURL = decodeURIComponent(window.location.search.substring(1)); sPageURL = decodeURIComponent(window.location.search.substring(1));
sURLVariables = sPageURL.split('&'); sURLVariables = sPageURL.split('&');
...@@ -25,10 +24,10 @@ ...@@ -25,10 +24,10 @@
i += 1; i += 1;
} }
return values; return values;
}; };
// @param {Object} params - url keys and value to merge // @param {Object} params - url keys and value to merge
// @param {String} url // @param {String} url
w.gl.utils.mergeUrlParams = function(params, url) { w.gl.utils.mergeUrlParams = function(params, url) {
var lastChar, newUrl, paramName, paramValue, pattern; var lastChar, newUrl, paramName, paramValue, pattern;
newUrl = decodeURIComponent(url); newUrl = decodeURIComponent(url);
for (paramName in params) { for (paramName in params) {
...@@ -48,9 +47,9 @@ ...@@ -48,9 +47,9 @@
newUrl = newUrl.slice(0, -1); newUrl = newUrl.slice(0, -1);
} }
return newUrl; return newUrl;
}; };
// removes parameter query string from url. returns the modified url // removes parameter query string from url. returns the modified url
w.gl.utils.removeParamQueryString = function(url, param) { w.gl.utils.removeParamQueryString = function(url, param) {
var urlVariables, variables; var urlVariables, variables;
url = decodeURIComponent(url); url = decodeURIComponent(url);
urlVariables = url.split('&'); urlVariables = url.split('&');
...@@ -65,15 +64,15 @@ ...@@ -65,15 +64,15 @@
} }
return results; return results;
})()).join('&'); })()).join('&');
}; };
w.gl.utils.removeParams = (params) => { w.gl.utils.removeParams = (params) => {
const url = new URL(window.location.href); const url = new URL(window.location.href);
params.forEach((param) => { params.forEach((param) => {
url.search = w.gl.utils.removeParamQueryString(url.search, param); url.search = w.gl.utils.removeParamQueryString(url.search, param);
}); });
return url.href; return url.href;
}; };
w.gl.utils.getLocationHash = function(url) { w.gl.utils.getLocationHash = function(url) {
var hashIndex; var hashIndex;
if (typeof url === 'undefined') { if (typeof url === 'undefined') {
// Note: We can't use window.location.hash here because it's // Note: We can't use window.location.hash here because it's
...@@ -82,12 +81,10 @@ ...@@ -82,12 +81,10 @@
} }
hashIndex = url.indexOf('#'); hashIndex = url.indexOf('#');
return hashIndex === -1 ? null : url.substring(hashIndex + 1); return hashIndex === -1 ? null : url.substring(hashIndex + 1);
}; };
w.gl.utils.refreshCurrentPage = () => gl.utils.visitUrl(document.location.href); w.gl.utils.refreshCurrentPage = () => gl.utils.visitUrl(document.location.href);
w.gl.utils.visitUrl = (url) => { w.gl.utils.visitUrl = (url) => {
document.location.href = url; document.location.href = url;
}; };
})(window);
}).call(window);
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