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]] = {} params.notification_config[area[0]] = {}
if !params.notification_config[area[0]][area[1]] if !params.notification_config[area[0]][area[1]]
params.notification_config[area[0]][area[1]] = {} params.notification_config[area[0]][area[1]] = {}
if value is 'online' if value is 'email'
params.notification_config[area[0]][area[1]][area[2]] = {
email: false
online: true
}
else
params.notification_config[area[0]][area[1]][area[2]] = { params.notification_config[area[0]][area[1]][area[2]] = {
email: true email: true
online: 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) if !params.notification_config.group_ids || _.isEmpty(params.notification_config.group_ids)
params.notification_config.group_ids = ['-'] params.notification_config.group_ids = ['-']
@formDisable(e) @formDisable(e)

View file

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