From 838756e30d25d8626724b657baad1a984b436d24 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 24 Jul 2014 01:03:13 +0200 Subject: [PATCH] Set priority icon at runtime. --- .../controllers/_dashboard/ticket.js.coffee | 20 +++++++++++++++++++ .../app/controllers/ticket_overview.js.coffee | 20 +++++++++++++++++++ .../app/views/generic/table.jst.eco | 6 +----- app/assets/stylesheets/zzz.css.erb | 3 +++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee index fc086d6ac..bc21ccc7a 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee @@ -113,6 +113,23 @@ class App.DashboardTicket extends App.Controller attribute.data = id: refObject.id value + callbackPriorityIconHeader = (header) -> + attribute = + name: 'priority_icon' + display: '' + translation: false + style: 'width: 28px' + header.unshift(0) + header[0] = attribute + header + callbackPriorityIcon = (value, object, attribute, header, refObject) -> + value = ' ' + attribute.class = 'priority icon' + if object && object.priority_id + attribute.class += " level-#{object.priority_id}" + attribute.link = '' + attribute.title = App.i18n.translateInline( object.priority.displayName() ) + value new App.ControllerTable( overview: @overview.view.d @@ -121,10 +138,13 @@ class App.DashboardTicket extends App.Controller objects: @tickets_in_table, checkbox: false groupBy: @overview.group_by + callbackHeader: callbackPriorityIconHeader bindRow: events: 'click': openTicket callbackAttributes: + priority_icon: + [ callbackPriorityIcon ] customer_id: [ callbackResetLink, callbackUserPopover ] owner_id: diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 58c8d1c5a..a6c5b620d 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -203,6 +203,23 @@ class Table extends App.ControllerContent @el.find('.bulk-action').addClass('hide') else @el.find('.bulk-action').removeClass('hide') + callbackPriorityIconHeader = (header) -> + attribute = + name: 'priority_icon' + display: '' + translation: false + style: 'width: 28px' + header.unshift(0) + header[0] = attribute + header + callbackPriorityIcon = (value, object, attribute, header, refObject) -> + value = ' ' + attribute.class = 'priority icon' + if object && object.priority_id + attribute.class += " level-#{object.priority_id}" + attribute.link = '' + attribute.title = App.i18n.translateInline( object.priority.displayName() ) + value new App.ControllerTable( overview: @overview.view.s @@ -218,7 +235,10 @@ class Table extends App.ControllerContent # customer_id: # events: # 'mouseover': popOver + callbackHeader: callbackPriorityIconHeader callbackAttributes: + priority_icon: + [ callbackPriorityIcon ] customer_id: [ callbackUserPopover ] owner_id: diff --git a/app/assets/javascripts/app/views/generic/table.jst.eco b/app/assets/javascripts/app/views/generic/table.jst.eco index dbbb1007b..24656e12b 100644 --- a/app/assets/javascripts/app/views/generic/table.jst.eco +++ b/app/assets/javascripts/app/views/generic/table.jst.eco @@ -12,7 +12,6 @@ <% if @radio: %> <% end %> - <% for item in @header: %> style="<%= item.style %>"<% end %>><%- @T( item.display ) %> <% end %> @@ -44,7 +43,7 @@ <% end %> <% end %> <% position++ %> - + <% if @checkbox: %> <% end %> - - - <% if @radio: %> <% end %> diff --git a/app/assets/stylesheets/zzz.css.erb b/app/assets/stylesheets/zzz.css.erb index 1804f6d3f..092c37be3 100644 --- a/app/assets/stylesheets/zzz.css.erb +++ b/app/assets/stylesheets/zzz.css.erb @@ -1600,6 +1600,7 @@ footer { color: #38ae6a; } + .level-1.priority.icon, .level-1 .priority.icon, .level-1.active, .level-1.active .priority.icon:after, @@ -1614,6 +1615,7 @@ footer { color: #f35910; } + .level-2.priority.icon, .level-2 .priority.icon, .level-2.active, .level-2.active .priority.icon:after, @@ -1628,6 +1630,7 @@ footer { color: #faab00; } + .level-3.priority.icon, .level-3 .priority.icon, .level-3.active, .level-3.active .priority.icon:after,