From b2618e9404b84cc62d4becb02436233a0d53b375 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 25 Nov 2015 22:45:43 +0100 Subject: Rfactorization. Just a start... --- web/templates/about.html | 28 ++++++ web/templates/admin/create_user.html | 29 ++++++ web/templates/admin/dashboard.html | 60 +++++++++++++ web/templates/admin/user.html | 19 ++++ web/templates/article.html | 45 ++++++++++ web/templates/duplicates.html | 30 +++++++ web/templates/edit_feed.html | 78 ++++++++++++++++ web/templates/emails/new_account.html | 9 ++ web/templates/emails/new_account.txt | 11 +++ web/templates/emails/new_article.html | 1 + web/templates/emails/new_article.txt | 1 + web/templates/errors/404.html | 12 +++ web/templates/errors/500.html | 12 +++ web/templates/feed.html | 47 ++++++++++ web/templates/feed_list.html | 47 ++++++++++ web/templates/feeds.html | 7 ++ web/templates/history.html | 26 ++++++ web/templates/home.html | 131 +++++++++++++++++++++++++++ web/templates/inactives.html | 26 ++++++ web/templates/layout.html | 165 ++++++++++++++++++++++++++++++++++ web/templates/login.html | 30 +++++++ web/templates/management.html | 31 +++++++ web/templates/opml.xml | 14 +++ web/templates/profile.html | 42 +++++++++ web/templates/recover.html | 18 ++++ web/templates/signup.html | 26 ++++++ 26 files changed, 945 insertions(+) create mode 100644 web/templates/about.html create mode 100644 web/templates/admin/create_user.html create mode 100644 web/templates/admin/dashboard.html create mode 100644 web/templates/admin/user.html create mode 100644 web/templates/article.html create mode 100644 web/templates/duplicates.html create mode 100644 web/templates/edit_feed.html create mode 100644 web/templates/emails/new_account.html create mode 100644 web/templates/emails/new_account.txt create mode 100644 web/templates/emails/new_article.html create mode 100644 web/templates/emails/new_article.txt create mode 100644 web/templates/errors/404.html create mode 100644 web/templates/errors/500.html create mode 100644 web/templates/feed.html create mode 100644 web/templates/feed_list.html create mode 100644 web/templates/feeds.html create mode 100644 web/templates/history.html create mode 100644 web/templates/home.html create mode 100644 web/templates/inactives.html create mode 100644 web/templates/layout.html create mode 100644 web/templates/login.html create mode 100644 web/templates/management.html create mode 100644 web/templates/opml.xml create mode 100644 web/templates/profile.html create mode 100644 web/templates/recover.html create mode 100644 web/templates/signup.html (limited to 'web/templates') diff --git a/web/templates/about.html b/web/templates/about.html new file mode 100644 index 00000000..bb2b7e58 --- /dev/null +++ b/web/templates/about.html @@ -0,0 +1,28 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ _('About') }}

+

+ {{ _('JARR is a news aggregator platform and can be shared between several users.') }} + {{ _('You can easily install JARR on your server.') }} + {{ _('Alternatively, you can deploy your own copy using this button:') }}

+ https://www.herokucdn.com/deploy/button.png

+

{{ _('This software is under AGPLv3 license. You are welcome to copy, modify or + redistribute the source code + according to the Affero GPL license.') }}

+

{{ _('Found a bug? Report it here.') }}

+
+
+

{{ _('Help') }}

+

{{ _('If you have any problem, contact the administrator.') }}

+

{{ _('The documentation of the RESTful API is here.') }}

+

{{ _('You can subscribe to new feeds with a bookmarklet. Drag the following button to your browser bookmarks.') }}

+ {{ _('Subscribe to this feed using JARR', bookmarklet='javascript:window.location="%s?url="+encodeURIComponent(document.location)' % url_for('feed.bookmarklet', _external=True)) }} +
+
+

{{ _('Donation') }}

+

{{ _('If you wish and if you like JARR, you can donate via bitcoin 1GVmhR9fbBeEh7rP1qNq76jWArDdDQ3otZ. Thank you!') }}

