diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e027d6..105a0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.9-dev +* Website redesign: added some material icons, implemented via a `inline_svg` function, injected by default in templates and defined in `utils.py`. * Added positive feedback mechanism: now you can +1 a message. So, `score_message_add` and `score_message_remove` API endpoints were added, and `MessageUpvote` table was created. * Added notifications support for API. * Added `create_account` endpoint to API. This endpoint does not require an access token. diff --git a/app/__init__.py b/app/__init__.py index b8b5c06..3b8ab12 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -30,6 +30,8 @@ __version__ = '0.9-dev' if sys.version_info[0] < 3: raise RuntimeError('Python 3 required') +os.chdir(os.path.dirname(os.path.dirname(__file__))) + app = Flask(__name__) app.config.from_pyfile('../config.py') @@ -60,7 +62,11 @@ def after_request(response): @app.context_processor def _inject_variables(): - return {'site_name': app.config['SITE_NAME'], 'locations': locations} + return { + 'site_name': app.config['SITE_NAME'], + 'locations': locations, + 'inline_svg': inline_svg + } @login_manager.user_loader def _inject_user(userid): diff --git a/app/filters.py b/app/filters.py index 2735d9d..cbb9dbb 100644 --- a/app/filters.py +++ b/app/filters.py @@ -4,7 +4,7 @@ Filter functions used in the website templates. from flask import Markup import html, datetime, re, time -from .utils import tokenize +from .utils import tokenize, inline_svg as _inline_svg from . import app @app.template_filter() @@ -64,3 +64,4 @@ def is_following(from_user, to_user): def locationdata(key): if key > 0: return locations[str(key)] + diff --git a/app/models.py b/app/models.py index 4d2cc8c..865513b 100644 --- a/app/models.py +++ b/app/models.py @@ -17,7 +17,7 @@ import os # here should go `from .utils import get_current_user`, but it will cause # import errors. It's instead imported at function level. -database = SqliteDatabase(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'coriplus.sqlite')) +database = SqliteDatabase('coriplus.sqlite') class BaseModel(Model): class Meta: @@ -51,8 +51,7 @@ class User(BaseModel): return False @property def is_authenticated(self): - from .utils import get_current_user - return self == get_current_user() + return True # it often makes sense to put convenience methods on model instances, for # example, "give me all the users this user is following": diff --git a/app/static/style.css b/app/static/style.css index 5ade0ad..aaef997 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -1,9 +1,16 @@ -body,button,input,select,textarea{font-family:'Segoe UI',Arial,Helvetica,sans-serif} +body,button,input,select,textarea{font-family:Roboto,'Segoe UI',Arial,Helvetica,sans-serif} body{margin:0} -.header{padding:12px;color:white;background-color:#ff3018} +a{text-decoration:none} +a:hover{text-decoration:underline} +@media (max-width:640px){ + .mobile-collapse{display:none} +} +.header{padding:12px;color:white;background-color:#ff3018;box-shadow:0 0 3px 3px #ccc} .content{padding:12px} .header a{color:white} +.header a svg{fill:white} .content a{color:#3399ff} +.content a svg{fill:#3399ff} .content a.plus{color:#ff3018} .metanav{float:right} .header h1{margin:0;display:inline-block} @@ -14,7 +21,9 @@ body{margin:0} } .weak{opacity:.5} .field_desc{display:block} -.message-visual img{max-width:100%;max-height:8em} +ul.timeline{padding:0;margin:auto;max-width:960px} +ul.timeline > li{list-style:none;border-bottom:#808080 1px solid} +.message-visual img{max-width:100%;margin:auto} .message-options-showhide::before{content:'\2026'} .message-options{display:none} .create_text{width:100%;height:8em} diff --git a/app/templates/base.html b/app/templates/base.html index 74ee636..dae5889 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -12,18 +12,18 @@

{{ site_name }}

{% if current_user.is_anonymous %} - log in - register + {{ inline_svg('exit_to_app') }} log in + {{ inline_svg('person_add') }} register {% else %} - {{ current_user.username }} + {{ inline_svg('person') }} {{ current_user.username }} {% set notification_count = current_user.unseen_notification_count() %} {% if notification_count > 0 %} ({{ notification_count }}) {% endif %} - - explore - create - log out + {{ inline_svg('explore') }} explore + {{ inline_svg('edit') }} create + {{ inline_svg('exit_to_app') }} log out {% endif %}
@@ -36,7 +36,8 @@ diff --git a/app/templates/explore.html b/app/templates/explore.html index ed3aab2..65d1846 100644 --- a/app/templates/explore.html +++ b/app/templates/explore.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block body %}

Explore

-