diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index feec4f102..2ac480a80 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -124,16 +124,11 @@ class App.Controller extends Spine.Controller dataTypesForCols = data.overview_extended # generate content data - objects = _.clone( data.objects ) - for object in objects + for object in data.objects # check if info for each col. is already there for row in dataTypesForCols - # execute callback on content - if row.callback - object[row.name] = row.callback( object[row.name] ) - # lookup relation if !object[row.name] rowWithoutId = row.name + '_id' @@ -143,11 +138,11 @@ class App.Controller extends Spine.Controller record = App.Collection.find( attribute.relation, object[rowWithoutId] ) object[row.name] = record.name - @log 'table', 'header', header, 'overview', dataTypesForCols, 'objects', objects + @log 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects table = App.view('generic/table')( header: header, overview: dataTypesForCols, - objects: objects, + objects: data.objects, checkbox: data.checkbox, ) # @log 'ttt', $(table).find('span') diff --git a/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee index ebdcf644b..9c3b87860 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee @@ -4,7 +4,7 @@ class Index extends App.Controller events: 'click [data-type=edit]': 'zoom' 'click [data-type=settings]': 'settings' - 'click [data-type=view-mode]': 'view_mode' + 'click [data-type=viewmode]': 'viewmode' 'click [data-type=page]': 'page' constructor: -> @@ -13,8 +13,8 @@ class Index extends App.Controller # check authentication return if !@authenticate() - @log 'view:', @view @view_mode = localStorage.getItem( "mode:#{@view}" ) || 's' + @log 'view:', @view, @view_mode # set title @title '' @@ -99,6 +99,10 @@ class Index extends App.Controller pages_total = parseInt( ( @tickets_count / @overview.view[@view_mode].per_page ) + 0.99999 ) || 1 # render init page + edit = true + if @isRole('Customer') + checkbox = false + edit = false view_modes = [ { name: 'S', @@ -117,6 +121,7 @@ class Index extends App.Controller pages_total: pages_total, start_page: @start_page, checkbox: true, + edit: edit, ) html = $(html) # html.find('li').removeClass('active') @@ -125,10 +130,6 @@ class Index extends App.Controller # create table/overview checkbox = true - edit = true - if @isRole('Customer') - checkbox = false - edit = false table = '' if @view_mode is 'm' table = App.view('agent_ticket_view/detail')( @@ -150,7 +151,6 @@ class Index extends App.Controller model: App.Ticket, objects: @ticket_list_show, checkbox: checkbox, - edit: edit, ) # append content table @@ -183,12 +183,12 @@ class Index extends App.Controller @start_page = id @fetch() - view_mode: (e) => + viewmode: (e) => e.preventDefault() @start_page = 1 - id = $(e.target).data('mode') - @view_mode = id - localStorage.setItem( "mode:#{@view}", id ) + mode = $(e.target).data('mode') + @view_mode = mode + localStorage.setItem( "mode:#{@view}", mode ) @fetch() @render() @@ -373,9 +373,12 @@ class Settings extends App.ControllerModal # item_class: 'keepleft', # }, ] - form = @formGen( model: { configure_attributes: @configure_attributes_article } ) - @el.find('.setting').append(form) + new App.ControllerForm( + el: @el.find('#form-setting'), + model: { configure_attributes: @configure_attributes_article }, + autofocus: false, + ) @modalShow() diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index 665d181fc..b60dc7563 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -39,17 +39,23 @@ class App extends Spine.Controller template = ( params = {} ) => # define print name helper - params.P = ( item ) -> + params.P = ( item, row = {} ) -> return item if !item + + # if date is a object, get name of the object if typeof item is 'object' if item.displayNameLong - item.displayNameLong() + return item.displayNameLong() else if item.displayName - item.displayName() - else - item.name - else - item + return item.displayName() + return item.name + + # execute callback on content + if row.callback + return row.callback( item ) + + # return raw data + item # define translation helper params.T = ( item ) -> diff --git a/app/assets/javascripts/app/views/agent_ticket_view.jst.eco b/app/assets/javascripts/app/views/agent_ticket_view.jst.eco index 4e6c80012..94b82b820 100644 --- a/app/assets/javascripts/app/views/agent_ticket_view.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_view.jst.eco @@ -8,7 +8,7 @@
- - | -- - | -
+ + | ++ + | +
+ <%= ticket.title %> <%= ticket.number %> ?+
+
+
+ <%- @T( 'State' ) %> <%- @T( ticket.ticket_state.name ) %>
+
+
+ <%- @T( 'Group' ) %> <%= ticket.group.name %>
+
+
+ <%- @T( 'Customer' ) %> <%= ticket.customer.displayName() %>
+
+
+
+
+
+ <%- @T( 'Priority' ) %> <%- @T( ticket.ticket_priority.name ) %>
+
+
+ <%- @T( 'Owner' ) %> <%= ticket.owner.displayName() %>
+
+
+ <%- @T( 'Organization' ) %> <%= ticket.customer.organization.name %>
+
+ |
+