+
+
+{% endblock %} diff --git a/web/templates/admin/create_user.html b/web/templates/admin/create_user.html new file mode 100644 index 00000000..64387dce --- /dev/null +++ b/web/templates/admin/create_user.html @@ -0,0 +1,29 @@ +{% extends "layout.html" %} +{% block head%} +{{super()}} +{% endblock %} +{% block content %} +
+
+

{{ message | safe }}

+
+ {{ form.hidden_tag() }} + + {{ form.nickname.label }} + {{ form.nickname(class_="form-control") }} {% for error in form.nickname.errors %} {{ error }}
{% endfor %} + + {{ form.email.label }} + {{ form.email(class_="form-control") }} {% for error in form.email.errors %} {{ error }}
{% endfor %} + + {{ form.password.label }} + {{ form.password(class_="form-control") }} {% for error in form.password.errors %} {{ error }}
{% endfor %} + + {{ form.refresh_rate.label }} + {{ form.refresh_rate(class_="form-control") }} {% for error in form.refresh_rate.errors %} {{ error }}
{% endfor %} + +
+ {{ form.submit(class_="btn btn-default") }} +
+
+
+{% endblock %} diff --git a/web/templates/admin/dashboard.html b/web/templates/admin/dashboard.html new file mode 100644 index 00000000..25bd3883 --- /dev/null +++ b/web/templates/admin/dashboard.html @@ -0,0 +1,60 @@ +{% extends "layout.html" %} +{% block head%} +{{super()}} +{% endblock %} +{% block content %} +
+

{{ _('Registered users') }}

+ + + + + + + + + + + + {% for user in users|sort(attribute="last_seen")|reverse %} + + + {% if user.id == current_user.id %} + + {% else %} + + {% endif %} + + + + + {% endfor %} + +
#{{ _('Nickname') }}{{ _('Email') }}{{ _('Last seen') }}{{ _('Actions') }}
{{ loop.index }}{{ user.nickname }} (It's you!){{ user.nickname }}{{ user.email }}{{ user.last_seen }} + + + {% if user.id != current_user.id %} + {% if user.activation_key == "" %} + + {% else %} + + {% endif %} + + {% endif %} +
+{{ _('Add a new user') }} +

{{ _('Send notification messages') }}

+
+ {{ form.hidden_tag() }} + + {{ form.subject.label }} + {{ form.subject(class_="form-control") }} {% for error in form.subject.errors %} {{ error }}
{% endfor %} + + {{ form.message.label }} + {{ form.message(class_="form-control", rows=8) }} {% for error in form.message.errors %} {{ error }}
{% endfor %} + +
+ {{ form.submit(class_="btn btn-default") }} +
+
+{% endblock %} diff --git a/web/templates/admin/user.html b/web/templates/admin/user.html new file mode 100644 index 00000000..d1e08c0d --- /dev/null +++ b/web/templates/admin/user.html @@ -0,0 +1,19 @@ +{% extends "layout.html" %} +{% block head%} +{{super()}} +{% endblock %} +{% block content %} +
+
+ {{ _('Edit this user') }} +

{{ _('Membership') }}

+
+
+

{{ _('Member since') }} {{ user.date_created | datetime }}.

+

{{ _('Last seen:') }} {{ user.last_seen | datetime }}.

+
+
+
+ {% include "feed_list.html" %} +
+{% endblock %} diff --git a/web/templates/article.html b/web/templates/article.html new file mode 100644 index 00000000..b1f950b4 --- /dev/null +++ b/web/templates/article.html @@ -0,0 +1,45 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ article.title|safe }}

+

{{ _('from') }} {{ article.source.title }}

+ + {% if article.like %} + + {% else %} + + {% endif %} + {% if article.readed %} + + {% else %} + + {% endif %} +
{{ article.date | datetime }}
+
+
+ {{ article.content | safe }} +
+
+
+
+ {{ _('Next post:') }} {{ next_article.title }} +
+
+ {{ _('Previous post:') }} {{ previous_article.title }} +
+
+
+ +
+{% endblock %} diff --git a/web/templates/duplicates.html b/web/templates/duplicates.html new file mode 100644 index 00000000..32fbdf9a --- /dev/null +++ b/web/templates/duplicates.html @@ -0,0 +1,30 @@ +{% extends "layout.html" %} +{% block content %} +
+

