diff --git a/app/__init__.py b/app/__init__.py index 506ed27d..6465407f 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 00000000..27329f59 --- /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 00000000..77ac13e1 --- /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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RankNew MemberMemberEditorModeratorAdmin
Owner of thingYNYNYNYNYN
Create Package
Approve Package
Edit Package
Approve EditRequest
Edit EditRequest1
Make Release
Approve Release
Change Release URL
Set Email 2
Set Rank
+ + +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 e6f33d1f..30d0d488 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 00000000..167345de --- /dev/null +++ b/app/templates/flatpage.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %} +{{ page['title'] }} +{% endblock %} + +{% block content %} +

{{ page['title'] }}

+ + {{ page.html | safe }} +{% endblock %} diff --git a/app/views/__init__.py b/app/views/__init__.py index 22ed5ab4..bf99d097 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('//') +def flatpage(path): + page = pages.get_or_404(path) + template = page.meta.get('template', 'flatpage.html') + return render_template(template, page=page) diff --git a/requirements.txt b/requirements.txt index 9e79b270..0d131a60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ celery==4.0.2 redis==2.10.6 beautifulsoup4==4.6.0 lxml==4.2.1 +Flask-FlatPages==0.6