]> git.lizzy.rs Git - cheatdb.git/commitdiff
Add help pages
authorrubenwardy <rw@rubenwardy.com>
Mon, 14 May 2018 13:46:41 +0000 (14:46 +0100)
committerrubenwardy <rw@rubenwardy.com>
Mon, 14 May 2018 13:46:41 +0000 (14:46 +0100)
app/__init__.py
app/flatpages/help.md [new file with mode: 0644]
app/flatpages/help/ranks_permissions.md [new file with mode: 0644]
app/scss/components.scss
app/templates/flatpage.html [new file with mode: 0644]
app/views/__init__.py
requirements.txt

index 506ed27d8789ee8f3b10d90a40345cfd403bc1f5..6465407f7e482b6cf4ae601b8f7fbf618d6343cf 100644 (file)
@@ -5,9 +5,12 @@ from flask_mail import Mail
 from flask.ext import markdown
 from flask_github import GitHub
 from flask_wtf.csrf import CsrfProtect
+from flask_flatpages import FlatPages
 import os
 
 app = Flask(__name__)
+app.config["FLATPAGES_ROOT"] = "flatpages"
+app.config["FLATPAGES_EXTENSION"] = ".md"
 app.config.from_pyfile(os.environ["FLASK_CONFIG"])
 
 menu.Menu(app=app)