{{ _('Duplicates in the feed') }} {{ feed.title }}.

+

+ + + + + + + + + + {% for pair in duplicates %} + + + + + + {% endfor %} + +
# + {{ _('Delete all in this column') }} + + {{ _('Delete all in this column') }} +
{{ loop.index }} {{ pair[0].title }} ({{ pair[0].retrieved_date }}) {{ pair[1].title }} ({{ pair[1].retrieved_date }})
+
+
+{% endblock %} diff --git a/web/templates/edit_feed.html b/web/templates/edit_feed.html new file mode 100644 index 00000000..d1e45b0e --- /dev/null +++ b/web/templates/edit_feed.html @@ -0,0 +1,78 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ action }}

+
+ {{ form.hidden_tag() }} +
+ +
+ {{ form.link(class_="form-control", size="100%") }} +
+ {% for error in form.link.errors %} {{ error }}
{% endfor %} +
+ +
+ +
+ {{ form.title(class_="form-control", size="100%", placeholder=_('Optional')) }} +
+ {% for error in form.title.errors %} {{ error }}
{% endfor %} +
+ +
+ +
+ {{ form.site_link(class_="form-control", size="100%", placeholder=_('Optional')) }} +
+ {% for error in form.site_link.errors %} {{ error }}
{% endfor %} +
+ +
+ +
+
+ {{ form.enabled(class_="checkbox", style="margin-left: 0px;") }} +
+
+
+
+ +
+ +
+
+ {% if feed %} +
+ {% for filter_ in feed.filters or [] %} +
+ + + + + +
+ {% endfor %} +
+ + {% endif %} + +
+
+ {{ form.submit(class_="btn btn-default") }} +
+
+
+
+
+{% endblock %} diff --git a/web/templates/emails/new_account.html b/web/templates/emails/new_account.html new file mode 100644 index 00000000..5b173e7e --- /dev/null +++ b/web/templates/emails/new_account.html @@ -0,0 +1,9 @@ +

Hello {{ user.firstname }} {{ user.lastname }},

+ +

An account has been created for you. +You can now access the JARR platform. +Your login is your e-mail address and your password is:

+ +

{{ password }}

+ +

Regards,

\ No newline at end of file diff --git a/web/templates/emails/new_account.txt b/web/templates/emails/new_account.txt new file mode 100644 index 00000000..6397f502 --- /dev/null +++ b/web/templates/emails/new_account.txt @@ -0,0 +1,11 @@ +Hello {{ user.firstname }} {{ user.lastname }}, + +An account has been created for you. +You can now access the pyAggr3g470r platform ({{ platform_url }}). +Your login is your e-mail address and your password is: + +--- +{{ password }} +--- + +Regards, \ No newline at end of file diff --git a/web/templates/emails/new_article.html b/web/templates/emails/new_article.html new file mode 100644 index 00000000..5a6b7c4a --- /dev/null +++ b/web/templates/emails/new_article.html @@ -0,0 +1 @@ +{{ article.content | safe }} \ No newline at end of file diff --git a/web/templates/emails/new_article.txt b/web/templates/emails/new_article.txt new file mode 100644 index 00000000..9b800855 --- /dev/null +++ b/web/templates/emails/new_article.txt @@ -0,0 +1 @@ +{{ article.content | striptags }} \ No newline at end of file diff --git a/web/templates/errors/404.html b/web/templates/errors/404.html new file mode 100644 index 00000000..c64a2be8 --- /dev/null +++ b/web/templates/errors/404.html @@ -0,0 +1,12 @@ +{% extends "layout.html" %} +{% block head %} +{{ super() }} +{% endblock %} +{% block content %} +
+
+

Page Not Found

+

