Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
externe Matthieu
Géocontrib Frontend
Commits
75dcea39
Commit
75dcea39
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
no pagination if only one page, clic on page number and grey sort icons
parent
6986a8a0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/feature/FeatureListTable.vue
+53
-10
53 additions, 10 deletions
src/components/feature/FeatureListTable.vue
with
53 additions
and
10 deletions
src/components/feature/FeatureListTable.vue
+
53
−
10
View file @
75dcea39
...
@@ -20,7 +20,10 @@
...
@@ -20,7 +20,10 @@
<th
class=
"center"
>
<th
class=
"center"
>
Type
Type
<i
<i
:class=
"
{ down: isSortedAsc('type'), up: isSortedDesc('type') }"
:class=
"
{
down: isSortedAsc('type'),
up: isSortedDesc('type'),
}"
class="icon sort"
class="icon sort"
@click="changeSort('type')"
@click="changeSort('type')"
/>
/>
...
@@ -28,7 +31,10 @@
...
@@ -28,7 +31,10 @@
<th
class=
"center"
>
<th
class=
"center"
>
Nom
Nom
<i
<i
:class=
"
{ down: isSortedAsc('nom'), up: isSortedDesc('nom') }"
:class=
"
{
down: isSortedAsc('nom'),
up: isSortedDesc('nom'),
}"
class="icon sort"
class="icon sort"
@click="changeSort('nom')"
@click="changeSort('nom')"
/>
/>
...
@@ -138,8 +144,9 @@
...
@@ -138,8 +144,9 @@
</tbody>
</tbody>
</table>
</table>
<div
<div
class=
"dataTables_info
"
v-if=
"nbPages.length > 1
"
id=
"table-features_info"
id=
"table-features_info"
class=
"dataTables_info"
role=
"status"
role=
"status"
aria-live=
"polite"
aria-live=
"polite"
>
>
...
@@ -148,22 +155,27 @@
...
@@ -148,22 +155,27 @@
sur
{{
filteredFeatures
.
length
}}
éléments
sur
{{
filteredFeatures
.
length
}}
éléments
</div>
</div>
<div
<div
class=
"dataTables_paginate paging_simple_numbers
"
v-if=
"nbPages.length > 1
"
id=
"table-features_paginate"
id=
"table-features_paginate"
class=
"dataTables_paginate paging_simple_numbers"
>
>
<a
<a
@
click=
"toPreviousPage"
@
click=
"toPreviousPage"
class=
"paginate_button previous disabled"
id=
"table-features_previous"
:class=
"[
'paginate_button previous',
{ disabled: pagination.currentPage === 1 },
]"
aria-controls="table-features"
aria-controls="table-features"
data-dt-idx="0"
data-dt-idx="0"
tabindex="0"
tabindex="0"
id=
"table-features_previous"
>Précédent
</a
>Précédent
</a
>
>
<span>
<span>
<a
<a
v-for=
"pageNumber in nbPages"
v-for=
"pageNumber in nbPages"
:key=
"'page' + pageNumber"
:key=
"'page' + pageNumber"
@
click=
"toPage(pageNumber)"
:class=
"[
:class=
"[
'paginate_button',
'paginate_button',
{ current: pageNumber === pagination.currentPage },
{ current: pageNumber === pagination.currentPage },
...
@@ -176,11 +188,14 @@
...
@@ -176,11 +188,14 @@
</span>
</span>
<!-- // TODO :
<span
v-if=
"nbPages > 4"
class=
"ellipsis"
>
...
</span>
-->
<!-- // TODO :
<span
v-if=
"nbPages > 4"
class=
"ellipsis"
>
...
</span>
-->
<a
<a
class=
"paginate_button next"
id=
"table-features_next"
:class=
"[
'paginate_button next',
{ disabled: pagination.currentPage === nbPages.length },
]"
aria-controls="table-features"
aria-controls="table-features"
data-dt-idx="7"
data-dt-idx="7"
tabindex="0"
tabindex="0"
id=
"table-features_next"
@click="toNextPage"
@click="toNextPage"
>Suivant
</a
>Suivant
</a
>
>
...
@@ -258,12 +273,10 @@ export default {
...
@@ -258,12 +273,10 @@ export default {
let
N
=
Math
.
round
(
let
N
=
Math
.
round
(
this
.
filteredFeatures
.
length
/
this
.
pagination
.
pagesize
this
.
filteredFeatures
.
length
/
this
.
pagination
.
pagesize
);
);
console
.
log
(
"
N
"
,
N
);
const
arr
=
[...
Array
(
N
).
keys
()].
map
(
function
(
x
)
{
const
arr
=
[...
Array
(
N
).
keys
()].
map
(
function
(
x
)
{
++
x
;
++
x
;
return
x
;
return
x
;
});
});
console
.
log
(
"
arr
"
,
arr
);
return
arr
;
return
arr
;
},
},
...
@@ -296,6 +309,14 @@ export default {
...
@@ -296,6 +309,14 @@ export default {
}
}
},
},
toPage
(
pageNumber
)
{
const
toAddOrRemove
=
(
pageNumber
-
this
.
pagination
.
currentPage
)
*
this
.
pagination
.
pagesize
;
this
.
pagination
.
start
+=
toAddOrRemove
;
this
.
pagination
.
end
+=
toAddOrRemove
;
this
.
pagination
.
currentPage
=
pageNumber
;
},
toPreviousPage
()
{
toPreviousPage
()
{
if
(
this
.
pagination
.
start
>
0
)
{
if
(
this
.
pagination
.
start
>
0
)
{
this
.
pagination
.
start
-=
this
.
pagination
.
pagesize
;
this
.
pagination
.
start
-=
this
.
pagination
.
pagesize
;
...
@@ -369,6 +390,24 @@ export default {
...
@@ -369,6 +390,24 @@ export default {
border
:
1px
solid
transparent
;
border
:
1px
solid
transparent
;
border-radius
:
2px
;
border-radius
:
2px
;
}
}
.dataTables_wrapper
.dataTables_paginate
.paginate_button
:hover
{
color
:
white
!important
;
border
:
1px
solid
#111
;
background-color
:
#585858
;
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0%
,
#585858
),
color-stop
(
100%
,
#111
)
);
background
:
-webkit-linear-gradient
(
top
,
#585858
0%
,
#111
100%
);
background
:
-moz-linear-gradient
(
top
,
#585858
0%
,
#111
100%
);
background
:
-ms-linear-gradient
(
top
,
#585858
0%
,
#111
100%
);
background
:
-o-linear-gradient
(
top
,
#585858
0%
,
#111
100%
);
background
:
linear-gradient
(
to
bottom
,
#585858
0%
,
#111
100%
);
}
.dataTables_wrapper
.dataTables_paginate
.paginate_button.disabled
,
.dataTables_wrapper
.dataTables_paginate
.paginate_button.disabled
:hover
,
.dataTables_wrapper
.dataTables_paginate
.paginate_button.disabled
:hover
,
.dataTables_wrapper
.dataTables_paginate
.paginate_button.disabled
:active
{
.dataTables_wrapper
.dataTables_paginate
.paginate_button.disabled
:active
{
cursor
:
default
;
cursor
:
default
;
...
@@ -378,6 +417,10 @@ export default {
...
@@ -378,6 +417,10 @@ export default {
box-shadow
:
none
;
box-shadow
:
none
;
}
}
i
.icon.sort
:not
(
.down
)
:not
(
.up
)
{
color
:
rgb
(
220
,
220
,
220
);
}
/*
/*
Max width before this PARTICULAR table gets nasty
Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px
This query will take effect for any screen smaller than 760px
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment