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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
39a8f1aa
Commit
39a8f1aa
authored
Nov 08, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regex for number check
parent
4dd82e1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
app/assets/javascripts/vue_pagination/index.js.es6
app/assets/javascripts/vue_pagination/index.js.es6
+11
-6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+1
-1
No files found.
app/assets/javascripts/vue_pagination/index.js.es6
View file @
39a8f1aa
...
@@ -9,9 +9,14 @@
...
@@ -9,9 +9,14 @@
'pagenum',
'pagenum',
],
],
methods: {
methods: {
pagenumberstatus(n) {
pagestatus(n) {
if (n - 1 === +this.pagenum) return 'active';
if (n - 1 === +this.pagenum) return true;
return '';
return false;
},
prevstatus(index) {
if (index > 0) return false;
if (+this.pagenum < 2) return true;
return false;
},
},
createSection(n) { return Array.from(Array(n)).map((e, i) => i); },
createSection(n) { return Array.from(Array(n)).map((e, i) => i); },
},
},
...
@@ -22,7 +27,7 @@
...
@@ -22,7 +27,7 @@
const pages = this.createSection(+this.last + 1);
const pages = this.createSection(+this.last + 1);
pages.shift();
pages.shift();
i
f (+this.pagenum !== 1) items.push({ text: 'Prev'
});
i
tems.push({ text: 'Prev', class: this.prevstatus()
});
pages.forEach(i => items.push({ text: i }));
pages.forEach(i => items.push({ text: i }));
...
@@ -34,8 +39,8 @@
...
@@ -34,8 +39,8 @@
},
},
template: `
template: `
<div class="gl-pagination">
<div class="gl-pagination">
<ul class="pagination clearfix" v-for='(item, i
ndex
) in getItems'>
<ul class="pagination clearfix" v-for='(item, i) in getItems'>
<li :class=
'pagenumberstatus(index + 1)'
>
<li :class=
"{active: pagestatus(i + 1), disabled: prevstatus(i)}"
>
<span @click='changepage($event, last)'>{{item.text}}</span>
<span @click='changepage($event, last)'>{{item.text}}</span>
</li>
</li>
</ul>
</ul>
...
...
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
39a8f1aa
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
},
},
changepage(event, last) {
changepage(event, last) {
const text = event.target.innerText;
const text = event.target.innerText;
if (
typeof text === 'number'
) this.pagenum = +text;
if (
/^-?[\d.]+(?:e-?\d+)?$/.test(text)
) this.pagenum = +text;
if (text === 'Last »') this.pagenum = last;
if (text === 'Last »') this.pagenum = last;
if (text === 'Next') this.pagenum = +this.pagenum + 1;
if (text === 'Next') this.pagenum = +this.pagenum + 1;
if (text === 'Prev') this.pagenum = +this.pagenum - 1;
if (text === 'Prev') this.pagenum = +this.pagenum - 1;
...
...
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