What you were looking for is just not there, go to the home page.

+
+
+{% endblock %} diff --git a/web/templates/errors/500.html b/web/templates/errors/500.html new file mode 100644 index 00000000..417fc0c7 --- /dev/null +++ b/web/templates/errors/500.html @@ -0,0 +1,12 @@ +{% extends "layout.html" %} +{% block head %} +{{ super() }} +{% endblock %} +{% block content %} +
+
+

Internal Server Error

+

Something bad just happened! Go to the home page.

+
+
+{% endblock %} diff --git a/web/templates/feed.html b/web/templates/feed.html new file mode 100644 index 00000000..c421a411 --- /dev/null +++ b/web/templates/feed.html @@ -0,0 +1,47 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ feed.title }}

+ {% if feed.description %}

{{ feed.description }}

{% endif %} + + +
+
+

+ {{ _('This feed contains') }} {{ feed.articles.all()|count }} {{ _('articles') }}.
+ {{ _('Address of the feed') }}: {{ feed.link }}
+ {% if feed.site_link != "" %} + {{ _('Address of the site') }}: {{ feed.site_link }}
+ {% endif %} + +
+ + {% if feed.last_retrieved %} + {{ _("Last download:") }} {{ feed.last_retrieved | datetime }}
+ {% endif %} + + {% if feed.error_count >= conf.DEFAULT_MAX_ERROR %} + {{ _("That feed has encountered too much consecutive errors and won't be retrieved anymore.") }}
+ {{ _("You can click here to reset the error count and reactivate the feed.", reset_error_url=url_for("feed.reset_errors", feed_id=feed.id)) }} + {% elif feed.error_count > 0 %} + {{ _("The download of this feed has encountered some problems. However its error counter will be reinitialized at the next successful retrieving.") }}
+ {% endif %} + + {% if feed.last_error %} + {{ _("Here's the last error encountered while retrieving this feed:") }}

{{ feed.last_error }}

+ {% endif %} + + {% if feed.articles.all()|count != 0 %} + {{ _('The last article was posted') }} {{ elapsed.days }} {{ _('day(s) ago.') }}
+ {{ _('Daily average') }}: {{ average }}, {{ _('between the') }} {{ first_post_date | datetime }} {{ _('and the') }} {{ end_post_date | datetime }}. + {% endif %} +

+
+
+ {% if feed.articles.all()|count != 0 %} +
{{ tag_cloud|safe }}
+ {% endif %} +
+
+{% endblock %} diff --git a/web/templates/feed_list.html b/web/templates/feed_list.html new file mode 100644 index 00000000..c5cadab0 --- /dev/null +++ b/web/templates/feed_list.html @@ -0,0 +1,47 @@ +{% if feeds.all()| count == 0 %} +

{{_("No feed")}}

+{% else %} +
+ + + + + + + + + + + + + {% for feed in feeds|sort(attribute="title") %} + + + + + + + + + {% endfor %} + +
#{{ _('Status') }}{{ _('Title') }}{{ _('Site') }}{{ _('Articles') }}{{ _('Actions') }}
{{ loop.index }} + {% if feed.enabled %} + + {% else %} + + {% endif %} + {% if feed.error_count >= conf.DEFAULT_MAX_ERROR %} + + {% endif %} + + {% if feed.icon_url %}{% endif %} + {{ feed.title }} + {{ feed.site_link }}( {{ unread_article_count.get(feed.id, 0) }} ) {{ article_count.get(feed.id, 0) }} + + + + +
+
+{% endif %} diff --git a/web/templates/feeds.html b/web/templates/feeds.html new file mode 100644 index 00000000..9ba16359 --- /dev/null +++ b/web/templates/feeds.html @@ -0,0 +1,7 @@ +{% extends "layout.html" %} +{% block content %} +
+

{{ _('You are subscribed to') }} {{ feeds.count() }} {{ _('feeds') }} · {{ _('Add a') }} {{ _('feed') }}

