mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2024-12-28 02:16:07 +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
|
@ -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>
|
||||
|
|
33
poetry.lock
generated
33
poetry.lock
generated
|
@ -1,4 +1,4 @@
|
|||
# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "astroid"
|
||||
|
@ -253,21 +253,20 @@ brotli = "*"
|
|||
flask = "*"
|
||||
|
||||
[[package]]
|
||||
name = "flask-session2"
|
||||
version = "1.3.1"
|
||||
description = "Adds server-side session support to your Flask application"
|
||||
name = "flask-login"
|
||||
version = "0.6.2"
|
||||
description = "User authentication and session management for Flask."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7.2,<4.0.0"
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "Flask-Session2-1.3.1.tar.gz", hash = "sha256:171e986d4e314795f448a527095e42df6abfba76c3e4ce5c8e4c61c857c59cb2"},
|
||||
{file = "Flask_Session2-1.3.1-py3-none-any.whl", hash = "sha256:6d1615dfc4b247759f31f89bf16aba96fa1294077e700771875abe952f291959"},
|
||||
{file = "Flask-Login-0.6.2.tar.gz", hash = "sha256:c0a7baa9fdc448cdd3dd6f0939df72eec5177b2f7abe6cb82fc934d29caac9c3"},
|
||||
{file = "Flask_Login-0.6.2-py3-none-any.whl", hash = "sha256:1ef79843f5eddd0f143c2cd994c1b05ac83c0401dc6234c143495af9a939613f"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
cachelib = ">=0.9.0,<0.10.0"
|
||||
Flask = ">=2.2.2,<3.0.0"
|
||||
pytz = ">=2022.2.1,<2023.0.0"
|
||||
Flask = ">=1.0.4"
|
||||
Werkzeug = ">=1.0.1"
|
||||
|
||||
[[package]]
|
||||
name = "greenlet"
|
||||
|
@ -706,18 +705,6 @@ files = [
|
|||
[package.extras]
|
||||
cli = ["click (>=5.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "pytz"
|
||||
version = "2022.7.1"
|
||||
description = "World timezone definitions, modern and historical"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "pytz-2022.7.1-py2.py3-none-any.whl", hash = "sha256:78f4f37d8198e0627c5f1143240bb0206b8691d8d7ac6d78fee88b78733f8c4a"},
|
||||
{file = "pytz-2022.7.1.tar.gz", hash = "sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyyaml"
|
||||
version = "6.0"
|
||||
|
@ -1033,4 +1020,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "fdc83d433d98ba079b4614e37da26b9c81f07e0a646606c17de5c0fb07ae483e"
|
||||
content-hash = "431b58579dc3ebde52c8f3905c851556a465d5a82796a8a26718d69cb4915959"
|
||||
|
|
|
@ -12,7 +12,7 @@ Flask = "^2.2.2"
|
|||
Flask-Compress = "^1.13"
|
||||
Flask-Caching = "^2.0.2"
|
||||
Flask-Assets = "^2.0"
|
||||
Flask-Session2 = "^1.3.1"
|
||||
Flask-Login = "^0.6.2"
|
||||
SQLAlchemy = "^2.0.3"
|
||||
python-dotenv = "^0.21.0"
|
||||
gunicorn = "^20.1.0"
|
||||
|
|
Loading…
Reference in a new issue