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 =
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:

View file

@ -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:

View file

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

View file

@ -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,