Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
13182a9c
Commit
13182a9c
authored
Sep 09, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make use of destructuring options, clean up based on feedback.
parent
b690c19d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
47 deletions
+54
-47
app/assets/javascripts/blob/blob_ci_yaml.js.es6
app/assets/javascripts/blob/blob_ci_yaml.js.es6
+6
-6
app/assets/javascripts/profile/profile.js.es6
app/assets/javascripts/profile/profile.js.es6
+4
-8
app/assets/javascripts/search_autocomplete.js.es6
app/assets/javascripts/search_autocomplete.js.es6
+22
-13
app/assets/javascripts/todos.js.es6
app/assets/javascripts/todos.js.es6
+5
-5
app/assets/javascripts/user.js.es6
app/assets/javascripts/user.js.es6
+3
-3
app/assets/javascripts/user_tabs.js.es6
app/assets/javascripts/user_tabs.js.es6
+14
-12
No files found.
app/assets/javascripts/blob/blob_ci_yaml.js.es6
View file @
13182a9c
...
...
@@ -8,15 +8,15 @@
requestFile(query) {
return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this));
}
;
}
};
global.BlobCiYamlSelector = BlobCiYamlSelector;
class BlobCiYamlSelectors {
constructor(
opts
) {
this.
$dropdowns = opts.$dropdowns || $('.js-gitlab-ci-yml-selector')
;
this.
editor = opts.editor
;
constructor(
{ editor, $dropdowns = $('.js-gitlab-ci-yml-selector') }
) {
this.
editor = editor
;
this.
$dropdowns = $dropdowns
;
this.initSelectors();
}
...
...
@@ -24,11 +24,11 @@
this.$dropdowns.each((i, dropdown) => {
const $dropdown = $(dropdown);
return new BlobCiYamlSelector({
editor,
pattern: /(.gitlab-ci.yml)/,
data: $dropdown.data('data'),
wrapper: $dropdown.closest('.js-gitlab-ci-yml-selector-wrap'),
dropdown: $dropdown,
editor: this.editor
dropdown: $dropdown
});
});
}
...
...
app/assets/javascripts/profile/profile.js.es6
View file @
13182a9c
((global) => {
class Profile {
constructor(
opts = {
}) {
constructor(
{ form = $('.edit-user')
}) {
this.onSubmitForm = this.onSubmitForm.bind(this);
this.form =
opts.form || $('.edit-user')
;
this.form =
form
;
this.bindEvents();
this.initAvatarGlCrop();
}
...
...
@@ -72,12 +72,8 @@
dataType: "json",
processData: false,
contentType: false,
success: (response) => {
return new Flash(response.message, 'notice');
},
error: (jqXHR) => {
return new Flash(jqXHR.responseJSON.message, 'alert');
},
success: response => new Flash(response.message, 'notice'),
error: jqXHR => new Flash(jqXHR.responseJSON.message, 'alert'),
complete: () => {
window.scrollTo(0, 0);
// Enable submit button after requests ends
...
...
app/assets/javascripts/search_autocomplete.js.es6
View file @
13182a9c
...
...
@@ -9,19 +9,20 @@
};
class SearchAutocomplete {
constructor(opts = {}) {
this.onSearchInputBlur = this.onSearchInputBlur.bind(this);
this.onClearInputClick = this.onClearInputClick.bind(this);
this.onSearchInputFocus = this.onSearchInputFocus.bind(this);
this.onSearchInputClick = this.onSearchInputClick.bind(this);
this.onSearchInputKeyUp = this.onSearchInputKeyUp.bind(this);
this.onSearchInputKeyDown = this.onSearchInputKeyDown.bind(this);
this.wrap = opts.wrap || $('.search');
this.optsEl = opts.optsEl || this.wrap.find('.search-autocomplete-opts');
this.autocompletePath = opts.autocompletePath || this.optsEl.data('autocomplete-path')
this.projectId = opts.projectId || this.optsEl.data('autocomplete-project-id') || '';
this.projectRef = opts.projectRef || this.optsEl.data('autocomplete-project-ref') || '';
this.dropdown = this.wrap.find('.dropdown');
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') || '')
}) {
this.bindEventContext();
this.wrap = wrap;
this.optsEl = optsEl;
this.autocompletePath = autocompletePath;
this.projectId = projectId;
this.projectRef = projectRef;
this.dropdown = wrap.find('.dropdown');
this.dropdownContent = this.dropdown.find('.dropdown-content');
this.locationBadgeEl = this.getElement('.location-badge');
this.scopeInputEl = this.getElement('#scope');
...
...
@@ -42,6 +43,14 @@
}
// Finds an element inside wrapper element
bindEventContext() {
this.onSearchInputBlur = this.onSearchInputBlur.bind(this);
this.onClearInputClick = this.onClearInputClick.bind(this);
this.onSearchInputFocus = this.onSearchInputFocus.bind(this);
this.onSearchInputClick = this.onSearchInputClick.bind(this);
this.onSearchInputKeyUp = this.onSearchInputKeyUp.bind(this);
this.onSearchInputKeyDown = this.onSearchInputKeyDown.bind(this);
}
getElement(selector) {
return this.wrap.find(selector);
}
...
...
app/assets/javascripts/todos.js.es6
View file @
13182a9c
((global) => {
class Todos {
constructor(
opts = {
}) {
constructor(
{ el = $('.js-todos-options')
}) {
this.allDoneClicked = this.allDoneClicked.bind(this);
this.doneClicked = this.doneClicked.bind(this);
this.el =
opts.el || $('.js-todos-options')
;
this.perPage =
this.
el.data('perPage');
this.el =
el
;
this.perPage = el.data('perPage');
this.clearListeners();
this.initBtnListeners();
this.initFilters();
...
...
@@ -60,7 +60,7 @@
data: {
'_method': 'delete'
},
success:
data
=> {
success:
(data)
=> {
this.redirectIfNeeded(data.count);
this.clearDone($target.closest('li'));
return this.updateBadges(data);
...
...
@@ -80,7 +80,7 @@
data: {
'_method': 'delete'
},
success:
data
=> {
success:
(data)
=> {
$target.remove();
$('.prepend-top-default').html('<div class="nothing-here-block">You\'re all done!</div>');
return this.updateBadges(data);
...
...
app/assets/javascripts/user.js.es6
View file @
13182a9c
((global) => {
global.User = class {
constructor(
opts
) {
this.
opts = opts
;
constructor(
{ action }
) {
this.
action = action
;
this.placeProfileAvatarsToTop();
this.initTabs();
this.hideProjectLimitMessage();
...
...
@@ -16,7 +16,7 @@
initTabs() {
return new global.UserTabs({
parentEl: '.user-profile',
action: this.
opts.
action
action: this.action
});
}
...
...
app/assets/javascripts/user_tabs.js.es6
View file @
13182a9c
...
...
@@ -59,11 +59,11 @@ content on the Users#show page.
*/
((global) => {
class UserTabs {
constructor (
opts
) {
constructor (
{ defaultAction = 'activity', action = defaultAction, parentEl }
) {
this.loaded = {};
this.defaultAction =
opts.defaultAction || 'activity'
;
this.action =
opts.action || 'activity'
;
this.$parentEl = $(
opts.
parentEl) || $(document);
this.defaultAction =
defaultAction
;
this.action =
action
;
this.$parentEl = $(parentEl) || $(document);
this._location = window.location;
this.$parentEl.find('.nav-links a')
.each((i, navLink) => {
...
...
@@ -81,7 +81,7 @@ content on the Users#show page.
bindEvents() {
return this.$parentEl.off('shown.bs.tab', '.nav-links a[data-toggle="tab"]')
.on('shown.bs.tab', '.nav-links a[data-toggle="tab"]',
(event)
=> this.tabShown(event));
.on('shown.bs.tab', '.nav-links a[data-toggle="tab"]',
event
=> this.tabShown(event));
}
tabShown(event) {
...
...
@@ -93,7 +93,7 @@ content on the Users#show page.
}
activateTab(action) {
return this.$parentEl.find(
".nav-links .js-" + action + "-tab a"
)
return this.$parentEl.find(
`.nav-links .js-${action}-tab a`
)
.tab('show');
}
...
...
@@ -104,7 +104,9 @@ content on the Users#show page.
if (action === 'activity') {
this.loadActivities(source);
}
if (action === 'groups' || action === 'contributed' || action === 'projects' || action === 'snippets') {
const loadableActions = [ 'groups', 'contributed', 'projects', 'snippets' ];
if (loadableActions.indexOf(action) > -1) {
return this.loadTab(source, action);
}
}
...
...
@@ -115,9 +117,9 @@ content on the Users#show page.
complete: () => this.toggleLoading(false),
dataType: 'json',
type: 'GET',
url:
source + ".json"
,
url:
`${source}.json`
,
success: (data) => {
const tabSelector =
'div#' + action
;
const tabSelector =
`div#${action}`
;
this.$parentEl.find(tabSelector).html(data.html);
this.loaded[action] = true;
return gl.utils.localTimeAgo($('.js-timeago', tabSelector));
...
...
@@ -141,12 +143,12 @@ content on the Users#show page.
}
setCurrentAction(action) {
const regExp = new RegExp(
'\/(' + this.actions.join('|') + ')(\.html)?\/?$'
);
const regExp = new RegExp(
`\/(${this.actions.join('|')})(\.html)?\/?$`
);
let new_state = this._location.pathname;
new_state = new_state.replace(/\/+$/,
""
);
new_state = new_state.replace(/\/+$/,
''
);
new_state = new_state.replace(regExp, '');
if (action !== this.defaultAction) {
new_state +=
"/" + action
;
new_state +=
`/${action}`
;
}
new_state += this._location.search + this._location.hash;
history.replaceState({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment