From 217af324c4dfbe33146bcd3fafab86e319e3a6c3 Mon Sep 17 00:00:00 2001 From: Damian Myrda Date: Tue, 17 Sep 2024 16:24:50 -0500 Subject: [PATCH] Refactor --- .pre-commit-config.yaml | 9 -- Dockerfile | 22 +++++ config.py | 10 +- database.db | Bin 8192 -> 0 bytes database.json | 12 --- database.py | 50 +--------- main.py | 35 ++++--- models/discussion.py | 33 +------ models/event.py | 25 ++--- models/group.py | 31 ++----- models/member.py | 5 +- models/project.py | 5 - models/update.py | 14 +-- run.sh | 4 - schoology.py | 139 ++++++++++++++-------------- static/intro.css | 9 +- static/{style.css => main.css} | 12 ++- templates/discussions.html | 24 ++--- templates/elements/authors.html | 7 +- templates/elements/datetime.html | 10 +- templates/elements/discussions.html | 9 +- templates/elements/events.html | 20 ++-- templates/elements/projects.html | 26 ++++-- templates/elements/space.html | 14 +-- templates/elements/updates.html | 23 +++-- templates/home.html | 35 ++++--- templates/members.html | 10 +- templates/projects.html | 35 ++++--- templates/updates.html | 24 ++--- 29 files changed, 314 insertions(+), 338 deletions(-) delete mode 100644 .pre-commit-config.yaml create mode 100644 Dockerfile delete mode 100644 database.db delete mode 100644 database.json delete mode 100755 run.sh rename static/{style.css => main.css} (67%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 91a0355..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,9 +0,0 @@ -repos: - - repo: https://github.com/psf/black - rev: 24.4.2 - hooks: - - id: black - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 - hooks: - - id: prettier diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fb0f002 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.11-slim + +RUN apt-get update && apt-get install -y \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app/ +COPY . /app/ + +RUN pip install --no-cache-dir \ + gunicorn \ + flask \ + schoolopy \ + cachecontrol \ + google-auth \ + google_auth_oauthlib + +ENV PATH="/app/venv/bin:$PATH" + +EXPOSE 80 + +CMD ["gunicorn", "-b", "0.0.0.0:80", "main:app"] diff --git a/config.py b/config.py index eca7a57..0fed17c 100644 --- a/config.py +++ b/config.py @@ -1,3 +1,7 @@ -DOMAIN = "https://schoology.d214.org" -GROUP_ID = 6454678062 -REDIRECT_URL = "127.0.0.1:5000" +import os + +DOMAIN = "https://" + os.environ["DOMAIN"] + +GROUP_ID = os.environ["GROUP_ID"] +SCHOOLOGY_API_KEY = os.environ["SCHOOLOGY_API_KEY"] +SCHOOLOGY_API_SECRET = os.environ["SCHOOLOGY_API_SECRET"] diff --git a/database.db b/database.db deleted file mode 100644 index a3b1cf5bd45373f5ebffbc9fa01b822186c101a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeI%F-yZh6ae76QV~R{;NVnvV+)cD4uX@lRvltRTXB+dxt`{v$%WjDn$5cESpTor zrWL#BYT-SSyj<>aFZs43y{kZ@f_sz20%4zRGtSu&0As8&KV6yych~CtewwD^zoNpt zr}r&a#cQX`9TX%$0wh2JBtQZrKmsH{0wh2JB(TB);{(3FTd(uC7K(7B(#$+6iFT1I z?dwjf-+_MXIOxFQDKs|VMV-<=(ttwPJ<&>D5Vq1W14cNPq-LfCNZ@1W14cNZ`K;jH`U@ta)CvO`PVa zGU!RI61P8ZkMa<1RcPIR`36SX!gD!jzE(eX=AUyn`Pe)Wu@(tj6xmQrgcl*E_R#kq fG)8&oNfZ0ANo1rH3g3-pT?V%7GLWu|=Ssf-C3tCn diff --git a/database.json b/database.json deleted file mode 100644 index 89638d3..0000000 --- a/database.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "py/object": "database.Data", - "projects": [ - { - "py/object": "project.Project", - "name": "Computer Science Club Website", - "description": "(this website)", - "authors": ["Damian Myrda"], - "source": "https://github.com/moncheeta/computer_science_club.git" - } - ] -} diff --git a/database.py b/database.py index 18fdd21..7dde682 100644 --- a/database.py +++ b/database.py @@ -1,38 +1,13 @@ from models import Project -import jsonpickle as json import sqlite3 import pickle -class Data: - projects = [] - - def __init__(self, projects=[]): - self.projects = projects - - -class JSONDatabase: +class Database: def __init__(self): - self.projects = [] - self.read() - - def read(self): - with open("database.json", "r") as file: - self.projects = json.decode(file.read()).projects - return self.projects - - def write(self): - with open("database.json", "w") as file: - file.write(json.encode(Data(self.projects))) - - def add(self, project): - self.projects.append(project) - self.write() - - -class SQLDatabase: - def __init__(self): - self.connection = sqlite3.connect("database.db", check_same_thread=False) + self.connection = sqlite3.connect( + "database.db", check_same_thread=False + ) self.cursor = self.connection.cursor() self.cursor.execute( """CREATE TABLE IF NOT EXISTS projects ( @@ -75,19 +50,4 @@ class SQLDatabase: self.write() -class ProjectDatabase: - def __init__(self): - # self.database = JSONDatabase() - self.database = SQLDatabase() - - def read(self): - return self.database.read() - - def write(self): - self.database.write() - - def add(self, project): - self.database.add(project) - - -database = ProjectDatabase() +database = Database() diff --git a/main.py b/main.py index c2498e2..9e935b4 100644 --- a/main.py +++ b/main.py @@ -5,30 +5,36 @@ sys.path.append(os.path.join(PROJECT_DIR, "config.py")) sys.path.append(os.path.join(PROJECT_DIR, "models")) sys.path.append(os.path.join(PROJECT_DIR, "projects.py")) sys.path.append(os.path.join(PROJECT_DIR, "schoology.py")) -from config import REDIRECT_URL -from models import Project +from config import DOMAIN +from models import Group, Project from database import database from schoology import group from flask import Flask, request, redirect, abort, render_template, session from cachecontrol import CacheControl app = Flask(__name__) -app.secret_key = "https://computer-science-club.moncheeto.repl.co" +app.secret_key = DOMAIN @app.route("/") def index(): - return render_template("home.html", group=group, account=session.get("name")) + return render_template( + "home.html", group=group, account=session.get("name") + ) @app.route("/updates") def updates(): - return render_template("updates.html", group=group, account=session.get("name")) + return render_template( + "updates.html", group=group, account=session.get("name") + ) @app.route("/discussions") def discussions(): - return render_template("discussions.html", group=group, account=session.get("name")) + return render_template( + "discussions.html", group=group, account=session.get("name") + ) @app.route("/projects", methods=["GET", "POST"]) @@ -63,7 +69,9 @@ def add_project(): @app.route("/members") def members(): - return render_template("members.html", group=group, account=session.get("name")) + return render_template( + "members.html", group=group, account=session.get("name") + ) import requests @@ -81,10 +89,11 @@ GOOGLE_AUTH_SCOPES = [ "openid", ] os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" + flow = Flow.from_client_secrets_file( client_secrets_file=GOOGLE_CLIENT_SECRETS_FILE, scopes=GOOGLE_AUTH_SCOPES, - redirect_uri="http://" + REDIRECT_URL + "/login/callback", + redirect_uri=DOMAIN + "/login/callback", ) @@ -103,9 +112,13 @@ def login_callback(): credentials = flow.credentials request_session = requests.session() cached_session = CacheControl(request_session) - token_request = google.auth.transport.requests.Request(session=cached_session) + token_request = google.auth.transport.requests.Request( + session=cached_session + ) id_info = id_token.verify_oauth2_token( - id_token=credentials._id_token, request=token_request, audience=GOOGLE_CLIENT_ID + id_token=credentials._id_token, + request=token_request, + audience=GOOGLE_CLIENT_ID, ) session["name"] = id_info.get("name") return redirect("/") @@ -118,4 +131,4 @@ def logout(): if __name__ == "__main__": - app.run(host="0.0.0.0") + app.run(host="0.0.0.0", port=80) diff --git a/models/discussion.py b/models/discussion.py index dc973b4..cc3e9ff 100644 --- a/models/discussion.py +++ b/models/discussion.py @@ -2,38 +2,7 @@ from config import DOMAIN class Discussion: - name = "" - description = "" - link = f"{DOMAIN}/discussion/" - def __init__(self, id, name, description): - self.link += str(id) - self.name = name - self.description = description - - -from datetime import datetime -from config import DOMAIN - - -class Event: - name = "" - description = "" - start = datetime.now() - end = None - differentDay = False - link = f"{DOMAIN}/event/" - - def __init__(self, id, name, description, start, end): - self.link += str(id) self.name = name self.description = description - self.start = start - self.end = end - if ( - end - and self.end.year >= self.start.year - and self.end.month >= self.start.month - and self.end.day > start.day - ): - differentDay = True + self.link = f"{DOMAIN}/discussion/{str(id)}" diff --git a/models/event.py b/models/event.py index 00df198..7140c70 100644 --- a/models/event.py +++ b/models/event.py @@ -1,25 +1,18 @@ -from datetime import datetime from config import DOMAIN class Event: - name = "" - description = "" - start = datetime.now() - end = None - differentDay = False - link = f"{DOMAIN}/event/" - - def __init__(self, id, name, description, start, end): - self.link += str(id) + def __init__(self, id, name, description, start, end=None): self.name = name self.description = description + self.link = f"{DOMAIN}/event/{str(id)}" self.start = start self.end = end - if ( - end - and self.end.year >= self.start.year - and self.end.month >= self.start.month - and self.end.day > start.day + if end and ( + self.end.year != self.start.year + or self.end.month != self.start.month + or self.end.day != start.day ): - differentDay = True + self.differentDay = True + else: + self.differentDay = False diff --git a/models/group.py b/models/group.py index b830174..24a070d 100644 --- a/models/group.py +++ b/models/group.py @@ -1,25 +1,12 @@ class Group: - name = "" - description = "" - picture = "https://www.shutterstock.com/image-vector/computer-science-icon-outline-thin-600nw-1613513884.jpg" - leaders = [] - members = [] - events = [] - updates = [] - discussions = [] - projects = [] - - def __init__( - self, name, description, events, updates, discussions, projects, members - ): + def __init__(self, name, description): self.name = name self.description = description - self.events = events - self.updates = updates - self.discussions = discussions - self.projects = projects - for member in members: - if member.leader: - self.leaders.append(member) - continue - self.members.append(member) + self.picture = "https://www.shutterstock.com/image-vector/computer-science-icon-outline-thin-600nw-1613513884.jpg" + + self.events = [] + self.updates = [] + self.discussions = [] + + self.leaders = [] + self.members = [] diff --git a/models/member.py b/models/member.py index c53b566..0d0f099 100644 --- a/models/member.py +++ b/models/member.py @@ -1,7 +1,4 @@ class Member: - name = "" - leader = False - - def __init__(self, name="", leader=False): + def __init__(self, name, leader=False): self.name = name self.leader = leader diff --git a/models/project.py b/models/project.py index 06f90ec..dc29ac1 100644 --- a/models/project.py +++ b/models/project.py @@ -1,9 +1,4 @@ class Project: - name = "" - description = "" - authors = [] - source = None - def __init__(self, name, description, authors, source=None): self.name = name self.description = description diff --git a/models/update.py b/models/update.py index 82b2f77..62e6a40 100644 --- a/models/update.py +++ b/models/update.py @@ -1,13 +1,5 @@ -from datetime import datetime -from member import Member - - class Update: - member = Member() - text = "" - time = datetime.now() - - def __init__(self, member, text, time): + def __init__(self, member, content, created): self.member = member - self.text = text - self.time = time + self.content = content + self.created = created diff --git a/run.sh b/run.sh deleted file mode 100755 index c39f14b..0000000 --- a/run.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -. ./bin/activate -flask --app main.py run diff --git a/schoology.py b/schoology.py index 0b409b6..9525f12 100644 --- a/schoology.py +++ b/schoology.py @@ -1,77 +1,72 @@ -import os +from config import DOMAIN, GROUP_ID, SCHOOLOGY_API_KEY, SCHOOLOGY_API_SECRET from datetime import datetime -from config import DOMAIN, GROUP_ID from models import Group, Event, Update, Discussion, Member -from database import database from schoolopy import Schoology, Auth +from database import database + + +auth = Auth( + SCHOOLOGY_API_KEY, + SCHOOLOGY_API_SECRET, + domain=DOMAIN, +) +api = Schoology(auth) +api.limit = 64 + +group = Group( + api.get_group(GROUP_ID).title, api.get_group(GROUP_ID).description +) + + +def get_members(): + for enrolled in api.get_group_enrollments(GROUP_ID): + member = Member(enrolled.name_display) + if enrolled.admin == 1: + group.leaders.append(member) + else: + group.members.append(member) + + +def find_member(name): + for member in group.members: + if member.name == name: + return member + return None + + +def get_updates(): + for update in api.get_group_updates(GROUP_ID): + user = api.get_user(update.uid) + member = find_member(user.name_display) + if not member: + continue + created = datetime.utcfromtimestamp(int(update.created)) + group.updates.append(Update(member, update.body, created)) + + +def get_events(): + for event in api.get_group_events(GROUP_ID): + start = datetime.strptime(event.start, "%Y-%m-%d %H:%M:%S") + end = None + if event.has_end: + end = datetime.strptime(event.end, "%Y-%m-%d %H:%M:%S") + event = Event(event.id, event.title, event.description, start, end) + group.events.append(event) + + +def get_discussions(): + for discussion in api.get_group_discussions(GROUP_ID): + group.discussions.append( + Discussion(discussion.id, discussion.title, discussion.body) + ) + + +def update(): + get_members() + get_updates() + get_events() + get_discussions() + group.projects = database.read() -class SchoologyAPI: - api = None - auth = Auth( - os.environ["SCHOOLOGY_API_KEY"], - os.environ["SCHOOLOGY_API_SECRET"], - domain=DOMAIN, - ) - - def __init__(self): - self.api = Schoology(self.auth) - self.api.limit = 64 - - def name(self): - return self.api.get_group(GROUP_ID).title - - def description(self): - return self.api.get_group(GROUP_ID).description - - def events(self): - events = [] - for event in self.api.get_group_events(GROUP_ID): - start = datetime.strptime(event.start, "%Y-%m-%d %H:%M:%S") - end = None - if event.has_end: - end = datetime.strptime(event.end, "%Y-%m-%d %H:%M:%S") - event = Event(event.id, event.title, event.description, start, end) - events.append(event) - return events - - def updates(self): - updates = [] - for update in self.api.get_group_updates(GROUP_ID): - user = self.api.get_user(update.uid) - member = Member(user.name_display) - # time = datetime.utcfromtimestamp(int(update.created)) - time = datetime.utcfromtimestamp(int(update.last_updated)) - updates.append(Update(member, update.body, time)) - return updates - - def discussions(self): - discussions = [] - for discussion in self.api.get_group_discussions(GROUP_ID): - discussions.append( - Discussion(discussion.id, discussion.title, discussion.body) - ) - return discussions - - def members(self): - members = [] - for enrolled in self.api.get_group_enrollments(GROUP_ID): - member = Member(enrolled.name_display) - if enrolled.admin == 1: - member.leader = True - members.append(member) - return members - - def group(self): - name = self.name() - description = self.description() - events = self.events() - updates = self.updates() - discussions = self.discussions() - projects = database.read() - members = self.members() - return Group(name, description, events, updates, discussions, projects, members) - - -api = SchoologyAPI() -group = api.group() +update() diff --git a/static/intro.css b/static/intro.css index 7627388..8cbd128 100644 --- a/static/intro.css +++ b/static/intro.css @@ -1,7 +1,14 @@ * { color: #ffff82; - text-align: center; background-color: black; + text-align: center; +} + +html, body { + width: 100%; + height: 100%; + margin: 0; + padding: 0; } #board { diff --git a/static/style.css b/static/main.css similarity index 67% rename from static/style.css rename to static/main.css index 752efab..828e370 100644 --- a/static/style.css +++ b/static/main.css @@ -1,14 +1,20 @@ * { color: white; + background-color: black; font-family: monospace; } +html, body { + width: 100%; + height: 100%; + margin: 0; +} + body { - background-color: black; + padding: 8px; } -input, -textarea { +input, textarea { color: black; } diff --git a/templates/discussions.html b/templates/discussions.html index 93721f8..4792b8d 100644 --- a/templates/discussions.html +++ b/templates/discussions.html @@ -1,23 +1,25 @@ + - {% import "elements/metadata.html" as metadata %} {{ metadata.head(group, - "Discussions") }} + {% import "elements/metadata.html" as metadata %} + {{ metadata.head(group, "Discussions") }} -
- {% import "elements/navigation.html" as navigation %} {{ - navigation.bar(account) }} -
- - {% import "elements/space.html" as space %} {{ space.stars(500) }} +
+ {% import "elements/navigation.html" as navigation %} + {{ navigation.bar(account) }} +
+ + {% import "elements/space.html" as space %} + {{ space.stars(500) }}

Discussions

- {% import "elements/discussions.html" as discussions %} {{ - discussions.list(group.discussions) }} + {% import "elements/discussions.html" as discussions %} + {{ discussions.list(group.discussions) }} diff --git a/templates/elements/authors.html b/templates/elements/authors.html index f7cb1a2..9a65f86 100644 --- a/templates/elements/authors.html +++ b/templates/elements/authors.html @@ -1,8 +1,9 @@ {% macro view(author) -%} {{ author }} -{%- endmacro %} {% macro list(authors) -%} +{%- endmacro %} + +{% macro list(authors) -%}
- By: {{ view(authors[0]) }}{% for author in authors[1:] %}, {{ author }}{% - endfor %} + By: {{ view(authors[0]) }}{% for author in authors[1:] %}, {{ author }}{% endfor %}
{%- endmacro %} diff --git a/templates/elements/datetime.html b/templates/elements/datetime.html index db2e889..a913bcd 100644 --- a/templates/elements/datetime.html +++ b/templates/elements/datetime.html @@ -1,3 +1,7 @@ -{% macro time(time) -%} {{ time.hour }}:{{ time.minute }} {%- endmacro %} {% -macro date(date) -%} {{ date.year }}.{{ date.month }}.{{ date.day }} {%- -endmacro %} +{% macro time(time) -%} +{{ time.hour }}:{{ time.minute }} +{%- endmacro %} + +{% macro date(date) -%} +{{ date.year }}.{{ date.month }}.{{ date.day }} +{%-endmacro %} diff --git a/templates/elements/discussions.html b/templates/elements/discussions.html index d6d5848..98eb843 100644 --- a/templates/elements/discussions.html +++ b/templates/elements/discussions.html @@ -2,7 +2,10 @@ {{ discussion.name }} {{ discussion.description }} -{%- endmacro %} {% macro list(discussions) -%} {% for discussion in discussions -%} +{%- endmacro %} + +{% macro list(discussions) -%} +{% for discussion in discussions %}
{{ view(discussion) }}
-{% endfor %} {%- endmacro %} +{% endfor %} +{%- endmacro %} diff --git a/templates/elements/events.html b/templates/elements/events.html index 948418a..b2fcfb0 100644 --- a/templates/elements/events.html +++ b/templates/elements/events.html @@ -5,13 +5,19 @@ if event.end %} {% if event.differentDay %} to {{ datetime.date(event.end) }} {% endif %} {% endif %} -{%- endmacro %} {% macro next(event) -%} +{%- endmacro %} + +{% macro next(event) -%} - Upcoming: {{ event.name }} at {{ datetime.time(event.start) }} {% if event.end - %} to {{ datetime.time(event.end) }} {% endif %} on {{ - datetime.date(event.start) }} {% if event.end %} {% if event.differentDay %} - to {{ datetime.date(event.end) }} {% endif %} {% endif %} + Upcoming: {{ event.name }} at {{ datetime.time(event.start) }} {% if event.end %} to {{ + datetime.time(event.end) }} {% endif %} on {{ datetime.date(event.start) }} {% + if event.end %} {% if event.differentDay %} to {{ datetime.date(event.end) }} + {% endif %} {% endif %} -{%- endmacro %} {% macro upcoming(events) -%} {% for event in events %} +{%- endmacro %} + +{% macro upcoming(events) -%} +{% for event in events %}
view(event)
-{% endfor %} {%- endmacro %} +{% endfor %} +{%- endmacro %} diff --git a/templates/elements/projects.html b/templates/elements/projects.html index 4c6067d..0c9d654 100644 --- a/templates/elements/projects.html +++ b/templates/elements/projects.html @@ -1,20 +1,32 @@ -{% import "elements/authors.html" as authors %} {% macro view(project) -%} +{% import "elements/authors.html" as authors %} + +{% macro view(project) -%}

