Toggle paginations if one or less items are displayed.

This commit is contained in:
Patrick Jentsch 2019-08-14 16:59:39 +02:00
parent ea399d2cdc
commit 47c3edeb7f
2 changed files with 21 additions and 16 deletions

View File

@ -12,6 +12,17 @@
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/materialize.min.css') }}" media="screen,projection"/> <link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/materialize.min.css') }}" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/opaque.css') }}" media="screen,projection"/> <link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/opaque.css') }}" media="screen,projection"/>
<script src="{{ url_for('static', filename='js/list.js') }}"></script> <script src="{{ url_for('static', filename='js/list.js') }}"></script>
<script>
// Utils
var updatePagination = function(list) {
pagination = list.listContainer.querySelector(".pagination");
if (pagination.childElementCount <= 1) {
pagination.classList.add("hide");
} else {
pagination.classList.remove("hide");
}
}
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head> </head>
<body> <body>

View File

@ -39,16 +39,11 @@
</div> </div>
</div> </div>
<script> <script>
corpusListOptions = { corpusList = new List("corpus-list", {valueNames: ["title"],
valueNames: ['title'], page: 4,
page: 4, pagination: true});
pagination: true corpusList.on("filterComplete", updatePagination);
}; corpusList.on("searchComplete", updatePagination);
corpusList = new List("corpus-list", corpusListOptions);
/*
* TODO: Hide Pagination if there is only on page
* corpusListPagination = document.querySelector("#corpus-list .pagination");
*/
</script> </script>
<div class="col s12"> <div class="col s12">
@ -113,12 +108,11 @@
</div> </div>
</div> </div>
<script> <script>
jobListOptions = { var jobList = new List("job-list", {valueNames: ["title"],
valueNames: ['title'], page: 4,
page: 4, pagination: true});
pagination: true jobList.on("filterComplete", updatePagination);
}; jobList.on("searchComplete", updatePagination);
jobList = new List("job-list", jobListOptions);
</script> </script>
<div id="new-corpus-modal" class="modal"> <div id="new-corpus-modal" class="modal">