@@ -15,6 +18,7 @@ markdown.Markdown(app, extensions=["fenced_code"], safe_mode=True, output_format
 github = GitHub(app)
 csrf = CsrfProtect(app)
 mail = Mail(app)
+pages = FlatPages(app)
 
 from . import models, tasks
 from .views import *
diff --git a/app/flatpages/help.md b/app/flatpages/help.md
new file mode 100644 (file)
index 0000000..27329f5
--- /dev/null
@@ -0,0 +1,3 @@
+title: Help
+
+* [Ranks and Permissions](ranks_permissions)
diff --git a/app/flatpages/help/ranks_permissions.md b/app/flatpages/help/ranks_permissions.md
new file mode 100644 (file)
index 0000000..77ac13e
--- /dev/null
@@ -0,0 +1,173 @@
+title: Ranks and Permissions
+
+## Overview
+
+* **New Members** - mostly untrusted, cannot change package meta data or publish releases without approval.
+* **Members** - Trusted to change the meta data of their own packages', but cannot publish releases.
+* **Editors** - Trusted to change the meta data of any package, and also make and publish releases.
+* **Moderators** - Same as above, but can manage users.
+* **Admins** - Full access.
+
+## Breakdown
+
+<table>
+       <thead>
+               <tr>
+                       <th>Rank</th>
+                       <th colspan=2>New Member</th>
+                       <th colspan=2>Member</th>
+                       <th colspan=2>Editor</th>
+                       <th colspan=2>Moderator</th>
+                       <th colspan=2>Admin</th>
+               </tr>
+               <tr>
+                       <th>Owner of thing</th>
+                       <th>Y</th>
+                       <th>N</th>
+                       <th>Y</th>
+                       <th>N</th>
+                       <th>Y</th>
+                       <th>N</th>
+                       <th>Y</th>
+                       <th>N</th>
+                       <th>Y</th>
+                       <th>N</th>
+               </tr>
+       </thead>
+       <tbody>
+               <tr>
+                       <td>Create Package</td>
+                       <th>✓</th> <!-- new -->
+                       <th></th>
+                       <th>✓</th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Approve Package</td>
+                       <th></th> <!-- new -->
+                       <th></th>
+                       <th></th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Edit Package</td>
+                       <th></th> <!-- new -->
+                       <th></th>
+                       <th>✓</th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Approve EditRequest</td>
+                       <th></th> <!-- new -->
+                       <th></th>
+                       <th>✓</th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Edit EditRequest</td>
+                       <th>✓<sup>1</sup></th> <!-- new -->
+                       <th></th>
+                       <th>✓</th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Make Release</td>
+                       <th>✓</th> <!-- new -->
+                       <th></th>
+                       <th>✓</th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Approve Release</td>
+                       <th></th> <!-- new -->
+                       <th></th>
+                       <th></th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Change Release URL</td>
+                       <th></th> <!-- new -->
+                       <th></th>
+                       <th></th> <!-- member -->
+                       <th></th>
+                       <th></th> <!-- editor -->
+                       <th></th>
+                       <th></th> <!-- moderator -->
+                       <th></th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Set Email</td>
+                       <th>✓</th> <!-- new -->
+                       <th></th>
+                       <th>✓</th> <!-- member -->
+                       <th></th>
+                       <th>✓</th> <!-- editor -->
+                       <th></th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓<sup>2</sup></th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+               <tr>
+                       <td>Set Rank</td>
+                       <th></th> <!-- new -->
+                       <th></th>
+                       <th></th> <!-- member -->
+                       <th></th>
+                       <th></th> <!-- editor -->
+                       <th></th>
+                       <th>✓</th> <!-- moderator -->
+                       <th>✓</th>
+                       <th>✓</th> <!-- admin -->
+                       <th>✓</th>
+               </tr>
+       </tbody>
+</table>
+
+
+1. User must be the author of the EditRequest.
+2. Target user cannot be an admin.
index e6f33d1f971f6689d4716da178c78d9dd4d78dc9..30d0d488ad6464fcc5f5150a34735f1297621bc6 100644 (file)
@@ -150,3 +150,51 @@ a:hover {
        background: #161;
        border: 1px solid #393;
 }
+
+table {
+       font-family: "Arial Black", Gadget, sans-serif;
+       border: 2px solid #000000;
+       background-color: #4A4A4A;
+       width: 100%;
+       text-align: center;
+       border-collapse: collapse;
+}
+table td, table th {
+       border: 1px solid #4A4A4A;
+       padding: 3px 2px;
+}
+table tbody td {
+       font-size: 13px;
+       color: #E6E6E6;
+}
+table tr:nth-child(even) {
+       background: #888888;
+}
+table thead {
+       background: #000000;
+       border-bottom: 3px solid #000000;
+}
+table thead th {
+       font-size: 15px;
+       font-weight: bold;
+       color: #E6E6E6;
+       text-align: center;
+       border-left: 2px solid #4A4A4A;
+}
+table thead th:first-child {
+       border-left: none;
+}
+
+table tfoot {
+       font-size: 12px;
+       font-weight: bold;
+       color: #E6E6E6;
+       background: #000000;
+       background: -moz-linear-gradient(top, #404040 0%, #191919 66%, #000000 100%);
+       background: -webkit-linear-gradient(top, #404040 0%, #191919 66%, #000000 100%);
+       background: linear-gradient(to bottom, #404040 0%, #191919 66%, #000000 100%);
+       border-top: 1px solid #4A4A4A;
+}
+table tfoot td {
+       font-size: 12px;
+}
diff --git a/app/templates/flatpage.html b/app/templates/flatpage.html
new file mode 100644 (file)
index 0000000..167345d
--- /dev/null
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+
+{% block title %}
+{{ page['title'] }}
+{% endblock %}
+
+{% block content %}
+       <h1>{{ page['title'] }}</h1>
+
+       {{ page.html | safe }}
+{% endblock %}
index 22ed5ab4dd1326a01933ca144c349bfb326cba28..bf99d097448a56a139e24ec686abf1a0fbbf3361 100644 (file)
@@ -1,4 +1,4 @@
-from app import app
+from app import app, pages
 from flask import *
 from flask_user import *
 from flask_login import login_user, logout_user
@@ -31,3 +31,10 @@ def home_page():
        return render_template("index.html", packages=packages)
 
 from . import users, githublogin, packages, sass, tasks, admin, notifications
+
+@menu.register_menu(app, ".help", "Help", order=19, endpoint_arguments_constructor=lambda: { 'path': 'help' })
+@app.route('/<path:path>/')
+def flatpage(path):
+    page = pages.get_or_404(path)
+    template = page.meta.get('template', 'flatpage.html')
+    return render_template(template, page=page)
index 9e79b2709d3d19808fe7d8fb84e3ffc4a2bc2bd7..0d131a606489e978f49a4353c42045b84ea5b95c 100644 (file)
@@ -10,3 +10,4 @@ celery==4.0.2
 redis==2.10.6
 beautifulsoup4==4.6.0
 lxml==4.2.1
+Flask-FlatPages==0.6