From 08bacb77d9869accbf95a138366efb51fd9a5742 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 28 Sep 2016 15:22:29 +0200 Subject: [PATCH] Moved to naive sort order of ticket attributes. --- .../_application_controller_generic.coffee | 12 +++++----- .../checkboxTicketAttributes.coffee | 24 ++++++++----------- .../_ui_element/selectTicketAttributes.coffee | 24 ++++++++----------- .../app/models/_application_model.coffee | 2 +- .../javascripts/app/models/ticket.coffee | 4 ++-- db/seeds.rb | 7 ------ 6 files changed, 29 insertions(+), 44 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee index a216e625d..883ac4451 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee @@ -169,14 +169,14 @@ class App.ControllerGenericIndex extends App.Controller # append content table params = _.extend( { - el: @$('.table-overview') - model: App[ @genericObject ] - objects: objects + el: @$('.table-overview') + model: App[ @genericObject ] + objects: objects bindRow: events: - 'click': @edit + click: @edit container: @container - explanation: @pageData.explanation or 'none' + explanation: @pageData.explanation groupBy: @groupBy dndCallback: @dndCallback }, @@ -504,7 +504,7 @@ class App.ControllerNavSidbar extends App.Controller return if !position if position.main @$('.main').scrollTop(position.main) - if position.main + if position.sidebar @$('.sidebar').scrollTop(position.sidebar) currentPosition: => diff --git a/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee b/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee index 608a2f0fc..865018749 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee @@ -2,12 +2,8 @@ class App.UiElement.checkboxTicketAttributes extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> - configureAttributes = App.Ticket.configure_attributes - for row, localAttribute of App.Ticket.attributesGet() - configureAttributes.push localAttribute attributeOptionsArray = [] - attributeOptions = {} - for row in configureAttributes + for name, row of App.Ticket.attributesGet() # ignore passwords if row.type isnt 'password' && row.type isnt 'tag' && row.name isnt 'tags' @@ -19,14 +15,14 @@ class App.UiElement.checkboxTicketAttributes extends App.UiElement.ApplicationUi else if row.name.substr(row.name.length-3,3) is '_id' nameTmp = row.name.substr(0, row.name.length-3) - if !attributeOptions[ nameTmp ] - attributeOptions[ nameTmp ] = row.display - attributeOptionsArray.push( - { - value: nameTmp - name: row.display - } - ) + attributeOptionsArray.push( + { + value: nameTmp + name: row.display + } + ) + + attribute.sortBy = null attribute.item_class = 'checkbox' - attribute.options = attributeOptions + attribute.options = attributeOptionsArray App.UiElement.checkbox.render(attribute, params) diff --git a/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee b/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee index 47b3284c8..3a2276746 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee @@ -2,12 +2,8 @@ class App.UiElement.selectTicketAttributes extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> - configureAttributes = App.Ticket.configure_attributes - for row, localAttribute of App.Ticket.attributesGet() - configureAttributes.push localAttribute attributeOptionsArray = [] - attributeOptions = {} - for row in configureAttributes + for name, row of App.Ticket.attributesGet() # ignore passwords if row.type isnt 'password' && row.type isnt 'tag' && row.name isnt 'tags' @@ -19,13 +15,13 @@ class App.UiElement.selectTicketAttributes extends App.UiElement.ApplicationUiEl else if row.name.substr(row.name.length-3,3) is '_id' nameTmp = row.name.substr(0, row.name.length-3) - if !attributeOptions[ nameTmp ] - attributeOptions[ nameTmp ] = row.display - attributeOptionsArray.push( - { - value: nameTmp - name: row.display - } - ) - attribute.options = attributeOptions + attributeOptionsArray.push( + { + value: nameTmp + name: row.display + } + ) + + attribute.sortBy = null + attribute.options = attributeOptionsArray App.UiElement.select.render(attribute, params) diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index 373c828bc..ff1667e39 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -576,7 +576,7 @@ class App.Model extends Spine.Model # lookup relations if attribute.relation - # relations if if not calling object, to prevent loops + # relations - not calling object it self, to prevent loops if !_.contains(classNames, @className) # only if relation model exists diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index 124c134e8..32ba6f7c3 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -10,7 +10,7 @@ class App.Ticket extends App.Model { name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, relation: 'Group', width: '10%', edit: true }, { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, relation: 'User', width: '12%', edit: true }, { name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', width: '12%', edit: true, customer: true }, - { name: 'pending_time', display: 'Pending Time', tag: 'datetime', null: true, width: '130px' }, + { name: 'pending_time', display: 'Pending till', tag: 'datetime', null: true, width: '130px' }, { name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', width: '12%', edit: true, customer: true }, { name: 'article_count', display: 'Article#', readonly: 1, width: '12%' }, { name: 'escalation_at', display: 'Escalation', tag: 'datetime', null: true, readonly: 1, width: '110px', class: 'escalation' }, @@ -26,7 +26,7 @@ class App.Ticket extends App.Model ] uiUrl: -> - '#ticket/zoom/' + @id + "#ticket/zoom/#{@id}" getState: -> type = App.TicketState.find(@state_id) diff --git a/db/seeds.rb b/db/seeds.rb index 0e6521110..8cdf2fd26 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -2690,13 +2690,6 @@ Permission.create_if_not_exists( translations: ['Channel - Formular'] }, ) -Permission.create_if_not_exists( - name: 'admin.channel_web', - note: 'Manage %s', - preferences: { - translations: ['Channel - Web'] - }, -) Permission.create_if_not_exists( name: 'admin.channel_email', note: 'Manage %s',