From e95a2b156b181145c98a790edd924e90cca3f3ee Mon Sep 17 00:00:00 2001 From: Regis Date: Mon, 7 Nov 2016 23:56:02 -0700 Subject: [PATCH] remove use of spread operator - attempt render function --- .../javascripts/vue_pagination/index.js.es6 | 36 ++++++++++++++++--- .../vue_pipelines_index/pipelines.js.es6 | 1 - 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/vue_pagination/index.js.es6 b/app/assets/javascripts/vue_pagination/index.js.es6 index 71031c4d76d..7703901e113 100644 --- a/app/assets/javascripts/vue_pagination/index.js.es6 +++ b/app/assets/javascripts/vue_pagination/index.js.es6 @@ -11,6 +11,7 @@ data() { return { nslice: +this.pagenum, + endcount: this.last, }; }, methods: { @@ -20,12 +21,15 @@ }, prevstatus() { if (+this.pagenum > 1) return ''; - return 'prev disabled'; + return 'disabled'; + }, + createSection(n) { + return Array.from(Array(n)).map((e, i) => i); }, }, computed: { dynamicpage() { - const section = [...Array(this.upcount).keys()]; + const section = this.createSection(this.upcount); section.shift(); this.nslice = +this.pagenum; this.endcount = +this.pagenum + 5; @@ -38,7 +42,7 @@ }, paginationsection() { if (this.last < 6 && this.pagenum < 6) { - const pageArray = [...Array(6).keys()]; + const pageArray = this.createSection(6); pageArray.shift(); return pageArray.slice(0, this.upcount); } @@ -81,7 +85,7 @@ class="next" v-if='(n === upcount || n === endcount) && pagenum !== last' > - Next + Next
  • `, + // render(createElement) { + // return createElement('div', { + // class: { + // 'gl-pagination': true, + // }, + // }, [createElement('ul', { + // class: { + // pagination: true, + // clearfix: true, + // }, + // }, this.paginationsection.map((e, i) => { + // if (!i) return createElement('li', [createElement('span', { + // class: { + // prev: this.prevstatus, + // }, + // }, 'Prev')]); + // if (i) { + // return createElement('li', + // [createElement('span', i)] + // ); + // } + // })), + // ]); + // }, }); })(window.gl || (window.gl = {})); diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 index 3ab336f0e6d..4ef9fca6474 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 @@ -40,7 +40,6 @@ if (page.where) this.pagenum = +page.where; if (page.where) this.pagenum = +page.where; - // use p instead of page to avoid making an actual request window.history.pushState({}, null, `?p=${this.pagenum}`); clearInterval(this.intervalId); this.store.fetchDataLoop.call(this, Vue, this.pagenum); -- GitLab