diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/__init__.py | 4 | ||||
-rw-r--r-- | app/flatpages/help.md | 3 | ||||
-rw-r--r-- | app/flatpages/help/ranks_permissions.md | 173 | ||||
-rw-r--r-- | app/scss/components.scss | 48 | ||||
-rw-r--r-- | app/templates/flatpage.html | 11 | ||||
-rw-r--r-- | app/views/__init__.py | 9 |
6 files changed, 247 insertions, 1 deletions
diff --git a/app/__init__.py b/app/__init__.py index 506ed27..6465407 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -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 index 0000000..27329f5 --- /dev/null +++ b/app/flatpages/help.md @@ -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 index 0000000..77ac13e --- /dev/null +++ b/app/flatpages/help/ranks_permissions.md @@ -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. diff --git a/app/scss/components.scss b/app/scss/components.scss index e6f33d1..30d0d48 100644 --- a/app/scss/components.scss +++ b/app/scss/components.scss @@ -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 index 0000000..167345d --- /dev/null +++ b/app/templates/flatpage.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %} +{{ page['title'] }} +{% endblock %} + +{% block content %} + <h1>{{ page['title'] }}</h1> + + {{ page.html | safe }} +{% endblock %} diff --git a/app/views/__init__.py b/app/views/__init__.py index 22ed5ab..bf99d09 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -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) |