From 39a8f1aaf4c05764045de5fcdacd52af2406c152 Mon Sep 17 00:00:00 2001 From: Regis Date: Tue, 8 Nov 2016 13:04:30 -0700 Subject: [PATCH] regex for number check --- .../javascripts/vue_pagination/index.js.es6 | 17 +++++++++++------ .../vue_pipelines_index/pipelines.js.es6 | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/vue_pagination/index.js.es6 b/app/assets/javascripts/vue_pagination/index.js.es6 index dce1c86ffa2..8dabfef3b95 100644 --- a/app/assets/javascripts/vue_pagination/index.js.es6 +++ b/app/assets/javascripts/vue_pagination/index.js.es6 @@ -9,9 +9,14 @@ 'pagenum', ], methods: { - pagenumberstatus(n) { - if (n - 1 === +this.pagenum) return 'active'; - return ''; + pagestatus(n) { + if (n - 1 === +this.pagenum) return true; + 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); }, }, @@ -22,7 +27,7 @@ const pages = this.createSection(+this.last + 1); pages.shift(); - if (+this.pagenum !== 1) items.push({ text: 'Prev' }); + items.push({ text: 'Prev', class: this.prevstatus() }); pages.forEach(i => items.push({ text: i })); @@ -34,8 +39,8 @@ }, template: `
-