{{ project.name }}

{% if project.description %}

{{ project.description }}

-{% endif %} {% if project.source %} +{% endif %} +{% if project.source %} Source Code
-{% endif %} {{ authors.list(project.authors) }} {% if project.images %} {% for -image in project.images %} +{% endif %} +{{ authors.list(project.authors) }} +{% if project.images %} +{% for image in project.images %} -{% endfor %} {% endif %} {%- endmacro %} {% macro list(projects) -%} {% for -project in projects %} +{% endfor %} +{% endif %} +{%- endmacro %} + +{% macro list(projects) -%} +{% for project in projects %}
{{ view(project) }}
-{% endfor %} {%- endmacro %} {% macro new() -%} +{% endfor %} +{%- endmacro %} + +{% macro new() -%}

Add New Project

diff --git a/templates/elements/space.html b/templates/elements/space.html index 0a3e7e0..83deaf0 100644 --- a/templates/elements/space.html +++ b/templates/elements/space.html @@ -2,12 +2,18 @@ {%- endmacro %} diff --git a/templates/elements/updates.html b/templates/elements/updates.html index deb347f..c6a2ec5 100644 --- a/templates/elements/updates.html +++ b/templates/elements/updates.html @@ -1,13 +1,20 @@ -{% import "elements/datetime.html" as datetime %} {% macro view(update) -%} +{% import "elements/datetime.html" as datetime %} + +{% macro recent(update) -%}

