mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Move the JS alert
function definition to /js/alert.js
and move the alert div to views/layout.ecr
This commit is contained in:
parent
d50804830d
commit
8fbc5528a8
6
public/js/alert.js
Normal file
6
public/js/alert.js
Normal file
@ -0,0 +1,6 @@
|
||||
const alert = (level, text) => {
|
||||
$('#alert').empty();
|
||||
const html = `<div class="uk-alert-${level}" uk-alert><a class="uk-alert-close" uk-close></a><p>${text}</p></div>`;
|
||||
$('#alert').append(html);
|
||||
$("html, body").animate({ scrollTop: 0 });
|
||||
};
|
@ -286,12 +286,3 @@ const buildTable = () => {
|
||||
});
|
||||
$('#selection-controls').removeAttr('hidden');
|
||||
};
|
||||
const alert = (level, text) => {
|
||||
hideAlert();
|
||||
const html = '<div class="uk-alert-' + level + '" uk-alert><a class="uk-alert-close" uk-close></a><p>' + text + '</p></div>';
|
||||
$('#alert').append(html);
|
||||
$("html, body").animate({ scrollTop: 0 });
|
||||
};
|
||||
const hideAlert = () => {
|
||||
$('#alert').empty();
|
||||
};
|
||||
|
@ -42,11 +42,3 @@ function updateProgress(titleID, entryID, page) {
|
||||
}
|
||||
});
|
||||
}
|
||||
function alert(level, text) {
|
||||
hideAlert();
|
||||
var html = '<div class="uk-alert-' + level + '" uk-alert><a class="uk-alert-close" uk-close></a><p>' + text + '</p></div>';
|
||||
$('#alert').append(html);
|
||||
}
|
||||
function hideAlert() {
|
||||
$('#alert').empty();
|
||||
}
|
||||
|
@ -1,16 +1,6 @@
|
||||
$(function(){
|
||||
$(() => {
|
||||
var target = '/admin/user/edit';
|
||||
if (username) target += username;
|
||||
$('form').attr('action', target);
|
||||
|
||||
function alert(level, text) {
|
||||
hideAlert();
|
||||
var html = '<div class="uk-alert-' + level + '" uk-alert><a class="uk-alert-close" uk-close></a><p>' + text + '</p></div>';
|
||||
$('#alert').append(html);
|
||||
}
|
||||
function hideAlert() {
|
||||
$('#alert').empty();
|
||||
}
|
||||
|
||||
if (error) alert('danger', error);
|
||||
});
|
||||
|
@ -1,11 +1,3 @@
|
||||
function alert(level, text) {
|
||||
hideAlert();
|
||||
var html = '<div class="uk-alert-' + level + '" uk-alert><a class="uk-alert-close" uk-close></a><p>' + text + '</p></div>';
|
||||
$('#alert').append(html);
|
||||
}
|
||||
function hideAlert() {
|
||||
$('#alert').empty();
|
||||
}
|
||||
function remove(username) {
|
||||
$.post('/api/admin/user/delete/' + username, function(data) {
|
||||
if (data.success) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
<div id="alert"></div>
|
||||
<h2 class=uk-title>Download from MangaDex</h2>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-3-4">
|
||||
@ -79,5 +78,6 @@
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
||||
<script src="/js/alert.js"></script>
|
||||
<script src="/js/download.js"></script>
|
||||
<% end %>
|
||||
|
@ -50,6 +50,7 @@
|
||||
</div>
|
||||
<div class="uk-section uk-section-default uk-section-small">
|
||||
<div class="uk-container uk-container-small">
|
||||
<div id="alert"></div>
|
||||
<%= content %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,3 @@
|
||||
<div id="alert"></div>
|
||||
<h2 class=uk-title><%= title.title %></h2>
|
||||
<p class="uk-text-meta"><%= title.entries.size %> entries found</p>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
@ -63,6 +62,7 @@
|
||||
</div>
|
||||
|
||||
<% content_for "script" do %>
|
||||
<script src="/js/alert.js"></script>
|
||||
<script src="/js/title.js"></script>
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/sort-items.js"></script>
|
||||
|
@ -1,5 +1,3 @@
|
||||
<div id="alert"></div>
|
||||
|
||||
<form action="/admin/user/edit" method="post" accept-charset="utf-8">
|
||||
|
||||
<div class="uk-margin">
|
||||
@ -51,5 +49,6 @@
|
||||
error = '<%= error %>';
|
||||
<%- end -%>
|
||||
</script>
|
||||
<script src="/js/alert.js"></script>
|
||||
<script src="/js/user-edit.js"></script>
|
||||
<% end %>
|
||||
|
@ -1,4 +1,3 @@
|
||||
<div id="alert"></div>
|
||||
<table class="uk-table uk-table-divider">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -27,5 +26,6 @@
|
||||
|
||||
|
||||
<% content_for "script" do %>
|
||||
<script src="/js/alert.js"></script>
|
||||
<script src="/js/user.js"></script>
|
||||
<% end %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user