+ {% include "feed_list.html" %} +
+{% endblock %} diff --git a/web/templates/history.html b/web/templates/history.html new file mode 100644 index 00000000..6be54d71 --- /dev/null +++ b/web/templates/history.html @@ -0,0 +1,26 @@ +{% extends "layout.html" %} +{% block content %} +
+

{{ _('History') }}

+ {% if month != None %} +

{{ year }}

+

{{ month | month_name }}

+ {% elif year != None %} +

 {{ _('all years') }}

+

{{ year }}

+ {% endif %} + +
+{% endblock %} diff --git a/web/templates/home.html b/web/templates/home.html new file mode 100644 index 00000000..86d96e94 --- /dev/null +++ b/web/templates/home.html @@ -0,0 +1,131 @@ +{% extends "layout.html" %} +{% block content %} +{% if feeds|count == 0 %} +
+

{{ _("You don't have any feeds.") }}

+

{{ _('Add some') }}, {{ _('or') }} {{ _('upload an OPML file.') }}

+
+{% else %} +
+
+ + + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} +
+ {% block messages %} + {{ super() }} + {% endblock %} +
+ {% endif %} + {% endwith %} +
+ + {% if articles | count != 0%} +
+ + + + + + + + + + + {% for article in articles %} + + + + + + + {% endfor %} + +
{{ _('Feed') }}{{ _('Article') }}{{ _('Date') }}
+ + {% if article.like %} + + {% else %} + + {% endif %} + {% if article.readed %} + + {% else %} + + {% if filter_ == 'all' %}{% endif %} + {% endif %} + + + {% if article.source.icon_url %} + + {% else %} + + {% endif %} + + {{ article.title|safe }} + {{ article.date|datetime }}
+
+ {% endif %} +
+
+
+ +{% endif %} +{% endblock %} diff --git a/web/templates/inactives.html b/web/templates/inactives.html new file mode 100644 index 00000000..eb546eca --- /dev/null +++ b/web/templates/inactives.html @@ -0,0 +1,26 @@ +{% extends "layout.html" %} +{% block content %} +
+
+
+

{{ _('Days of inactivity') }}:

+ +
+
+ {% if inactives != [] %} + + {% else %} +

{{ _('No inactive feeds.') }}

+ {% endif %} +

+
+{% endblock %} diff --git a/web/templates/layout.html b/web/templates/layout.html new file mode 100644 index 00000000..37a101d9 --- /dev/null +++ b/web/templates/layout.html @@ -0,0 +1,165 @@ + + + + {% block head %} + + + + + JARR{% if head_titles %} - {{ ' - '.join(head_titles) }}{% endif %} + + + + + + + {% endblock %} + + + +
+ +
+ {% block messages %} + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
+ + {{ message }} +
+ {% endfor %} + {% endif %} + {% endwith %} + {% endblock %} +
+ + {% block content %}{% endblock %} + + + + + + + + + + diff --git a/web/templates/login.html b/web/templates/login.html new file mode 100644 index 00000000..c37d6937 --- /dev/null +++ b/web/templates/login.html @@ -0,0 +1,30 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ _('Log In') }}

+
+ {{ form.hidden_tag() }} + +
+ {{ form.email(class_="form-control", placeholder=_('Your email')) }} +
+ {% for message in form.email.errors %} + + {% endfor %} + +
+ {{ form.password(class_="form-control", placeholder=_('Your Password')) }} +
+ {% for message in form.password.errors %} + + {% endfor %} + + {{ form.submit(class_="btn btn-default") }} +
+
+ {{ _('Sign up') }} +   + {{ _('Forgot password') }} +
+{% endblock %} diff --git a/web/templates/management.html b/web/templates/management.html new file mode 100644 index 00000000..72259551 --- /dev/null +++ b/web/templates/management.html @@ -0,0 +1,31 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ _('Your subscriptions') }}

+

{{ _('You are subscribed to') }} {{ nb_feeds }} {{ _('feeds') }}. {{ _('Add a') }} {{ _('feed') }}.

+

{{ nb_articles }} {{ _('articles are stored in the database with') }} {{ nb_unread_articles }} {{ _('unread articles') }}.

