mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Move popups to correct loading order
Move away from yeeted Ajax code to fetch
This commit is contained in:
parent
e2bf5ed4e2
commit
ad547c4ccf
5 changed files with 31 additions and 46 deletions
|
@ -58,12 +58,9 @@ def create_app(test_config=None):
|
|||
app.config.from_mapping(test_config)
|
||||
|
||||
# Load JS assets
|
||||
js_pre = Bundle('js/pre/*.js', output='gen/pre_packed.js')
|
||||
js_post = Bundle('js/post/*.js', output='gen/post_packed.js')
|
||||
styles = Bundle('sass/*.sass', filters='libsass', output='gen/styles.css')
|
||||
assets.register('js_pre', js_pre)
|
||||
assets.register('js_post', js_post)
|
||||
assets.register('styles', styles)
|
||||
assets.register('js_pre', Bundle('js/pre/*.js', output='gen/pre_packed.js'))
|
||||
assets.register('js_post', Bundle('js/post/*.js', output='gen/post_packed.js'))
|
||||
assets.register('styles', Bundle('sass/*.sass', filters='libsass', output='gen/styles.css'))
|
||||
|
||||
# Error handlers, if the error is not a HTTP error, return 500
|
||||
@app.errorhandler(Exception)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
{% if g.user['id'] == image['author_id'] %}
|
||||
{% if g.user.id == image.author_id %}
|
||||
cancelBtn = document.createElement('button');
|
||||
cancelBtn.classList.add('btn-block');
|
||||
cancelBtn.innerHTML = 'nuuuuuuuu';
|
||||
|
@ -46,26 +46,27 @@
|
|||
deleteBtn.onclick = deleteConfirm;
|
||||
|
||||
function imageDelete() {
|
||||
popUpShow(
|
||||
'DESTRUCTION!!!!!!',
|
||||
'Do you want to delete this image along with all of its data??? This action is irreversible!',
|
||||
null,
|
||||
[cancelBtn, deleteBtn]
|
||||
);
|
||||
popUpShow('DESTRUCTION!!!!!!',
|
||||
'Do you want to delete this image along with all of its data??? ' +
|
||||
'This action is irreversible!',
|
||||
null,
|
||||
[cancelBtn, deleteBtn]);
|
||||
}
|
||||
function deleteConfirm() {
|
||||
popupDissmiss();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url_for('api.delete_image', image_id=image['id']) }}',
|
||||
type: 'post',
|
||||
data: {
|
||||
fetch('{{ url_for('api.delete_image', image_id=image['id']) }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: 'delete'
|
||||
},
|
||||
success: function (response) {
|
||||
})
|
||||
}).then(function(response) {
|
||||
if (response.ok) {
|
||||
window.location.href = '/';
|
||||
},
|
||||
error: function (response) {
|
||||
} else {
|
||||
addNotification(`Image *clings*: ${response}`, 2);
|
||||
}
|
||||
});
|
||||
|
@ -148,7 +149,7 @@
|
|||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{% if image.author_id == g.user.id %}
|
||||
{% if g.user.id == image.author_id %}
|
||||
<div>
|
||||
<button class="pill-item pill__critical" onclick="imageDelete()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"></path></svg>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue