mirror of https://github.com/Ombi-app/Ombi
commit
f7a1f34b2f
@ -0,0 +1,99 @@
|
||||
@using Ombi.UI.Helpers
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Ombi.Core.SettingModels.DiscordNotificationSettings>
|
||||
@Html.Partial("Shared/Partial/_Sidebar")
|
||||
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Discord Notifications</legend>
|
||||
|
||||
@Html.Checkbox(Model.Enabled, "Enabled", "Enabled")
|
||||
|
||||
<div class="form-group">
|
||||
<label for="WebhookUrl" class="control-label">Webhook Url</label>
|
||||
<small class="control-label">This is the full webhook url.</small>
|
||||
<small class="control-label"> Discord > Edit Channel > Webhooks > Create Webook > Copy the Webhook Url > Press Save</small>
|
||||
<div class="">
|
||||
<input type="text" class="form-control form-control-custom " id="WebhookUrl" name="WebhookUrl" value="@Model.WebhookUrl">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username Override</label>
|
||||
<small class="control-label">You can override the default username</small>
|
||||
<div class="">
|
||||
<input type="text" class="form-control form-control-custom " id="Username" name="Username" value="@Model.Username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="testDiscord" type="submit" class="btn btn-primary-outline">Test <div id="spinner"></div></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="save" type="submit" class="btn btn-primary-outline">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
$('#save').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('#spinner').attr("class", "fa fa-spinner fa-spin");
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: $form.prop("action"),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
$('#spinner').attr("class", "fa fa-check");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#testDiscord').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var url = createBaseUrl(base, '/admin/testdiscordnotification');
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Reference in new issue