Set priority icon at runtime.

This commit is contained in:
Martin Edenhofer 2014-07-24 01:03:13 +02:00
parent a4c38873f3
commit 838756e30d
4 changed files with 44 additions and 5 deletions

View file

@ -113,6 +113,23 @@ class App.DashboardTicket extends App.Controller
attribute.data = attribute.data =
id: refObject.id id: refObject.id
value 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( new App.ControllerTable(
overview: @overview.view.d overview: @overview.view.d
@ -121,10 +138,13 @@ class App.DashboardTicket extends App.Controller
objects: @tickets_in_table, objects: @tickets_in_table,
checkbox: false checkbox: false
groupBy: @overview.group_by groupBy: @overview.group_by
callbackHeader: callbackPriorityIconHeader
bindRow: bindRow:
events: events:
'click': openTicket 'click': openTicket
callbackAttributes: callbackAttributes:
priority_icon:
[ callbackPriorityIcon ]
customer_id: customer_id:
[ callbackResetLink, callbackUserPopover ] [ callbackResetLink, callbackUserPopover ]
owner_id: owner_id:

View file

@ -203,6 +203,23 @@ class Table extends App.ControllerContent
@el.find('.bulk-action').addClass('hide') @el.find('.bulk-action').addClass('hide')
else else
@el.find('.bulk-action').removeClass('hide') @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( new App.ControllerTable(
overview: @overview.view.s overview: @overview.view.s
@ -218,7 +235,10 @@ class Table extends App.ControllerContent
# customer_id: # customer_id:
# events: # events:
# 'mouseover': popOver # 'mouseover': popOver
callbackHeader: callbackPriorityIconHeader
callbackAttributes: callbackAttributes:
priority_icon:
[ callbackPriorityIcon ]
customer_id: customer_id:
[ callbackUserPopover ] [ callbackUserPopover ]
owner_id: owner_id:

View file

@ -12,7 +12,6 @@
<% if @radio: %> <% if @radio: %>
<th style="width: 22px"></th> <th style="width: 22px"></th>
<% end %> <% end %>
<th style="width: 28px"></th>
<% for item in @header: %> <% for item in @header: %>
<th <% if item.style: %>style="<%= item.style %>"<% end %>><%- @T( item.display ) %></th> <th <% if item.style: %>style="<%= item.style %>"<% end %>><%- @T( item.display ) %></th>
<% end %> <% end %>
@ -44,7 +43,7 @@
<% end %> <% end %>
<% end %> <% end %>
<% position++ %> <% position++ %>
<tr class="item <% if object.active is false: %>not-active<% end %> level-1" data-id="<%= object.id %>" data-position="<%= position %>" > <tr class="item <% if object.active is false: %>not-active<% end %>" data-id="<%= object.id %>" data-position="<%= position %>" >
<% if @checkbox: %> <% if @checkbox: %>
<td class="no-padding"> <td class="no-padding">
<label class="checkbox-replacement centered"> <label class="checkbox-replacement centered">
@ -53,9 +52,6 @@
</label> </label>
</td> </td>
<% end %> <% end %>
<td class="status">
<span class="priority icon"></span>
</td>
<% if @radio: %> <% if @radio: %>
<td><input type="radio" value="<%= object.id %>" name="radio"/></td> <td><input type="radio" value="<%= object.id %>" name="radio"/></td>
<% end %> <% end %>

View file

@ -1600,6 +1600,7 @@ footer {
color: #38ae6a; color: #38ae6a;
} }
.level-1.priority.icon,
.level-1 .priority.icon, .level-1 .priority.icon,
.level-1.active, .level-1.active,
.level-1.active .priority.icon:after, .level-1.active .priority.icon:after,
@ -1614,6 +1615,7 @@ footer {
color: #f35910; color: #f35910;
} }
.level-2.priority.icon,
.level-2 .priority.icon, .level-2 .priority.icon,
.level-2.active, .level-2.active,
.level-2.active .priority.icon:after, .level-2.active .priority.icon:after,
@ -1628,6 +1630,7 @@ footer {
color: #faab00; color: #faab00;
} }
.level-3.priority.icon,
.level-3 .priority.icon, .level-3 .priority.icon,
.level-3.active, .level-3.active,
.level-3.active .priority.icon:after, .level-3.active .priority.icon:after,