diff --git a/biweeklybudget/flaskapp/templates/help.html b/biweeklybudget/flaskapp/templates/help.html new file mode 100644 index 00000000..2e6fdf2f --- /dev/null +++ b/biweeklybudget/flaskapp/templates/help.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} +{% block title %}Help / Docs / Code - BiweeklyBudget{% endblock %} +{% block body %} +{% include 'notifications.html' %} + +
+
+ +

biweeklybudget is AGPL 3.0 Free/Open Source Software. Anyone who can access or interact with this interface is entitled to the full source code of this exact running version.

+
+ +
+
+
Support Information
+ +
+
+
Database URI
+
{{ db_uri }}
+
Versionfinder long_str
+
{{ ver_info }}
+
User-Agent
+
{{ ua_str }}
+
+
+ +
+ +
+ +{% endblock %} diff --git a/biweeklybudget/flaskapp/templates/nav.html b/biweeklybudget/flaskapp/templates/nav.html index 278b94cd..0a8e3030 100644 --- a/biweeklybudget/flaskapp/templates/nav.html +++ b/biweeklybudget/flaskapp/templates/nav.html @@ -28,10 +28,7 @@
  •  
  • - biweeklybudget is AGPLv3+ Free Software -
  • -
  • - Docs + Help/Docs/Code (AGPL)
  • diff --git a/biweeklybudget/flaskapp/views/__init__.py b/biweeklybudget/flaskapp/views/__init__.py index f1f1dc62..0dd44112 100644 --- a/biweeklybudget/flaskapp/views/__init__.py +++ b/biweeklybudget/flaskapp/views/__init__.py @@ -43,3 +43,4 @@ from .reconcile import * from .scheduled import * from .transactions import * +from .help import * diff --git a/biweeklybudget/flaskapp/views/help.py b/biweeklybudget/flaskapp/views/help.py new file mode 100644 index 00000000..444eb517 --- /dev/null +++ b/biweeklybudget/flaskapp/views/help.py @@ -0,0 +1,71 @@ +""" +The latest version of this package is available at: + + +################################################################################ +Copyright 2016 Jason Antman + + This file is part of biweeklybudget, also known as biweeklybudget. + + biweeklybudget is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + biweeklybudget 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with biweeklybudget. If not, see . + +The Copyright and Authors attributions contained herein may not be removed or +otherwise altered, except to add the Author attribution of a contributor to +this work. (Additional Terms pursuant to Section 7b of the AGPL v3) +################################################################################ +While not legally required, I sincerely request that anyone who finds +bugs please submit them at or +to me via email, and that you send any contributions or improvements +either as a pull request on GitHub, or to me via email. +################################################################################ + +AUTHORS: +Jason Antman +################################################################################ +""" + +import logging +from flask.views import MethodView +from flask import render_template, request +from versionfinder import find_version + +from biweeklybudget.flaskapp.app import app +from biweeklybudget.version import VERSION, PROJECT_URL +from biweeklybudget.settings import DB_CONNSTRING + +logger = logging.getLogger(__name__) + +for lname in ['versionfinder', 'pip', 'git']: + l = logging.getLogger(lname) + l.setLevel(logging.CRITICAL) + l.propagate = True + + +class HelpView(MethodView): + """ + Render the GET /help view using the ``help.html`` template. + """ + + def get(self): + return render_template( + 'help.html', + ver_info=find_version('biweeklybudget').long_str, + version=VERSION, + url=PROJECT_URL, + ua_str=request.headers.get('User-Agent', 'unknown'), + db_uri=DB_CONNSTRING + ) + + +app.add_url_rule('/help', view_func=HelpView.as_view('help_view')) diff --git a/biweeklybudget/tests/acceptance/flaskapp/views/test_base_template.py b/biweeklybudget/tests/acceptance/flaskapp/views/test_base_template.py index 6a91abf0..6185b6fc 100644 --- a/biweeklybudget/tests/acceptance/flaskapp/views/test_base_template.py +++ b/biweeklybudget/tests/acceptance/flaskapp/views/test_base_template.py @@ -86,9 +86,7 @@ def test_nav_links(self, selenium): ('/reconcile', 'Reconcile'), ('/budgets', 'Budgets'), ('/scheduled', 'Scheduled'), - ('https://github.com/jantman/biweeklybudget', - 'biweeklybudget is AGPLv3+ Free Software'), - ('http://biweeklybudget.readthedocs.io/en/latest/', 'Docs') + ('/help', 'Help/Docs/Code (AGPL)') ] diff --git a/requirements.txt b/requirements.txt index fb4ab35c..a204314f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,3 +36,4 @@ pytz requests==2.13.0 selenium==3.0.2 six==1.10.0 +versionfinder==0.1.0