diff --git a/app/static/css/app.css b/app/static/css/app.css index 74d3628..ec00adf 100644 --- a/app/static/css/app.css +++ b/app/static/css/app.css @@ -27,3 +27,20 @@ .swg-c3po-2 { color: #EDA35C; } + +.dropzone { + border-radius: 5px; + background: #eee; + font-size: 1.2em; + border: 2px solid #754DAC; +} +.dz-preview { + border-radius: 5px; + border: 2px solid #754DAC; +} + +.dz-image { + border-radius: 0 !important; + background: none !important; + border-bottom: 2px solid #754DAC; +} diff --git a/app/static/js/dropzone.js b/app/static/js/dropzone.js new file mode 100644 index 0000000..52b0279 --- /dev/null +++ b/app/static/js/dropzone.js @@ -0,0 +1,29 @@ +/* + * This file is part of pste. + * + * pste is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * pste is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with pste. If not, see . + */ + +Dropzone.options.psteUpload = { + paramName: "file", // The name that will be used to transfer the file + init: function () { + this.on("success", function (file, responseText) { + $(file.previewTemplate).append($("", { + "target": "_blank", + "href": responseText.url, + html: "Open..." + })) + }) + } +}; diff --git a/app/templates/base.html b/app/templates/base.html index 70fdc7b..3b33b1d 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -4,6 +4,7 @@ + {% block meta %}{% endblock %} {{ config.APP_NAME }}{{ ' - ' + title if title else '' }} @@ -20,6 +21,11 @@ + {% if current_user.is_authenticated %} + + {% endif %} {% block flash_messages %} {%- with messages = get_flashed_messages(with_categories=true) -%} @@ -41,11 +47,17 @@ {% endblock %} {% block content %}{% endblock %}
- pste {{ config.APP_VERSION }} +
+ +
+ {% block scripts %}{% endblock %} diff --git a/app/templates/main/index.html b/app/templates/main/index.html index 6e70edc..bbd8792 100644 --- a/app/templates/main/index.html +++ b/app/templates/main/index.html @@ -1,5 +1,20 @@ {% extends 'base.html' %} +{% block stylesheets %} + +{% endblock %} + +{% block scripts %} + + +{% endblock %} + {% block content %} -curl -H "Authorization: Bearer {{ current_user.api_key }}" -F file=@/path/to/file {{ url_for('api.upload', _external=True) }} +
+ curl -H "Authorization: Bearer {{ current_user.api_key }}" -F file=@/path/to/file {{ url_for('api.upload', _external=True) }} +
+
+
+
+
{% endblock %} diff --git a/app/views/auth.py b/app/views/auth.py index e96d07c..be43d2d 100644 --- a/app/views/auth.py +++ b/app/views/auth.py @@ -77,6 +77,10 @@ def register(): flash_errors(form) return redirect(url_for('auth.register')) + if User.query.filter_by(email=form.email.data).first(): + flash('Email is already in use.', 'error') + return redirect(url_for('auth.register')) + user = User() user.email = form.email.data user.set_password(form.password.data)