- {{ update.member.name }} on {{ datetime.date(update.time) }} at {{ - datetime.time(update.time) }}: {{ update.text }} + Annocement from {{ update.member.name }}: {{ update.content }}

-{%- endmacro %} {% macro recent(update) -%} +{%- endmacro %} + +{% macro view(update) -%}

- Annocement from {{ update.member.name }} on {{ datetime.date(update.time) }} - at {{ datetime.time(update.time) }}: {{ update.text }} + {{ update.member.name }} on {{ datetime.date(update.created) }} at {{ + datetime.time(update.created) }}: {{ update.content }}

-{%- endmacro %} {% macro list(updates) -%} {% for update in updates %} +{%- endmacro %} + +{% macro list(updates) -%} +{% for update in updates %}
{{ view(update) }}
-{% endfor %} {%- endmacro %} +{% endfor %} +{%- endmacro %} diff --git a/templates/home.html b/templates/home.html index bfea052..2ea0465 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,26 +1,39 @@ + - {% import "elements/metadata.html" as metadata %} {{ metadata.head(group)}} + {% import "elements/metadata.html" as metadata %} + {{ metadata.head(group)}} -
- {% import "elements/navigation.html" as navigation %} {{ - navigation.bar(account) }} -
- - {% import "elements/space.html" as space %} {{ space.stars(500) }} +
+ {% import "elements/navigation.html" as navigation %} {{ + navigation.bar(account) }} +
+ + {% import "elements/space.html" as space %} + {{ space.stars(500) }}

