diff options
-rw-r--r-- | pastebin.py | 12 | ||||
-rw-r--r-- | static/small.css | 6 | ||||
-rw-r--r-- | static/style.css | 9 | ||||
-rw-r--r-- | templates/layout.html | 2 |
4 files changed, 20 insertions, 9 deletions
diff --git a/pastebin.py b/pastebin.py index 4c529f9..3851d01 100644 --- a/pastebin.py +++ b/pastebin.py @@ -48,6 +48,13 @@ def url_for_other_page(page): app.jinja_env.globals['url_for_other_page'] = url_for_other_page app.jinja_env.globals['appname'] = app.config['APPNAME'] +def refresh_string(delay,url): + """ + Returns a string for html content for redirecting the user back after the + requested delay, to the requested url. + """ + return f'<meta http-equiv="Refresh" content="{delay}; url={url}">' + @app.before_request def check_user_status(): g.user = None @@ -148,9 +155,10 @@ def delete_paste(paste_id): try: Paste.query.filter(Paste.id == paste.id).delete() db.session.commit() - return "OK",200 # WORKHERE: make this and the 500 redirect to admin/ + message = refresh_string(1, url_for("admin")) + "OK" + return message,200 except: - return "failure to delete object.",500 + return f"failure to delete object. Select <a href='{url_for('admin')}'>here</a> to return to the admin panel.",500 def get_all_pastes(): """ diff --git a/static/small.css b/static/small.css deleted file mode 100644 index 7bba2a3..0000000 --- a/static/small.css +++ /dev/null @@ -1,6 +0,0 @@ -pre { - font-size: 14px; - line-height: 1.6em; -} - -.page { margin: 20px auto; width: 100%; } diff --git a/static/style.css b/static/style.css index 1fc54ce..4507323 100644 --- a/static/style.css +++ b/static/style.css @@ -22,3 +22,12 @@ textarea { border: none; width: 780px; } .pagination strong, .pagination span.ellipsis, .pagination a { border: 1px solid #d00; padding: 2px 6px; text-decoration: none; } + +/* trying to simplify the requests for style.css and small.css */ +@media only screen and (max-width: 800px) { + pre { + font-size: 14px; + line-height: 1.6em; + } + .page { margin: 20px auto; width: 100%; } +} diff --git a/templates/layout.html b/templates/layout.html index fc2d8e5..3c6d8ab 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -5,7 +5,7 @@ <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="format-detection" content="telephone=no"> <link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"> -<link rel="stylesheet" media="screen and (max-width: 800px)" href="{{ url_for('static', filename='small.css') }}" /> +{#<link rel="stylesheet" media="screen and (max-width: 800px)" href="{{ url_for('static', filename='small.css') }}" />#} <div class=page> <ul class=nav> <li><a href="{{ url_for('new_paste') }}">New Paste</a> |