Improved table overviews.
This commit is contained in:
parent
d0a0ebdbc5
commit
5bfccfd058
9 changed files with 65 additions and 43 deletions
|
@ -82,17 +82,24 @@ class App.Controller extends Spine.Controller
|
|||
header = data.header
|
||||
|
||||
# define normal header
|
||||
if !header
|
||||
if header
|
||||
header_new = []
|
||||
for key in header
|
||||
header_new.push {
|
||||
display: key
|
||||
}
|
||||
header = header_new
|
||||
else if !data.overview_extended
|
||||
header = []
|
||||
for row in overview
|
||||
if attributes
|
||||
for attribute in attributes
|
||||
if row is attribute.name
|
||||
header.push( attribute.display )
|
||||
header.push attribute
|
||||
else
|
||||
rowWithoutId = row + '_id'
|
||||
if rowWithoutId is attribute.name
|
||||
header.push( attribute.display )
|
||||
header.push attribute
|
||||
|
||||
dataTypesForCols = []
|
||||
for row in overview
|
||||
|
@ -103,16 +110,18 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
# extended table format
|
||||
if data.overview_extended
|
||||
@log 'ggggggg', data.overview_extended
|
||||
if !header
|
||||
@log 'ggggggg222', data.overview_extended
|
||||
header = []
|
||||
for row in data.overview_extended
|
||||
for attribute in attributes
|
||||
if row.name is attribute.name
|
||||
header.push( attribute.display )
|
||||
header.push attribute
|
||||
else
|
||||
rowWithoutId = row.name + '_id'
|
||||
if rowWithoutId is attribute.name
|
||||
header.push( attribute.display )
|
||||
header.push attribute
|
||||
|
||||
dataTypesForCols = data.overview_extended
|
||||
|
||||
|
@ -164,12 +173,12 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
ticketTableAttributes: (attributes) =>
|
||||
all_attributes = [
|
||||
{ name: 'number', link: true },
|
||||
{ name: 'title', link: true },
|
||||
{ name: 'number', link: true, title: 'title' },
|
||||
{ name: 'title', link: true, title: 'title' },
|
||||
{ name: 'customer', class: 'user-data', data: { id: true } },
|
||||
{ name: 'ticket_state', translate: true },
|
||||
{ name: 'ticket_priority', translate: true },
|
||||
{ name: 'group' },
|
||||
{ name: 'ticket_state', translate: true, title: true },
|
||||
{ name: 'ticket_priority', translate: true, title: true },
|
||||
{ name: 'group', title: 'group' },
|
||||
{ name: 'owner', class: 'user-data', data: { id: true } },
|
||||
{ name: 'created_at', callback: @frontendTime },
|
||||
{ name: 'last_contact', callback: @frontendTime },
|
||||
|
|
|
@ -118,8 +118,7 @@ class App.ChannelEmailFilterEdit extends App.ControllerModal
|
|||
|
||||
# validate form
|
||||
errors = @form.validate( params )
|
||||
@log '11111', params, errors
|
||||
# return false
|
||||
|
||||
# show errors in form
|
||||
if errors
|
||||
@log 'error new', errors
|
||||
|
@ -335,7 +334,7 @@ class App.ChannelEmailInbound extends App.Controller
|
|||
|
||||
render: =>
|
||||
channels = App.Channel.all()
|
||||
@log 'llllll', channels
|
||||
|
||||
html = $('<div></div>')
|
||||
data = []
|
||||
for channel in channels
|
||||
|
@ -343,7 +342,6 @@ class App.ChannelEmailInbound extends App.Controller
|
|||
channel.host = channel.options['host']
|
||||
channel.user = channel.options['user']
|
||||
data.push channel
|
||||
@log 'llllll222', data
|
||||
|
||||
table = @table(
|
||||
header: ['Host', 'User', 'Adapter', 'Active'],
|
||||
|
|
|
@ -16,5 +16,4 @@ class App.Group extends App.Model
|
|||
]
|
||||
@configure_overview = [
|
||||
'name',
|
||||
'active'
|
||||
]
|
||||
|
|
|
@ -12,5 +12,4 @@ class App.Organization extends App.Model
|
|||
@configure_overview = [
|
||||
'name',
|
||||
'shared',
|
||||
'active',
|
||||
]
|
||||
|
|
|
@ -13,5 +13,5 @@ class App.PostmasterFilter extends App.Model
|
|||
{ name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
||||
]
|
||||
@configure_overview = [
|
||||
'name', 'active'
|
||||
'name',
|
||||
]
|
||||
|
|
|
@ -3,17 +3,17 @@ class App.Ticket extends App.Model
|
|||
@extend Spine.Model.Ajax
|
||||
@url: '/api/tickets'
|
||||
@configure_attributes = [
|
||||
{ name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, read_only: true },
|
||||
{ name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, read_only: true, style: 'width: 8%' },
|
||||
{ name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '<a href="" class="customer_new">»</a>' },
|
||||
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, class: 'span8', relation: 'Group', },
|
||||
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, class: 'span8', relation: 'User', },
|
||||
{ name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },
|
||||
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', class: 'medium' },
|
||||
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', class: 'medium' },
|
||||
{ name: 'created_at', display: 'Created', tag: 'time', },
|
||||
{ name: 'last_contact', display: 'Last contact', tag: 'time', null: true },
|
||||
{ name: 'last_contact_agent', display: 'Last contact (Agent)', tag: 'time', null: true },
|
||||
{ name: 'last_contact_customer', display: 'Last contact (Customer)', tag: 'time', null: true },
|
||||
{ name: 'first_response', display: 'First response', tag: 'time', null: true },
|
||||
{ name: 'close_time', display: 'Close time', tag: 'time', null: true },
|
||||
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, class: 'span8', relation: 'Group', style: 'width: 10%' },
|
||||
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, class: 'span8', relation: 'User', style: 'width: 12%' },
|
||||
{ name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8' },
|
||||
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', class: 'medium', style: 'width: 12%' },
|
||||
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', class: 'medium', style: 'width: 12%' },
|
||||
{ name: 'created_at', display: 'Created', tag: 'time', style: 'width: 12%' },
|
||||
{ name: 'last_contact', display: 'Last contact', tag: 'time', null: true, style: 'width: 12%' },
|
||||
{ name: 'last_contact_agent', display: 'Last contact (Agent)', tag: 'time', null: true, style: 'width: 12%' },
|
||||
{ name: 'last_contact_customer', display: 'Last contact (Customer)', tag: 'time', null: true, style: 'width: 12%' },
|
||||
{ name: 'first_response', display: 'First response', tag: 'time', null: true, style: 'width: 12%' },
|
||||
{ name: 'close_time', display: 'Close time', tag: 'time', null: true, style: 'width: 12%' },
|
||||
]
|
|
@ -26,5 +26,5 @@ class App.User extends App.Model
|
|||
]
|
||||
@configure_overview = [
|
||||
# 'login', 'firstname', 'lastname', 'email', 'updated_at',
|
||||
'login', 'firstname', 'lastname', 'active',
|
||||
'login', 'firstname', 'lastname',
|
||||
]
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if @checkbox: %>
|
||||
<th><input type="checkbox" value="" name="bulk_all"/></th>
|
||||
<th style="width: 10px"><input type="checkbox" value="" name="bulk_all"/></th>
|
||||
<% end %>
|
||||
<% for row in @header: %>
|
||||
<th><%- T(row) %></th>
|
||||
<th <% if row.style: %>style="<%= row.style %>"<% end %>><%- T(row.display) %></th>
|
||||
<% end %>
|
||||
<!--
|
||||
<th>Destory</th>
|
||||
|
@ -22,19 +22,26 @@
|
|||
<input type="checkbox" value="<%= object.id %>" name="bulk"/>
|
||||
</td>
|
||||
<% end %>
|
||||
<% for row in @overview: %>
|
||||
<% displayName = '' %>
|
||||
<% if typeof object[row.name] is 'object': %>
|
||||
<% displayName = object[row.name].displayNameLong() %>
|
||||
<% else: %>
|
||||
<% displayName = object[row.name] %>
|
||||
<% end %>
|
||||
<td>
|
||||
<% if row.link: %>
|
||||
<a href="#" data-type="edit"><%= displayName %></a>
|
||||
<% for row in @overview: %>
|
||||
<% displayName = '' %>
|
||||
<% if typeof object[row.name] is 'object': %>
|
||||
<% displayName = object[row.name].displayNameLong() %>
|
||||
<% else: %>
|
||||
<span <% if row.class: %>class="<%= row.class %>"<% end %> <% if row.data && row.data.id: %>data-id="<%= object[row.name].id %>"<% end %>><% if row.translate: %><%- T(displayName) %><% else if row.callback: %><%- displayName %><% else: %><%= displayName %><% end %></span>
|
||||
<% displayName = object[row.name] %>
|
||||
<% end %>
|
||||
<% if row.translate: %><% displayName = T(displayName) %><% end %>
|
||||
<% displayNameTitle = displayName %>
|
||||
<% if row.title && object[row.title]: %>
|
||||
<% if typeof object[row.title] is 'object': %>
|
||||
<% displayNameTitle = object[row.title].displayNameLong() %>
|
||||
<% else: %>
|
||||
<% displayNameTitle = object[row.title] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td <% if row.title: %>title="<%= displayNameTitle %>"<% end %>>
|
||||
<% if row.link: %><a href="#" data-type="edit"><% else: %><span <% if row.class: %>class="<%= row.class %>"<% end %> <% if row.data && row.data.id: %>data-id="<%= object[row.name].id %>"<% end %>><% end %>
|
||||
<% if row.translate || row.callback: %><%- displayName %><% else: %><%= displayName %><% end %>
|
||||
<% if row.link: %></a><% else: %></span><% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
<!--
|
||||
|
|
|
@ -17,6 +17,16 @@ label, input, button, select, textarea {
|
|||
display: none;
|
||||
}
|
||||
|
||||
table {
|
||||
table-layout: fixed;
|
||||
|
||||
}
|
||||
table th, table td {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/*
|
||||
#content > *:not(.active) {
|
||||
display: none !important;
|
||||
|
|
Loading…
Reference in a new issue