mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 01:02:59 -07:00
Add notifier text preview
This commit is contained in:
parent
cb5252b8d4
commit
d874697eef
6 changed files with 91 additions and 4 deletions
|
@ -151,6 +151,13 @@
|
|||
<input class="form-control" type="text" id="${action['name']}_subject" name="${action['name']}_subject" value="${notifier['notify_text'][action['name']]['subject']}" data-parsley-trigger="change" required>
|
||||
<p class="help-block">Set custom arguments passed to the script.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<input type="button" class="btn btn-bright notifier-text-preview" data-action="${action['name']}" value="Preview Arguments">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -171,6 +178,13 @@
|
|||
<textarea class="form-control" id="${action['name']}_body" name="${action['name']}_body" data-parsley-trigger="change" data-autoresize required>${notifier['notify_text'][action['name']]['body']}</textarea>
|
||||
<p class="help-block">Set a custom body.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<input type="button" class="btn btn-bright notifier-text-preview" data-action="${action['name']}" value="Preview Text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -335,6 +349,28 @@
|
|||
})
|
||||
% endif
|
||||
|
||||
$('.notifier-text-preview').click(function () {
|
||||
var action = $(this).data('action');
|
||||
var subject = $('#' + action + '_subject').val();
|
||||
var body = $('#' + action + '_body').val();
|
||||
|
||||
$.ajax({
|
||||
url: 'get_notify_text_preview',
|
||||
data: {
|
||||
notify_action: action,
|
||||
subject: subject,
|
||||
body: body,
|
||||
agent_id: "${notifier['agent_id']}",
|
||||
agent_name: "${notifier['agent_name']}"
|
||||
},
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function (xhr, status) {
|
||||
$("#notifier-text-preview-modal").html(xhr.responseText).modal('show');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#test_notifier').click(function () {
|
||||
doAjaxCall('set_notifier_config', $(this), 'tabs', true, false, sendTestNotification);
|
||||
});
|
||||
|
|
23
data/interfaces/default/notifier_text_preview.html
Normal file
23
data/interfaces/default/notifier_text_preview.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
% if text:
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
||||
<h4 class="modal-title">Notification Text Preview</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
% for item in text:
|
||||
<div style="padding-bottom: 10px;">
|
||||
<h4>${item['media_type'].capitalize()}</h4>
|
||||
<pre>${item['subject']}</pre>
|
||||
% if agent != 'scripts':
|
||||
<pre>${item['body']}</pre>
|
||||
% endif
|
||||
</div>
|
||||
% endfor
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
|
@ -1925,6 +1925,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="notifier-text-preview-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="notifier-text-preview-modal">
|
||||
</div>
|
||||
<div id="changelog-modal" class="modal fade wide" tabindex="-1" role="dialog" aria-labelledby="changelog-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue