Improved shown information.

This commit is contained in:
Martin Edenhofer 2016-02-08 06:57:54 +01:00
parent cbbf34c271
commit 405be36647
2 changed files with 28 additions and 48 deletions

View file

@ -11,56 +11,37 @@ class Index extends App.Controller
render: =>
# matrix
config = {}
config['matrix'] = {}
config['matrix']['create'] = {}
config['matrix']['create']['name'] = 'new Ticket'
config['matrix']['create']['criteria'] = {}
config['matrix']['create']['criteria']['owned_by_me'] = true
config['matrix']['create']['criteria']['owned_by_nobody'] = true
config['matrix']['create']['criteria']['no'] = false
config['matrix']['create']['channel'] = {}
config['matrix']['create']['channel']['email'] = true
config['matrix']['create']['channel']['online'] = false
config['matrix']['update'] = {}
config['matrix']['update']['name'] = 'Ticket update'
config['matrix']['update']['criteria'] = {}
config['matrix']['update']['criteria']['owned_by_me'] = true
config['matrix']['update']['criteria']['owned_by_nobody'] = false
config['matrix']['update']['criteria']['no'] = false
config['matrix']['update']['channel'] = {}
config['matrix']['update']['channel']['email'] = true
config['matrix']['update']['channel']['online'] = false
config['matrix']['move_into'] = {}
config['matrix']['move_into']['name'] = 'Ticket moved into my group'
config['matrix']['move_into']['criteria'] = {}
config['matrix']['move_into']['criteria']['owned_by_me'] = true
config['matrix']['move_into']['criteria']['owned_by_nobody'] = true
config['matrix']['move_into']['criteria']['no'] = false
config['matrix']['move_into']['channel'] = {}
config['matrix']['move_into']['channel']['email'] = true
config['matrix']['move_into']['channel']['online'] = false
config['matrix']['escalation'] = {}
config['matrix']['escalation']['name'] = 'Ticket escalation'
config['matrix']['escalation']['criteria'] = {}
config['matrix']['escalation']['criteria']['owned_by_me'] = true
config['matrix']['escalation']['criteria']['owned_by_nobody'] = true
config['matrix']['escalation']['criteria']['no'] = false
config['matrix']['escalation']['channel'] = {}
config['matrix']['escalation']['channel']['email'] = true
config['matrix']['escalation']['channel']['online'] = false
config =
group_ids: []
matrix:
create:
name: 'new Ticket'
update:
name: 'Ticket update'
reminder_reached:
name: 'Ticket reminder reached'
escalation:
name: 'Ticket escalation'
user_config = @Session.get('preferences').notification_config
if user_config
config = $.extend(true, {}, config, user_config)
console.log('oo', config)
# groups
user_group_config = true
if !user_config || !user_config['group_ids'] || _.isEmpty(user_config['group_ids']) || user_config['group_ids'][0] is '-'
user_group_config = false
groups = []
group_ids = @Session.get('group_ids')
if group_ids
for group_id in group_ids
group = App.Group.find(group_id)
groups.push group
if !user_group_config
if !config['group_ids']
config['group_ids'] = []
config['group_ids'].push group_id.toString()
@html App.view('profile/notification')( groups: groups, config: config )
@ -72,7 +53,6 @@ class Index extends App.Controller
params.notification_config = {}
form_params = @formParam(e.target)
console.log('P',form_params)
for key, value of form_params
if key is 'group_ids'
if typeof value isnt 'object'
@ -110,8 +90,8 @@ class Index extends App.Controller
email: true
online: false
}
console.log('P2',params)
if !params.notification_config.group_ids || _.isEmpty(params.notification_config.group_ids)
params.notification_config.group_ids = ['-']
@formDisable(e)
# get data
@ -127,12 +107,12 @@ class Index extends App.Controller
success: (data, status, xhr) =>
App.User.full(
App.Session.get( 'id' ),
App.Session.get('id'),
=>
App.Event.trigger( 'ui:rerender' )
App.Event.trigger('ui:rerender')
@notify(
type: 'success'
msg: App.i18n.translateContent( 'Successfully!' )
msg: App.i18n.translateContent('Successfully!')
)
,
true
@ -140,10 +120,10 @@ class Index extends App.Controller
error: (xhr, status, error) =>
@render()
data = JSON.parse( xhr.responseText )
data = JSON.parse(xhr.responseText)
@notify(
type: 'error'
msg: App.i18n.translateContent( data.message )
msg: App.i18n.translateContent(data.message)
)
App.Config.set( 'Notifications', { prio: 2600, name: 'Notifications', parent: '#profile', target: '#profile/notifications', role: ['Agent'], controller: Index }, 'NavBarProfile' )

View file

@ -31,7 +31,7 @@
<h3><%- @T( 'Groups' ) %></h3>
<%- @T('For "owned by nobody" and "no criteria" only notify about tickets in theres groups.') %>
<div class="settings-entry">
<table class="table">
<% if @groups: %>