Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
64e8ab95
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64e8ab95
编写于
11月 03, 2016
作者:
R
Regis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pagination logic almost complete - active and inactive elements next - page gap not working
上级
77b0d605
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
47 addition
and
40 deletion
+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
未找到文件。
app/assets/javascripts/vue_pipelines_index/pipelines.vue.js.es6
浏览文件 @
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
浏览文件 @
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>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录