+ {{ _('Delete articles older than 10 weeks') }} +
+
+

{{ _('OPML import/export') }}

+
+ {{ _('Batch import feeds from OPML') }} (*.xml {{ _('or') }} *.opml) + +
+
+ {{ _('Export feeds to OPML') }} +

{{ _('Data liberation') }}

+
+ {{ _('Import account') }} (*.json) + +
+
+ {{ _('Export account to JSON') }} +
+
+

{{ _('Export articles') }}

+ HTML +
+
+{% endblock %} diff --git a/web/templates/opml.xml b/web/templates/opml.xml new file mode 100644 index 00000000..96fe66f5 --- /dev/null +++ b/web/templates/opml.xml @@ -0,0 +1,14 @@ + + + + + Feeds of {{ user.nickname }} + {{ now | datetime }} + {{ now | datetime }} + {{ user.nickname }} + {{ user.email }} + + + {% for feed in user.feeds %} + {% endfor %} + \ No newline at end of file diff --git a/web/templates/profile.html b/web/templates/profile.html new file mode 100644 index 00000000..acd593b2 --- /dev/null +++ b/web/templates/profile.html @@ -0,0 +1,42 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ _('Your Profile') }}

+
+
+

{{ _('Member since') }} {{ user.date_created | datetime }}.

+

{{ _('Last seen:') }} {{ user.last_seen | datetime }}.

+
+
+ +
+
+

Edit your profile

+
+ {{ form.hidden_tag() }} + + {{ form.nickname.label }} + {{ form.nickname(class_="form-control") }} {% for error in form.nickname.errors %} {{ error }}
{% endfor %} + + {{ form.email.label }} + {{ form.email(class_="form-control") }} {% for error in form.email.errors %} {{ error }}
{% endfor %} + + {{ form.password.label }} + {{ form.password(class_="form-control") }} {% for error in form.password.errors %} {{ error }}
{% endfor %} + + {{ form.password_conf.label }} + {{ form.password_conf(class_="form-control") }} {% for error in form.password_conf.errors %} {{ error }}
{% endfor %} + + {{ form.refresh_rate.label }} + {{ form.refresh_rate(class_="form-control") }} {% for error in form.refresh_rate.errors %} {{ error }}
{% endfor %} +
+ {{ form.submit(class_="btn") }} +
+
+
+{% endblock %} diff --git a/web/templates/recover.html b/web/templates/recover.html new file mode 100644 index 00000000..c1176d55 --- /dev/null +++ b/web/templates/recover.html @@ -0,0 +1,18 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ _('Recover your account') }}

+ {% for message in form.email.errors %} +
{{ message }}
+ {% endfor %} +
+ {{ form.hidden_tag() }} +
+ {{ form.email(class_="form-control", placeholder=_('Your email')) }} +
+ {{ form.submit(class_="btn btn-default") }} +
+
+
+{% endblock %} diff --git a/web/templates/signup.html b/web/templates/signup.html new file mode 100644 index 00000000..3962c42a --- /dev/null +++ b/web/templates/signup.html @@ -0,0 +1,26 @@ +{% extends "layout.html" %} +{% block content %} +
+
+
+ {{ form.hidden_tag() }} +
+ {{ form.nickname.label }} + {{ form.nickname(class_="form-control") }} {% for error in form.nickname.errors %} {{ error }}
{% endfor %} +

{{ _('Letters, numbers, dots and underscores only.') }}

+
+ {{ form.email.label }} + {{ form.email(class_="form-control") }} {% for error in form.email.errors %} {{ error }}
{% endfor %} +
+ {{ form.password.label }} + {{ form.password(class_="form-control") }} {% for error in form.password.errors %} {{ error }}
{% endfor %} +

{{ _('Minimum 6 characters.') }}

+
+ {{ form.recaptcha.label }} + {{ form.recaptcha }} {% for error in form.recaptcha.errors %} {{ error }}
{% endfor %} +
+ {{ form.submit(class_="btn btn-default") }} +
+
+
+{% endblock %} -- cgit