diff options
| author | 2018-05-17 14:33:56 +0100 | |
|---|---|---|
| committer | 2018-05-17 14:33:56 +0100 | |
| commit | b1c1b5b0bec07a15141577b8cc4939b9071b1d28 (patch) | |
| tree | e0d01a4fc80e5a9dbde0b0032b2d748eef38a26d | |
| parent | Commas are hard (diff) | |
Restructure code jams page layout
| -rw-r--r-- | pysite/base_route.py | 3 | ||||
| -rw-r--r-- | pysite/views/main/info/jams.py | 6 | ||||
| -rw-r--r-- | pysite/views/main/jams/__init__.py | 0 | ||||
| -rw-r--r-- | pysite/views/main/jams/index.py | 7 | ||||
| -rw-r--r-- | pysite/views/main/jams/info.py | 7 | ||||
| -rw-r--r-- | pysite/views/main/jams/signup.py | 9 | ||||
| -rw-r--r-- | pysite/views/staff/jams/__init__.py | 0 | ||||
| -rw-r--r-- | templates/main/base.html | 6 | ||||
| -rw-r--r-- | templates/main/jams/index.html | 15 | ||||
| -rw-r--r-- | templates/main/jams/info.html (renamed from templates/main/info/jams.html) | 0 | ||||
| -rw-r--r-- | templates/main/jams/signup.html | 15 | ||||
| -rw-r--r-- | templates/main/navigation.html | 40 | ||||
| -rw-r--r-- | templates/wiki/base.html | 20 | 
13 files changed, 100 insertions, 28 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py index a9db9c51..8449f228 100644 --- a/pysite/base_route.py +++ b/pysite/base_route.py @@ -17,6 +17,7 @@ class BaseView(MethodView, OauthMixin):      """      name = None  # type: str +    blueprint = None  # type: str      def render(self, *template_names: str, **context: Any) -> str:          """ @@ -98,6 +99,8 @@ class RouteView(BaseView):          blueprint.add_url_rule(cls.path, view_func=cls.as_view(cls.name)) +        cls.name = f"{blueprint.name}.{cls.name}"  # Add blueprint to page name +  class APIView(RouteView):      """ diff --git a/pysite/views/main/info/jams.py b/pysite/views/main/info/jams.py index 85b6a6dc..b654ec1d 100644 --- a/pysite/views/main/info/jams.py +++ b/pysite/views/main/info/jams.py @@ -1,7 +1,7 @@ -from pysite.base_route import TemplateView +from pysite.base_route import RedirectView -class IndexView(TemplateView): +class JamsView(RedirectView):      path = "/info/jams"      name = "info.jams" -    template = "main/info/jams.html" +    page = "main.jams.index" diff --git a/pysite/views/main/jams/__init__.py b/pysite/views/main/jams/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/pysite/views/main/jams/__init__.py diff --git a/pysite/views/main/jams/index.py b/pysite/views/main/jams/index.py new file mode 100644 index 00000000..56f079fc --- /dev/null +++ b/pysite/views/main/jams/index.py @@ -0,0 +1,7 @@ +from pysite.base_route import TemplateView + + +class JamsIndexView(TemplateView): +    path = "/jams" +    name = "jams.index" +    template = "main/jams/info.html" diff --git a/pysite/views/main/jams/info.py b/pysite/views/main/jams/info.py new file mode 100644 index 00000000..fd4615e9 --- /dev/null +++ b/pysite/views/main/jams/info.py @@ -0,0 +1,7 @@ +from pysite.base_route import TemplateView + + +class JamsInfoView(TemplateView): +    path = "/jams/info" +    name = "jams.info" +    template = "main/jams/info.html" diff --git a/pysite/views/main/jams/signup.py b/pysite/views/main/jams/signup.py new file mode 100644 index 00000000..632da6d6 --- /dev/null +++ b/pysite/views/main/jams/signup.py @@ -0,0 +1,9 @@ +from pysite.base_route import RouteView + + +class JamsSignupView(RouteView): +    path = "/jams/signup" +    name = "jams.signup" + +    def get(self): +        return self.render("main/jams/signup.html") diff --git a/pysite/views/staff/jams/__init__.py b/pysite/views/staff/jams/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/pysite/views/staff/jams/__init__.py diff --git a/templates/main/base.html b/templates/main/base.html index cfe41099..9b25a724 100644 --- a/templates/main/base.html +++ b/templates/main/base.html @@ -28,14 +28,14 @@          {% endblock %}      </head> -    <body class="page-{{ current_page }}"> -        {% if current_page == "index" %} +    <body class="page-{{ current_page.replace(".", "-") }}"> +        {% if current_page == "main.index" %}          <div class="uk-offcanvas-content uk-section-primary">          {% else %}          <div class="uk-offcanvas-content">          {% endif %}              {% include "main/navigation.html" %} -            {% if current_page != "index" %} +            {% if current_page != "main.index" %}                  {% block beta_error %}                      <div class="uk-container uk-section" style="padding-top: 10px; padding-bottom: 10px;">                          <div class="uk-container uk-container-small"> diff --git a/templates/main/jams/index.html b/templates/main/jams/index.html new file mode 100644 index 00000000..e1f7e56d --- /dev/null +++ b/templates/main/jams/index.html @@ -0,0 +1,15 @@ +{% extends "main/base.html" %} +{% block title %}Home{% endblock %} +{% block og_title %}Home{% endblock %} +{% block content %} +<div class="uk-section"> +    <div class="uk-container uk-container-small uk-text-center"> +        <h1 class="uk-header"> +            Jams +        </h1> +        <p class="uk-article-meta"> +            # TODO +        </p> +    </div> +</div> +{% endblock %} diff --git a/templates/main/info/jams.html b/templates/main/jams/info.html index 99b325ab..99b325ab 100644 --- a/templates/main/info/jams.html +++ b/templates/main/jams/info.html diff --git a/templates/main/jams/signup.html b/templates/main/jams/signup.html new file mode 100644 index 00000000..d363f3a3 --- /dev/null +++ b/templates/main/jams/signup.html @@ -0,0 +1,15 @@ +{% extends "main/base.html" %} +{% block title %}Home{% endblock %} +{% block og_title %}Home{% endblock %} +{% block content %} +<div class="uk-section"> +    <div class="uk-container uk-container-small uk-text-center"> +        <h1 class="uk-header"> +            Signup +        </h1> +        <p class="uk-article-meta"> +            # TODO +        </p> +    </div> +</div> +{% endblock %} diff --git a/templates/main/navigation.html b/templates/main/navigation.html index 8333fd18..d15b46f7 100644 --- a/templates/main/navigation.html +++ b/templates/main/navigation.html @@ -13,7 +13,7 @@          <div class="uk-navbar-right">              <ul class="uk-navbar-nav uk-visible@m"> -                {% if current_page == "index" %} +                {% if current_page == "main.index" %}                      <li class="uk-active"><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home"></i>  Home</a></li>                  {% else %}                      <li><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home fa-fw"></i>  Home</a></li> @@ -42,51 +42,63 @@                                  <li class="uk-active"><a style="color: #7289DA !important"><i class="uk-icon fas fa-exclamation-triangle"></i>  Debug mode</a></li>                              {% endif %} -                            {% if current_page.startswith("info") %} +                            {% if current_page.startswith("main.info") %}                                  <li class="uk-nav-header uk-active"><a href="{{ url_for('main.info.index') }}">Information</a></li>                              {% else %}                                  <li class="uk-nav-header"><a href="{{ url_for('main.info.index') }}">Information</a></li>                              {% endif %} -                            {% if current_page == "info.jams" %} -                                <li class="uk-active"><a href="{{ url_for('main.info.jams') }}">Code Jams</a></li> -                            {% else %} -                                <li><a href="{{ url_for('main.info.jams') }}">Code Jams</a></li> -                            {% endif %} - -                            {% if current_page == "info.help" %} +                            {% if current_page == "main.info.help" %}                                  <li class="uk-active"><a href="{{ url_for('main.info.help') }}">Getting Help</a></li>                              {% else %}                                  <li><a href="{{ url_for('main.info.help') }}">Getting Help</a></li>                              {% endif %} -                            {% if current_page == "info.resources" %} +                            {% if current_page == "main.info.resources" %}                                  <li class="uk-active"><a href="{{ url_for('main.info.resources') }}">Resources</a></li>                              {% else %}                                  <li><a href="{{ url_for('main.info.resources') }}">Resources</a></li>                              {% endif %} -                            {% if current_page.startswith("about") %} +                            {% if current_page.startswith("main.about") %}                                  <li class="uk-nav-header uk-active"><a href="{{ url_for('main.about.index') }}">About</a></li>                              {% else %}                                  <li class="uk-nav-header"><a href="{{ url_for('main.about.index') }}">About</a></li>                              {% endif %} -                            {% if current_page == "about.partners" %} +                            {% if current_page == "main.about.partners" %}                                  <li class="uk-active"><a href="{{ url_for('main.about.partners') }}">Partners</a></li>                              {% else %}                                  <li><a href="{{ url_for('main.about.partners') }}">Partners</a></li>                              {% endif %} -                            {% if current_page == "about.rules" %} +                            {% if current_page == "main.about.rules" %}                                  <li class="uk-active"><a href="{{ url_for('main.about.rules') }}">Server Rules</a></li>                              {% else %}                                  <li><a href="{{ url_for('main.about.rules') }}">Server Rules</a></li>                              {% endif %} +                            {% if current_page.startswith("main.jams") %} +                                <li class="uk-nav-header uk-active"><a href="{{ url_for('main.jams.index') }}">Code Jams</a></li> +                            {% else %} +                                <li class="uk-nav-header"><a href="{{ url_for('main.jams.index') }}">Code Jams</a></li> +                            {% endif %} + +                            {% if current_page == "main.jams.index" %} +                                <li class="uk-active"><a href="{{ url_for('main.jams.index') }}">Info</a></li> +                            {% else %} +                                <li><a href="{{ url_for('main.jams.index') }}">Info</a></li> +                            {% endif %} + +                            {% if current_page == "main.jams.signup" %} +                                <li class="uk-active"><a href="{{ url_for('main.jams.signup') }}">Sign Up</a></li> +                            {% else %} +                                <li><a href="{{ url_for('main.jams.signup') }}">Sign Up</a></li> +                            {% endif %} +                              <li class="uk-nav-divider"></li> -                            {% if current_page.startswith("about.privacy") %} +                            {% if current_page.startswith("main.about.privacy") %}                                  <li class="uk-active"><a href="{{ url_for('main.about.privacy') }}">Privacy</a></li>                              {% else %}                                  <li><a href="{{ url_for('main.about.privacy') }}">Privacy</a></li> diff --git a/templates/wiki/base.html b/templates/wiki/base.html index 9b31d83b..9fa07e9b 100644 --- a/templates/wiki/base.html +++ b/templates/wiki/base.html @@ -27,7 +27,7 @@          {% endblock %}      </head> -    <body class="page-{{ current_page }}"> +    <body class="page-{{ current_page.replace(".", "-") }}">          <div class="uk-offcanvas-content uk-flex uk-flex-column">              {% include "main/navigation.html" %}              <div class="uk-flex uk-flex-row uk-flex-1"> @@ -70,13 +70,17 @@                              <i class="uk-icon fas fa-fw fa-cube"></i>  Minecraft                          </a></li> -                        {% set ACTIONABLE_PAGES = ["page", "edit", "history.show", "history.compare", "source", "delete"] %} +                        {% set ACTIONABLE_PAGES = [ +                                "wiki.page", "wiki.edit", "wiki.history.show", +                                "wiki.history.compare", "wiki.source", "wiki.delete", +                                "wiki.move" +                        ] %}                          {% set actionable = current_page in ACTIONABLE_PAGES %}                          {% if actionable %}                              <li class="uk-nav-divider"></li> -                            {% if current_page == "edit" %} +                            {% if current_page == "wiki.edit" %}                                  <li>                                      <a href="{{ url_for("wiki.page", page=page) }}">                                          <i class="uk-icon fas fa-fw fa-arrow-left"></i>  Back @@ -90,7 +94,7 @@                                  </li>                              {% endif %} -                            {% if current_page == "delete" %} +                            {% if current_page == "wiki.delete" %}                                  <li>                                      <a href="{{ url_for("wiki.page", page=page) }}">                                          <i class="uk-icon fas fa-fw fa-arrow-left"></i>  Back @@ -104,7 +108,7 @@                                  </li>                              {% endif %} -                            {% if current_page == "move" %} +                            {% if current_page == "wiki.move" %}                                  <li>                                      <a href="{{ url_for("wiki.page", page=page) }}">                                          <i class="uk-icon fas fa-fw fa-arrow-left"></i>  Back @@ -118,13 +122,13 @@                                  </li>                              {% endif %} -                            {% if current_page == "history.show" %} +                            {% if current_page == "wiki.history.show" %}                                  <li>                                      <a href="{{ url_for("wiki.page", page=page) }}">                                          <i class="uk-icon fas fa-fw fa-arrow-left"></i>  Back                                      </a>                                  </li> -                            {% elif current_page == "history.compare" %} +                            {% elif current_page == "wiki.history.compare" %}                                  <li>                                      <a href="{{ url_for("wiki.history.show", page=slug) }}">                                          <i class="uk-icon fas fa-fw fa-arrow-left"></i>  Back @@ -138,7 +142,7 @@                                  </li>                              {% endif %} -                            {% if current_page == "source" %} +                            {% if current_page == "wiki.source" %}                                  <li>                                      <a href="{{ url_for("wiki.page", page=page) }}">                                          <i class="uk-icon fas fa-fw fa-arrow-left"></i>  Back  |