{{ group.name }}

{{ group.description }}

- {% import "elements/events.html" as events %} {{ - events.next(group.events[0]) }} {% import "elements/updates.html" as - updates %} {{ updates.recent(group.updates[0]) }} + {% import "elements/events.html" as events %} + {% if group.events | length > 0 %} + {{ events.next(group.events[0]) }} + {% else %} +

No upcoming events.

+ {% endif %} + + {% import "elements/updates.html" as updates %} + {% if group.updates | length > 0 %} + {{ updates.recent(group.updates[0]) }} + {% else %} +

No recent updates.

+ {% endif %}
diff --git a/templates/members.html b/templates/members.html index 903f15b..4d008e4 100644 --- a/templates/members.html +++ b/templates/members.html @@ -1,7 +1,8 @@ + - {% import "elements/metadata.html" as metadata %} {{ metadata.head(group, - "Members") }} + {% import "elements/metadata.html" as metadata %} + {{ metadata.head(group, "Members") }} - {% import "elements/space.html" as space %} {{ space.stars(200) }} + {% import "elements/space.html" as space %} + {{ space.stars(200) }}
@@ -26,7 +28,7 @@

{{ member.name }}

{% endfor %}
-

CREATED BY

+

THIS WAS CREATED BY

Damian Myrda

