Reworked function of profile notification settings.

This commit is contained in:
Martin Edenhofer 2016-02-08 22:38:52 +01:00
parent 1835bd3233
commit 6d43806e86
2 changed files with 22 additions and 13 deletions

View file

@ -80,16 +80,25 @@ class Index extends App.Controller
params.notification_config[area[0]] = {}
if !params.notification_config[area[0]][area[1]]
params.notification_config[area[0]][area[1]] = {}
if value is 'online'
params.notification_config[area[0]][area[1]][area[2]] = {
email: false
online: true
}
else
if value is 'email'
params.notification_config[area[0]][area[1]][area[2]] = {
email: true
online: true
}
# validation
if !params['notification_config']['matrix']
@log('error', 'invalid notification_config, matrix is missing')
return
# check missing channels
for key, value of params['notification_config']['matrix']
if !value.channel
value.channel = {
email: false
online: true
}
if !params.notification_config.group_ids || _.isEmpty(params.notification_config.group_ids)
params.notification_config.group_ids = ['-']
@formDisable(e)

View file

@ -10,16 +10,16 @@
<tr>
<th>
<th><%- @T('My Tickets') %>
<th><%- @T('Not Assigned') %>
<th><%- @T('All Tickets') %>
<th class="settings-list-separator"><%- @T('Email Notification') %>
<th><%- @T('Not Assigned') %> *
<th><%- @T('All Tickets') %> *
<th class="settings-list-separator"><%- @T('Notify also via Email') %>
</thead>
<tbody>
<% if @config.matrix: %>
<% for key, value of @config.matrix: %>
<tr>
<td>
<%= value.name %>
<%- @T(value.name) %>
<td class="u-positionOrigin">
<label class="checkbox-replacement checkbox-replacement--fullscreen">
<input type="checkbox" name="matrix.<%= key %>.criteria.owned_by_me" value="true" <% if value.criteria.owned_by_me: %>checked<% end %>/>
@ -40,7 +40,7 @@
</label>
<td class="u-positionOrigin settings-list-separator">
<label class="checkbox-replacement checkbox-replacement--fullscreen">
<input type="checkbox" name="matrix.<%= key %>.channel" value="email" <% if value.channel.email: %>checked<% end %>/>
<input type="checkbox" name="matrix.<%= key %>.channel" value="email" <% if value.channel && value.channel.email: %>checked<% end %>/>
<%- @Icon('checkbox', 'icon-unchecked') %>
<%- @Icon('checkbox-checked', 'icon-checked') %>
</label>
@ -51,13 +51,13 @@
</div>
<% if @groups: %>
<h2><%- @T( 'Limit Groups' ) %></h2>
<h2>* <%- @T( 'Limit Groups' ) %></h2>
<div class="settings-entry">
<table class="settings-list">
<thead>
<tr>
<th><%- @T('Group') %>
<th><%- @T('Not Assigned & All Tickets') %>
<th><%- @T('Not Assigned') %> & <%- @T('All Tickets') %>
</thead>
<tbody>
<% for group in @groups: %>