BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
76c68d1a
Commit
76c68d1a
authored
Jan 09, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
namespace getParametersByName to gl.utils instead of just gl
parent
3fff93ca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
+13
-10
param_helper.js.es6
app/assets/javascripts/lib/utils/param_helper.js.es6
+5
-2
index.js.es6
app/assets/javascripts/vue_pagination/index.js.es6
+1
-1
pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+3
-3
pagination_spec.js.es6
spec/javascripts/vue_pagination/pagination_spec.js.es6
+4
-4
No files found.
app/assets/javascripts/lib/utils/param_helper.js.es6
View file @
76c68d1a
/* eslint-disable no-param-reassign */
((w) => {
((gl) => {
gl.utils = gl.utils || (gl.utils = {});
/**
this will take in the `name` of the param you want to parse in the url
if the name does not exist this function will return `null`
otherwise it will return the value of the param key provided
*/
w.getParameterByName = (name) => {
gl.utils.getParameterByName = (name) => {
const url = window.location.href;
name = name.replace(/[[\]]/g, '\\$&');
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
...
...
app/assets/javascripts/vue_pagination/index.js.es6
View file @
76c68d1a
...
...
@@ -58,7 +58,7 @@
},
methods: {
changePage(e) {
let apiScope = gl.getParameterByName('scope');
let apiScope = gl.
utils.
getParameterByName('scope');
if (!apiScope) apiScope = 'all';
...
...
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
76c68d1a
...
...
@@ -28,8 +28,8 @@
},
props: ['scope', 'store', 'svgs'],
created() {
const pagenum = gl.getParameterByName('p');
const scope = gl.getParameterByName('scope');
const pagenum = gl.
utils.
getParameterByName('p');
const scope = gl.
utils.
getParameterByName('scope');
if (pagenum) this.pagenum = pagenum;
if (scope) this.apiScope = scope;
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope);
...
...
@@ -42,7 +42,7 @@
this.store.fetchDataLoop.call(this, Vue, pagenum, this.scope, apiScope);
},
author(pipeline) {
if (!pipeline.commit) return
({ avatar_url: '', web_url: '', username: '' })
;
if (!pipeline.commit) return
{ avatar_url: '', web_url: '', username: '' }
;
if (pipeline.commit.author) return pipeline.commit.author;
return {
avatar_url: pipeline.commit.author_gravatar_url,
...
...
spec/javascripts/vue_pagination/pagination_spec.js.es6
View file @
76c68d1a
...
...
@@ -147,8 +147,8 @@ describe('paramHelper', () => {
it('can parse url parameters correctly', () => {
window.history.pushState({}, null, '?scope=all&p=2');
const scope = gl.getParameterByName('scope');
const p = gl.getParameterByName('p');
const scope = gl.
utils.
getParameterByName('scope');
const p = gl.
utils.
getParameterByName('p');
expect(scope).toEqual('all');
expect(p).toEqual('2');
...
...
@@ -157,8 +157,8 @@ describe('paramHelper', () => {
it('returns null if param not in url', () => {
window.history.pushState({}, null, '?p=2');
const scope = gl.getParameterByName('scope');
const p = gl.getParameterByName('p');
const scope = gl.
utils.
getParameterByName('scope');
const p = gl.
utils.
getParameterByName('p');
expect(scope).toEqual(null);
expect(p).toEqual('2');
...
...
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