mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 17:22:56 -07:00
139 lines
6.7 KiB
HTML
139 lines
6.7 KiB
HTML
<%!
|
|
from plexpy import helpers
|
|
%>
|
|
% if data:
|
|
<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" id="notification-config-modal-header">Set Config</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<form action="set_notification_config" method="post" class="form" id="set_notification_config" data-parsley-validate>
|
|
<div class="col-md-12">
|
|
% for item in data:
|
|
% if item['input_type'] == 'text' or item['input_type'] == 'number' or item['input_type'] == 'password':
|
|
<div class="form-group">
|
|
<label for="${item['name']}">${item['label']}</label>
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<input type="${item['input_type']}" class="form-control" id="${item['name']}" name="${item['name']}" value="${item['value']}" size="30">
|
|
% if item['name'] == 'osx_notify_app':
|
|
<a href="javascript:void(0)" id="osxnotifyregister">Register</a>
|
|
% endif
|
|
</div>
|
|
</div>
|
|
<p class="help-block">${item['description']}</p>
|
|
</div>
|
|
% elif item['input_type'] == 'button':
|
|
<div class="form-group">
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<input type="${item['input_type']}" class="btn btn-bright" id="${item['name']}" name="${item['name']}" value="${item['value']}">
|
|
</div>
|
|
</div>
|
|
<p class="help-block">${item['description']}</p>
|
|
</div>
|
|
% elif item['input_type'] == 'checkbox':
|
|
<div class="checkbox">
|
|
<label>
|
|
<input type="checkbox" data-id="${item['name']}" class="checkboxes" value="1" ${helpers.checked(item['value'])}> ${item['label']}
|
|
</label>
|
|
<p class="help-block">${item['description']}</p>
|
|
<input type="hidden" id="${item['name']}" name="${item['name']}" value="${item['value']}">
|
|
</div>
|
|
% elif item['input_type'] == 'select':
|
|
<div class="form-group">
|
|
<label for="${item['name']}">${item['label']}</label>
|
|
<div class="row">
|
|
<div class="col-md-5">
|
|
<select class="form-control" id="${item['name']}" name="${item['name']}" >
|
|
% for key, value in sorted(item['select_options'].iteritems()):
|
|
% if key == item['value']:
|
|
<option value="${key}" selected>${value}</option>
|
|
% else:
|
|
<option value="${key}">${value}</option>
|
|
% endif
|
|
% endfor
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<p class="help-block">${item['description']}</p>
|
|
</div>
|
|
% endif
|
|
% endfor
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<%
|
|
nosave = any(d['input_type'] == 'nosave' for d in data)
|
|
%>
|
|
% if not nosave:
|
|
<input type="button" id="save-notification-item" class="btn btn-bright" value="Save">
|
|
% else:
|
|
<input type="button" class="btn btn-bright" data-dismiss="modal" value="Close">
|
|
% endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
% endif
|
|
|
|
<script>
|
|
$('#osxnotifyregister').click(function () {
|
|
var osx_notify_app = $("#osx_notify_app").val();
|
|
$.get("/osxnotifyregister", { 'app': osx_notify_app }, function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
|
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
|
})
|
|
|
|
$('#save-notification-item').click(function() {
|
|
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
|
// Reload modal to update certain fields
|
|
$.ajax({
|
|
url: 'get_notification_agent_config',
|
|
data: { config_id: '${config_id}' },
|
|
cache: false,
|
|
async: true,
|
|
complete: function (xhr, status) {
|
|
$("#notification-config-modal").html(xhr.responseText);
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$('#twitterStep1').click(function () {
|
|
$.get("/twitterStep1", function (data) {window.open(data); })
|
|
.done(function () { $('#ajaxMsg').html("<i class='fa fa-check'></i> Confirm Authorization. Check pop-up blocker if no response."); });
|
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
|
});
|
|
$('#twitterStep2').click(function () {
|
|
var twitter_key = $("#twitter_key").val();
|
|
$.get("/twitterStep2", { 'key': twitter_key }, function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
|
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
|
});
|
|
$('#testTwitter').click(function () {
|
|
$.get("/testTwitter",
|
|
function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
|
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
|
});
|
|
|
|
$('#testIFTTT').click(function () {
|
|
$.get("/test_ifttt",
|
|
function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
|
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
|
});
|
|
|
|
// Never send checkbox values directly, always substitute value in hidden input.
|
|
$('.checkboxes').click(function() {
|
|
var configToggle = $(this).data('id');
|
|
if ($(this).is(":checked")) {
|
|
$("#"+configToggle).val(1);
|
|
} else {
|
|
$("#"+configToggle).val(0);
|
|
}
|
|
});
|
|
</script>
|