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
3d9e368e
Commit
3d9e368e
authored
Nov 08, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
about to use fatih code
parent
39a8f1aa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
5 deletions
+45
-5
index.js.es6
app/assets/javascripts/vue_pagination/index.js.es6
+44
-5
pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+1
-0
No files found.
app/assets/javascripts/vue_pagination/index.js.es6
View file @
3d9e368e
...
...
@@ -10,6 +10,9 @@
],
methods: {
pagestatus(n) {
if (this.getItems[1].prev) {
if (n === +this.pagenum) return true;
}
if (n - 1 === +this.pagenum) return true;
return false;
},
...
...
@@ -27,12 +30,17 @@
const pages = this.createSection(+this.last + 1);
pages.shift();
i
tems.push({ text: 'Prev', class: this.prevstatus()
});
i
f (+this.pagenum > 1) items.push({ text: 'First', first: true
});
pages.forEach(i => items.push({ text: i })
);
items.push({ text: 'Prev', prev: true, class: this.prevstatus() }
);
if (+this.pagenum < this.last) items.push({ text: 'Next' });
if (+this.pagenum !== this.last) items.push({ text: 'Last »' });
pages.forEach(i => items.push({ text: i, number: true }));
let nextDisabled = false;
if (+this.pagenum === this.last) { nextDisabled = true; }
items.push({ text: 'Next', next: true, disabled: nextDisabled });
if (+this.pagenum !== this.last) items.push({ text: 'Last »', last: true });
return items;
},
...
...
@@ -40,9 +48,40 @@
template: `
<div class="gl-pagination">
<ul class="pagination clearfix" v-for='(item, i) in getItems'>
<li :class="{active: pagestatus(i + 1), disabled: prevstatus(i)}">
<!-- if defined as the first button, render first -->
<li
v-if='item.first'
>
<span @click='changepage($event)'>{{item.text}}</span>
</li>
<!-- if defined as the prev button, render prev -->
<li
:class="{disabled: prevstatus(i)}"
v-if='item.prev'
>
<span @click='changepage($event)'>{{item.text}}</span>
</li>
<!-- if defined as the next button, render next -->
<li
v-if='item.next'
:class="{disabled: item.disabled}"
>
<span @click='changepage($event)'>{{item.text}}</span>
</li>
<!-- if defined as the last button, render last -->
<li
v-if='item.last'
:class="{disabled: item.disabled}"
>
<span @click='changepage($event, last)'>{{item.text}}</span>
</li>
<!-- if defined as the number button, render number -->
<li
:class="{active: pagestatus((i))}"
v-if='item.number'
>
<span @click='changepage($event)'>{{item.text}}</span>
</li>
</ul>
</div>
`,
...
...
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
3d9e368e
...
...
@@ -41,6 +41,7 @@
if (text === 'Last »') this.pagenum = last;
if (text === 'Next') this.pagenum = +this.pagenum + 1;
if (text === 'Prev') this.pagenum = +this.pagenum - 1;
if (text === 'First') this.pagenum = 1;
window.history.pushState({}, null, `?p=${this.pagenum}`);
clearInterval(this.intervalId);
...
...
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