diff --git a/src/components/misc/pagination.vue b/src/components/misc/pagination.vue new file mode 100644 index 000000000..83d9d0028 --- /dev/null +++ b/src/components/misc/pagination.vue @@ -0,0 +1,125 @@ + + + + + \ No newline at end of file diff --git a/src/components/tasks/mixins/taskList.js b/src/components/tasks/mixins/taskList.js index cd67e7ce1..92e5de1f7 100644 --- a/src/components/tasks/mixins/taskList.js +++ b/src/components/tasks/mixins/taskList.js @@ -12,50 +12,6 @@ const DEFAULT_PARAMS = { filter_concat: 'and', } -function createPagination(totalPages, currentPage) { - const pages = [] - for (let i = 0; i < totalPages; i++) { - - // Show ellipsis instead of all pages - if ( - i > 0 && // Always at least the first page - (i + 1) < totalPages && // And the last page - ( - // And the current with current + 1 and current - 1 - (i + 1) > currentPage + 1 || - (i + 1) < currentPage - 1 - ) - ) { - // Only add an ellipsis if the last page isn't already one - if (pages[i - 1] && !pages[i - 1].isEllipsis) { - pages.push({ - number: 0, - isEllipsis: true, - }) - } - continue - } - - pages.push({ - number: i + 1, - isEllipsis: false, - }) - } - return pages -} - -export function getRouteForPagination(page = 1, type = 'list') { - return { - name: 'list.' + type, - params: { - type: type, - }, - query: { - page: page, - }, - } -} - /** * This mixin provides a base set of methods and properties to get tasks on a list. */ @@ -84,11 +40,6 @@ export default { }, '$route.path': 'loadTasksOnSavedFilter', }, - computed: { - pages() { - return createPagination(this.taskCollectionService.totalPages, this.currentPage) - }, - }, methods: { loadTasks( page, @@ -213,6 +164,5 @@ export default { this.error(e) }) }, - getRouteForPagination, }, } \ No newline at end of file diff --git a/src/styles/theme/background.scss b/src/styles/theme/background.scss index 5a4664a51..0db72d0a8 100644 --- a/src/styles/theme/background.scss +++ b/src/styles/theme/background.scss @@ -5,6 +5,7 @@ background-attachment: fixed; min-height: 100vh; + // FIXME: move to pagination component .pagination-link:not(.is-current) { background: $light-background; } diff --git a/src/styles/theme/theme.scss b/src/styles/theme/theme.scss index a4438ef82..2004f44f4 100644 --- a/src/styles/theme/theme.scss +++ b/src/styles/theme/theme.scss @@ -116,18 +116,6 @@ button.table { } } -.pagination { - padding-bottom: 1rem; - - .pagination-previous, - .pagination-next { - &:not(:disabled):hover { - background: $button-background-color; - cursor: pointer; - } - } -} - .is-max-width-desktop { width: 100%; max-width: $desktop; diff --git a/src/views/list/views/List.vue b/src/views/list/views/List.vue index 334c46eac..de935ddd0 100644 --- a/src/views/list/views/List.vue +++ b/src/views/list/views/List.vue @@ -121,44 +121,10 @@ - + @@ -182,6 +148,7 @@ import FilterPopup from '@/components/list/partials/filter-popup.vue' import {HAS_TASKS} from '@/store/mutation-types' import Nothing from '@/components/misc/nothing.vue' import createTask from '@/components/tasks/mixins/createTask' +import Pagination from '@/components/misc/pagination.vue' import {mapState} from 'vuex' import draggable from 'vuedraggable' @@ -214,6 +181,7 @@ export default { EditTask, AddTask, draggable, + Pagination, }, created() { this.taskService = new TaskService() diff --git a/src/views/list/views/Table.vue b/src/views/list/views/Table.vue index 3deded876..181494168 100644 --- a/src/views/list/views/Table.vue +++ b/src/views/list/views/Table.vue @@ -172,40 +172,10 @@ - + @@ -226,6 +196,7 @@ import Fancycheckbox from '../../../components/input/fancycheckbox' import Sort from '../../../components/tasks/partials/sort' import {saveListView} from '@/helpers/saveListView' import FilterPopup from '@/components/list/partials/filter-popup.vue' +import Pagination from '@/components/misc/pagination.vue' export default { name: 'Table', @@ -237,6 +208,7 @@ export default { Labels, PriorityLabel, User, + Pagination, }, mixins: [ taskList,