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
64e8ab95
Commit
64e8ab95
authored
Nov 03, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pagination logic almost complete - active and inactive elements next - page gap not working
parent
77b0d605
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
40 deletions
+47
-40
app/assets/javascripts/vue_pipelines_index/pipelines.vue.js.es6
...sets/javascripts/vue_pipelines_index/pipelines.vue.js.es6
+7
-6
app/assets/javascripts/vue_pipelines_index/vue_gl_pagination.vue.js.es6
...ascripts/vue_pipelines_index/vue_gl_pagination.vue.js.es6
+40
-34
No files found.
app/assets/javascripts/vue_pipelines_index/pipelines.vue.js.es6
View file @
64e8ab95
...
...
@@ -17,7 +17,7 @@
pipelines: [],
currentPage: '',
intervalId: '',
page
N
um: 1,
page
n
um: 1,
};
},
props: [
...
...
@@ -27,19 +27,19 @@
],
created() {
const url = window.location.toString();
if (~url.indexOf('?')) this.page
N
um = url.split('?')[1].split('=')[1];
this.store.fetchDataLoop.call(this, Vue, this.page
N
um);
if (~url.indexOf('?')) this.page
n
um = url.split('?')[1].split('=')[1];
this.store.fetchDataLoop.call(this, Vue, this.page
n
um);
},
methods: {
shortsha(pipeline) {
return pipeline.sha.slice(0, 8);
},
changepage(event) {
this.page
N
um = +event.target.innerText;
this.page
n
um = +event.target.innerText;
// use p instead of page to avoid rails tyring to make an actual request
window.history.pushState({}, null, `?p=${this.page
N
um}`);
window.history.pushState({}, null, `?p=${this.page
n
um}`);
clearInterval(this.intervalId);
this.store.fetchDataLoop.call(this, Vue, this.page
N
um);
this.store.fetchDataLoop.call(this, Vue, this.page
n
um);
},
pipelineurl(id) {
return `pipelines/${id}`;
...
...
@@ -77,6 +77,7 @@
</table>
</div>
<vue-gl-pagination
:pagenum='pagenum'
:changepage='changepage'
:pages='pipelines.length'
:count='count'
...
...
app/assets/javascripts/vue_pipelines_index/vue_gl_pagination.vue.js.es6
View file @
64e8ab95
...
...
@@ -3,55 +3,61 @@
((gl) => {
gl.VueGlPagination = Vue.extend({
data() {
return {
last: Math.ceil(+this.count / 5),
};
},
props: [
'changepage',
'pages',
'count',
'pagenum',
],
methods: {
pagenumberstatus(n) {
if (n - 1 === +this.pagenum) return 'page active';
return '';
},
},
computed: {
lastpage() {
const lastPage = Math.ceil(+this.count / 5);
return `pipelines?page=${lastPage}`;
return `pipelines?p=${this.last}`;
},
upcount() {
return +this.last + 1;
},
prev() {
if (this.pagenum === 1) return 1;
return this.pagenum - 1;
},
next() {
if (this.pagenum === this.last) return `pipelines?p=${this.pagenum}`;
return `pipelines?p=${this.pagenum + 1}`;
},
},
template: `
<div class="gl-pagination">
<ul class="pagination clearfix">
<li class="prev disabled">
<ul
class="pagination clearfix"
v-for='n in upcount'
>
<li class="prev disabled" v-if='n === 1'>
<span>Prev</span>
</li>
<li class="page active">
<a @click='changepage($event)'>1</a>
</li>
<li class="page">
<a
rel="next"
@click='changepage($event)'
>
2
</a>
</li>
<li class="page">
<a @click='changepage($event)'>3</a>
</li>
<li class="page">
<a @click='changepage($event)'>4</a>
</li>
<li class="page">
<a @click='changepage($event)'>5</a>
</li>
<li class="page">
<span class="page gap">…</span>
<li :class='pagenumberstatus(n)' v-else>
<a @click='changepage($event)'>{{(n - 1)}}</a>
</li>
<li class="next">
<a
rel="next"
href="pipelines?page=2"
>
Next
</a>
<!--
still working on this bit
<li class="page" v-if='n === upcount - 1'>
<span class="page gap">…</span>
</li>
-->
<li class="next" v-if='n === upcount'>
<a rel="next" :href='next'>Next</a>
</li>
<li class="last">
<li class="last"
v-if='n === upcount'
>
<a :href='lastpage'>Last »</a>
</li>
</ul>
...
...
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