From 2da12c0c14a24d8fe874d9056a4fe2704fead44c Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Wed, 23 Jul 2014 21:47:57 +0200 Subject: [PATCH] pagination and some table styling --- app/assets/images/sprite.svg | 4 +- .../controllers/_dashboard/ticket.js.coffee | 13 ++- .../views/agent_ticket_view/content.jst.eco | 4 +- .../javascripts/app/views/dashboard.jst.eco | 2 +- .../app/views/dashboard/ticket.jst.eco | 66 ++++++----- .../app/views/generic/table.jst.eco | 2 +- app/assets/stylesheets/zzz.css.erb | 106 ++++++++++++------ 7 files changed, 126 insertions(+), 71 deletions(-) diff --git a/app/assets/images/sprite.svg b/app/assets/images/sprite.svg index 2256beecd..9398a578c 100644 --- a/app/assets/images/sprite.svg +++ b/app/assets/images/sprite.svg @@ -1,5 +1,5 @@ - + sprite Created with Sketch (http://www.bohemiancoding.com/sketch) @@ -93,5 +93,7 @@ + + \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee index cbd90d78b..fc086d6ac 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee @@ -71,12 +71,17 @@ class App.DashboardTicket extends App.Controller @overview = data.overview @tickets_count = data.tickets_count @ticket_ids = data.ticket_ids - per_page = @overview.view.per_page || 10 + per_page = Math.min(@overview.view.per_page || 10, @tickets_count) + tickets_from = @start_page * per_page + tickets_till = Math.max(tickets_from + per_page-1, 0) pages_total = parseInt( ( @tickets_count / per_page ) + 0.99999 ) || 1 html = App.view('dashboard/ticket')( - overview: @overview, - pages_total: pages_total, - start_page: @start_page, + overview: @overview, + pages_total: pages_total, + start_page: @start_page, + tickets_from: tickets_from, + tickets_till: tickets_till, + tickets_count: @tickets_count ) html = $(html) html.find('li').removeClass('active') diff --git a/app/assets/javascripts/app/views/agent_ticket_view/content.jst.eco b/app/assets/javascripts/app/views/agent_ticket_view/content.jst.eco index 2cca743b8..c55584211 100644 --- a/app/assets/javascripts/app/views/agent_ticket_view/content.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_view/content.jst.eco @@ -1,4 +1,4 @@ - -
+