diff --git a/templates/projects.html b/templates/projects.html index edd3d6b..946258a 100644 --- a/templates/projects.html +++ b/templates/projects.html @@ -1,26 +1,35 @@ + - {% import "elements/metadata.html" as metadata %} {% if create %} {{ - metadata.head(group, "New Project") }} {% else %} {{ metadata.head(group, - "Projects") }} {% endif %} + {% import "elements/metadata.html" as metadata %} + {% if create %} + {{ metadata.head(group, "New Project") }} + {% else %} + {{ metadata.head(group, "Projects") }} + {% endif %} -
- {% import "elements/navigation.html" as navigation %} {{ - navigation.bar(account) }} -
- - {% import "elements/space.html" as space %} {{ space.stars(500) }} {% import - "elements/projects.html" as projects %} {% if create %} {{ projects.new() }} +
+ {% import "elements/navigation.html" as navigation %} + {{ navigation.bar(account) }} +
+ + {% import "elements/space.html" as space %} + {{ space.stars(500) }} + {% import "elements/projects.html" as projects %} + {% if create %} + {{ projects.new() }} {% else %}

Projects

- {{ projects.list(group.projects) }} {% if account %} + {{ projects.list(group.projects) }} + {% if account %} Add a Project - {% endif %} {% endif %} + {% endif %} + {% endif %} diff --git a/templates/updates.html b/templates/updates.html index 970f71b..76c888b 100644 --- a/templates/updates.html +++ b/templates/updates.html @@ -1,23 +1,25 @@ + - {% import "elements/metadata.html" as metadata %} {{ metadata.head(group, - "Updates") }} + {% import "elements/metadata.html" as metadata %} + {{ metadata.head(group, "Updates") }} -
- {% import "elements/navigation.html" as navigation %} {{ - navigation.bar(account) }} -
- - {% import "elements/space.html" as space %} {{ space.stars(500) }} +
+ {% import "elements/navigation.html" as navigation %} + {{ navigation.bar(account) }} +
+ + {% import "elements/space.html" as space %} + {{ space.stars(500) }}

Updates

- {% import "elements/updates.html" as updates %} {{ - updates.list(group.updates) }} + {% import "elements/updates.html" as updates %} + {{ updates.list(group.updates) }} -- 2.43.4