Added delete of channels and postmaster filters.

This commit is contained in:
Martin Edenhofer 2014-06-06 21:48:59 +02:00
parent 965fc4d303
commit fde2c0e43a
6 changed files with 118 additions and 45 deletions

View file

@ -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 = $("<div>#{ displayName }: <input name=\"#{ key }\" type=\"input\" value=\"#{ defaultValue }\" class=\"form-control\"/><a href=\"#\" class=\"glyphicon glyphicon-minus remove\"></a></div>")
itemInput = $("<div>#{ App.i18n.translateInline(displayName) }: <input name=\"#{ key }\" type=\"input\" value=\"#{ defaultValue }\" class=\"form-control\" required/><a href=\"#\" class=\"glyphicon glyphicon-minus remove\"></a></div>")
# 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 = $("<div>#{ displayName }: <input name=\"#{ key }\" type=\"input\" value=\"#{ defaultValue }\" class=\"form-control\"/><a href=\"#\" class=\"glyphicon glyphicon-minus remove\"></a></div>")
itemInput = $("<div>#{ App.i18n.translateInline(displayName) }: <input name=\"#{ key }\" type=\"input\" value=\"#{ defaultValue }\" class=\"form-control\"/><a href=\"#\" class=\"glyphicon glyphicon-minus remove\"></a></div>")
# 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'

View file

@ -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()

View file

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

View file

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

View file

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

View file

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