diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-23 06:58:03 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-23 06:58:03 +0100 |
| commit | 939932ca9e08512a65f2c40df2311cdda7a309d0 (patch) | |
| tree | 633684665c0b5f8896672969459cfc11fb3fd23d /public/assets/js/lib/views/mail/mailbox.js | |
| parent | dbb2d747323293e6ded68e5fd037ca3e01a7c6c2 (diff) | |
next page link on mailbox pages
Diffstat (limited to 'public/assets/js/lib/views/mail/mailbox.js')
| -rw-r--r-- | public/assets/js/lib/views/mail/mailbox.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/public/assets/js/lib/views/mail/mailbox.js b/public/assets/js/lib/views/mail/mailbox.js index 5635a7d..9d988cb 100644 --- a/public/assets/js/lib/views/mail/mailbox.js +++ b/public/assets/js/lib/views/mail/mailbox.js @@ -16,7 +16,8 @@ var MailboxView = View.extend({ load: function(name){ name = sanitize(name) || "inbox" $("h1").html(name) - $.get(this.action + name, this.populate.bind(this)) + var query = window.location.search.substr(1) + $.get(this.action + name, query, this.populate.bind(this)) }, populate: function(data){ @@ -26,7 +27,19 @@ var MailboxView = View.extend({ var user = data.user var max = data.messages.length-1 if (data.messages.length) { - $("#no_messages").hide() + var limit = data.query.limit || 50 + var offset = data.query.offset + data.messages.length + if (limit > data.messages.length) { + $(".next_page").hide() + } + else { + var query = { limit, offset } + $(".next_page a").attr("href", "?" + querystring(query)) + } + } + else { + $("#no_messages").show() + $(".next_page").hide() } data.messages.forEach(function(message, i){ var $row = this.parse(message, user) |
