diff options
author | Phil Hughes <me@iamphill.com> | 2017-07-25 16:46:15 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-07-25 16:46:15 +0100 |
commit | 887227e0371858d5d048f61bfe0700e4b7ebab58 (patch) | |
tree | 94619d6b051f013c87b7265274468961b3b00036 /app/assets | |
parent | fe27de8bf124d65013da1d82618a1ab45584ff68 (diff) | |
download | gitlab-ce-887227e0371858d5d048f61bfe0700e4b7ebab58.tar.gz |
moved some more inline code
removed some global variable comments
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/dispatcher.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/init_issuable_sidebar.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/issuable_context.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/sidebar/sidebar_bundle.js | 3 |
4 files changed, 9 insertions, 7 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index 2802c3a375a..0b2c7e434f0 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -27,9 +27,6 @@ /* global Shortcuts */ /* global Sidebar */ /* global ShortcutsWiki */ -/* global IssuableContext */ -/* global IssueStatusSelect */ -/* global SubscriptionSelect */ import Issue from './issue'; import BindInOut from './behaviors/bind_in_out'; diff --git a/app/assets/javascripts/init_issuable_sidebar.js b/app/assets/javascripts/init_issuable_sidebar.js index 82071348d99..29e3d2ea94e 100644 --- a/app/assets/javascripts/init_issuable_sidebar.js +++ b/app/assets/javascripts/init_issuable_sidebar.js @@ -5,11 +5,13 @@ /* global Sidebar */ export default () => { + const sidebarOptions = JSON.parse(document.querySelector('.js-sidebar-options').innerHTML); + new MilestoneSelect({ - full_path: gl.sidebarOptions.fullPath, + full_path: sidebarOptions.fullPath, }); new LabelsSelect(); - new IssuableContext(gl.sidebarOptions.currentUser); + new IssuableContext(sidebarOptions.currentUser); gl.Subscription.bindAll('.subscription'); new gl.DueDateSelectors(); window.sidebar = new Sidebar(); diff --git a/app/assets/javascripts/issuable_context.js b/app/assets/javascripts/issuable_context.js index a45ff3fc43e..26392db4b5b 100644 --- a/app/assets/javascripts/issuable_context.js +++ b/app/assets/javascripts/issuable_context.js @@ -4,6 +4,8 @@ import Cookies from 'js-cookie'; import UsersSelect from './users_select'; +const PARTICIPANTS_ROW_COUNT = 7; + (function() { this.IssuableContext = (function() { function IssuableContext(currentUser) { @@ -52,7 +54,7 @@ import UsersSelect from './users_select'; IssuableContext.prototype.initParticipants = function() { $(document).on("click", ".js-participants-more", this.toggleHiddenParticipants); return $(".js-participants-author").each(function(i) { - if (i >= 7) { + if (i >= PARTICIPANTS_ROW_COUNT) { return $(this).addClass("js-participants-hidden").hide(); } }); diff --git a/app/assets/javascripts/sidebar/sidebar_bundle.js b/app/assets/javascripts/sidebar/sidebar_bundle.js index 2b02af87d8a..a9df66748c5 100644 --- a/app/assets/javascripts/sidebar/sidebar_bundle.js +++ b/app/assets/javascripts/sidebar/sidebar_bundle.js @@ -5,7 +5,8 @@ import sidebarAssignees from './components/assignees/sidebar_assignees'; import Mediator from './sidebar_mediator'; function domContentLoaded() { - const mediator = new Mediator(gl.sidebarOptions); + const sidebarOptions = JSON.parse(document.querySelector('.js-sidebar-options').innerHTML); + const mediator = new Mediator(sidebarOptions); mediator.fetch(); const sidebarAssigneesEl = document.querySelector('#js-vue-sidebar-assignees'); |