feat(pagination): Show only 100 first elements

This commit is contained in:
Joxit
2019-05-26 01:20:02 +02:00
parent 32d0df1af9
commit 7356591292
4 changed files with 13 additions and 4 deletions

View File

@@ -65,4 +65,10 @@ registryUI.getHistoryIcon = function(attribute) {
default:
''
}
}
registryUI.getPage = function(elts, page, limit) {
if (!limit) { limit = 100; }
if (!elts) { return []; }
return elts.slice(page * limit, limit);
}

View File

@@ -130,8 +130,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
return this.fillInfo();
});
this.on('get-date', function() {
if (this.date !== undefined) {
return this.trigger('date', this.date);
if (this.creationDate !== undefined) {
return this.trigger('creation-date', this.creationDate);
}
return this.fillInfo();
});

View File

@@ -24,5 +24,7 @@
self.localDate = date.toLocaleString()
self.update();
});
opts.image.trigger('get-date');
</script>
</image-date>

View File

@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<taglist>
<!-- Begin of tag -->
<material-card ref="taglist-tag" class="taglist" multi-delete={ this.multiDelete }>
<material-card ref="taglist-tag" class="taglist" multi-delete={ this.multiDelete } tags={ registryUI.getPage(registryUI.taglist.tags, this.page) }>
<div class="material-card-title-action">
<material-button waves-center="true" rounded="true" waves-color="#ddd" onclick="registryUI.home();">
<i class="material-icons">arrow_back</i>
@@ -50,7 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tr>
</thead>
<tbody>
<tr each="{ image in registryUI.taglist.tags }">
<tr each="{ image in this.opts.tags }">
<td class="material-card-th-left">{ image.name }</td>
<td class="copy-to-clipboard">
<copy-to-clipboard image={ image }/>
@@ -76,6 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</material-card>
<script>
var self = registryUI.taglist.instance = this;
self.page = 0;
this.multiDelete = false;
this.toDelete = 0;