diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 3c3e6a39b..96a048597 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -258,7 +258,7 @@ class App.ControllerForm extends App.Controller # postmaster_match else if attribute.tag is 'postmaster_match' addItem = (key, displayName, el, defaultValue = '') => - itemInput = $("
") + itemInput = $("") # remove on click itemInput.find('.remove').bind('click', (e) -> @@ -307,11 +307,104 @@ class App.ControllerForm extends App.Controller value: 'body' name: 'Body' }, - #{ - # value: '-' - # name: '' - # disable: true - #}, + { + value: '' + name: '-' + disable: true + }, + { + value: 'x-any-recipient' + name: 'Any Recipient' + }, + { + value: '' + name: '-' + disable: true + }, + { + value: '' + name: '- ' + App.i18n.translateInline('expert settings') + ' -' + disable: true + }, + { + value: '' + name: '-' + disable: true + }, + { + value: 'x-spam-flag' + name: 'X-Spam-Flag' + }, + { + value: 'x-spam-level' + name: 'X-Spam-Level' + }, + { + value: 'x-spam-score' + name: 'X-Spam-Score' + }, + { + value: 'x-spam-status' + name: 'X-Spam-Status' + }, + { + value: 'importance' + name: 'Importance' + }, + { + value: 'x-priority' + name: 'X-Priority' + }, + + { + value: 'organization' + name: 'Organization' + }, + + { + value: 'x-original-to' + name: 'X-Original-To' + }, + { + value: 'delivered-to' + name: 'Delivered-To' + }, + { + value: 'envelope-to' + name: 'Envelope-To' + }, + { + value: 'delivered-to' + name: 'Delivered-To' + }, + { + value: 'return-path' + name: 'Return-Path' + }, + { + value: 'mailing-list' + name: 'Mailing-List' + }, + { + value: 'list-id' + name: 'List-Id' + }, + { + value: 'list-archive' + name: 'List-Archive' + }, + { + value: 'mailing-list' + name: 'Mailing-List' + }, + { + value: 'auto-submitted' + name: 'Auto-Submitted' + }, + { + value: 'x-loop' + name: 'X-Loop' + }, ] for listItem in loopData listItem.value = "#{ attribute.name }::#{listItem.value}" @@ -339,7 +432,7 @@ class App.ControllerForm extends App.Controller # postmaster_set else if attribute.tag is 'postmaster_set' addItem = (key, displayName, el, defaultValue = '') => - itemInput = $("") + itemInput = $("") # remove on click itemInput.find('.remove').bind('click', (e) -> @@ -369,31 +462,6 @@ class App.ControllerForm extends App.Controller # select shown attributes loopData = [ - { - value: 'from' - name: 'From' - }, - { - value: 'to' - name: 'To' - }, - { - value: 'cc' - name: 'Cc' - }, - { - value: 'subject' - name: 'Subject' - }, - { - value: 'body' - name: 'Body' - }, - { - value: '' - name: '-' - disable: true - }, { value: 'x-zammad-ticket-priority' name: 'Ticket Priority' diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee index db112f866..611a00964 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -101,7 +101,6 @@ class App.ControllerGenericEdit extends App.ControllerModal class App.ControllerGenericIndex extends App.Controller events: 'click [data-type=edit]': 'edit' - 'click [data-type=destroy]': 'destroy' 'click [data-type=new]': 'new' constructor: -> @@ -195,13 +194,6 @@ class App.ControllerGenericIndex extends App.Controller genericObject: @genericObject ) - destroy: (e) -> - e.preventDefault() - item = $(e.target).item( App[ @genericObject ] ) - new DestroyConfirm( - item: item - ) - new: (e) -> e.preventDefault() new App.ControllerGenericNew( @@ -209,7 +201,7 @@ class App.ControllerGenericIndex extends App.Controller genericObject: @genericObject ) -class DestroyConfirm extends App.ControllerModal +class App.ControllerGenericDestroyConfirm extends App.ControllerModal constructor: -> super @render() diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index 4106ad091..f824bc2e8 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -79,7 +79,7 @@ class App.ControllerTable extends App.Controller header.push { name: row display: row - } + } # collect data of col. types dataTypesForCols = [] @@ -152,6 +152,17 @@ class App.ControllerTable extends App.Controller # convert to jquery object table = $(table) + # bind on delete dialog + if data.model && destroy + table.delegate('[data-type="destroy"]', 'click', (e) -> + e.preventDefault() + itemId = $(e.target).parents('tr').data('id') + item = data.model.find(itemId) + new App.ControllerGenericDestroyConfirm( + item: item + ) + ) + # enable checkbox bulk selection if data.checkbox table.delegate('[name="bulk_all"]', 'click', (e) -> diff --git a/app/assets/javascripts/app/models/channel.js.coffee b/app/assets/javascripts/app/models/channel.js.coffee index 5c3486724..7c460627d 100644 --- a/app/assets/javascripts/app/models/channel.js.coffee +++ b/app/assets/javascripts/app/models/channel.js.coffee @@ -2,3 +2,4 @@ class App.Channel extends App.Model @configure 'Channel', 'adapter', 'area', 'options', 'group_id', 'active', 'updated_at' @extend Spine.Model.Ajax @url: @apiPath + '/channels' + @configure_delete = true \ No newline at end of file diff --git a/app/assets/javascripts/app/models/postmaster_filter.js.coffee b/app/assets/javascripts/app/models/postmaster_filter.js.coffee index 744857193..3476d9b94 100644 --- a/app/assets/javascripts/app/models/postmaster_filter.js.coffee +++ b/app/assets/javascripts/app/models/postmaster_filter.js.coffee @@ -12,6 +12,7 @@ class App.PostmasterFilter extends App.Model { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, ] + @configure_delete = true @configure_overview = [ 'name', ] diff --git a/public/assets/tests/form.js b/public/assets/tests/form.js index 16954acfc..bb756f177 100644 --- a/public/assets/tests/form.js +++ b/public/assets/tests/form.js @@ -386,7 +386,7 @@ test( "form postmaster filter", function() { subject: 'some subject', }, set: { - to: 'some@address', + 'x-zammad-ticket-priority': '3 high', 'x-zammad-ticket-group': 'some group', }, } @@ -411,12 +411,12 @@ test( "form postmaster filter", function() { subject: 'some subject', }, set: { - to: 'some@address', + 'x-zammad-ticket-priority': '3 high', 'x-zammad-ticket-group': 'some group', }, }; deepEqual( params, test_params, 'form param check' ); - el.find('[name="set::to"]').next().click() + el.find('[name="set::x-zammad-ticket-priority"]').next().click() App.Delay.set( function() { test( "form param check after remove click", function() { params = App.ControllerForm.params( el )