From fe6ccf843464e8c936f9e673c30908a01f19d961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Sun, 1 Jul 2018 13:55:13 +0200 Subject: [PATCH 01/13] Remove bootstrap from general layout Bootstrap is still used with some components --- mygpo/settings.py | 4 + mygpo/web/templates/base.html | 305 +++++++++++--------------- mygpo/web/templates/home.html | 342 ++++++++++++------------------ mygpo/web/templates/skeleton.html | 18 +- static/common.css | 93 ++++++++ static/large.css | 19 ++ static/mobile.css | 17 ++ static/screen.css | 51 +---- 8 files changed, 410 insertions(+), 439 deletions(-) create mode 100644 static/common.css create mode 100644 static/large.css create mode 100644 static/mobile.css diff --git a/mygpo/settings.py b/mygpo/settings.py index 7731c5f2f..c64e2bd7f 100644 --- a/mygpo/settings.py +++ b/mygpo/settings.py @@ -121,6 +121,10 @@ def get_intOrNone(name, default): }, }] +if DEBUG: + loaders = TEMPLATES[0]['OPTIONS']['loaders'][0][1] + TEMPLATES[0]['OPTIONS']['loaders'] = loaders + MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', diff --git a/mygpo/web/templates/base.html b/mygpo/web/templates/base.html index fd7a2137f..fe31c3ea2 100644 --- a/mygpo/web/templates/base.html +++ b/mygpo/web/templates/base.html @@ -6,202 +6,153 @@ {% block body %} +
+ +
+ -
+ + + + +
+ + {% block header %} +

Block "header" not defined for this template

+ {% endblock %} + + {% if messages %} + {% for message in messages %} +
+ {{ message }} +
+ {% endfor %} + {% endif %} + +
+ {% block content %} + {% endblock %}
-
-
-
- -
-
- -
-
- {% block header %} -

Block "header" not defined for this template

- {% endblock %} -
-
- - {% if messages %} - {% for message in messages %} -
- {{ message }} -
- {% endfor %} - {% endif %} - -
-
- {% block content %} - {% endblock %} -
- - - -
+
-
- + - + + - - - - - + + + + - {% block javascript %}{% endblock javascript %} +{% block javascript %}{% endblock javascript %} {% endblock %} diff --git a/mygpo/web/templates/home.html b/mygpo/web/templates/home.html index 7711e2e14..3808f50ab 100644 --- a/mygpo/web/templates/home.html +++ b/mygpo/web/templates/home.html @@ -2,226 +2,162 @@ {% load i18n %} {% load menu %} {% load static %} +{% load utils %} {% block titletag %}gpodder.net — discover and track your podcasts{% endblock %} {% block body %} - - - - - + + + + - {% block javascript %}{% endblock javascript %} +{% block javascript %}{% endblock javascript %} {% endblock %} diff --git a/mygpo/web/templates/skeleton.html b/mygpo/web/templates/skeleton.html index d5f0e32c2..7c990ad56 100644 --- a/mygpo/web/templates/skeleton.html +++ b/mygpo/web/templates/skeleton.html @@ -18,24 +18,14 @@ - - + + + + - - diff --git a/static/common.css b/static/common.css new file mode 100644 index 000000000..0a34ade1f --- /dev/null +++ b/static/common.css @@ -0,0 +1,93 @@ +/* General */ + +body +{ + font-family: 'Source Sans Pro', sans-serif; +} + + +/* Overall Layout */ + +body { + padding: 0 !important; /*remove after removing bootstrap */ +} + +#wrapper { + display: grid; + /* grid-template-areas in the size-specific layouts */ +} + +header { + grid-area: header; +} + +nav.secondary { + grid-area: nav; +} + +main { + grid-area: main; +} + +aside { + grid-area: side; +} + +footer { + grid-area: footer; +} + + +/* Navigation General */ + +nav ul { + list-style-type: none; + padding-left: 0; +} + +/* Header Navigation */ + +#logo { + padding-right: 20px; +} + +header { + display: flex; +} + +header nav ul { + height: 100%; + display: flex; + flex-wrap: wrap; + align-content: center; +} + +header nav ul li { + display: inline; + padding-right: 1em; +} + + + + +/* Footer */ + +.hosting { + text-align: center; +} + + +/* Messages */ + +.status-success { + background-color: hsla(var(--color-status-success), 100%, 75%, 1); +} + +.status-error { + background-color: hsla(var(--color-status-error), 100%, 75%, 1); +} + +.status-neutral { + background-color: hsla(var(--color-status-neutral), 16%, 85%, 1); +} + diff --git a/static/large.css b/static/large.css new file mode 100644 index 000000000..b18221452 --- /dev/null +++ b/static/large.css @@ -0,0 +1,19 @@ + +/* Overall Layout */ + +#wrapper { + grid-template-areas: + "header header header" + "nav main side" + "footer footer footer"; + grid-template-columns: 1fr 5fr 2fr; + grid-column-gap: 2em; +} + +main.home { + padding-left: 20%; + width: 60%; +} + +main.home div { +} diff --git a/static/mobile.css b/static/mobile.css new file mode 100644 index 000000000..acf10398b --- /dev/null +++ b/static/mobile.css @@ -0,0 +1,17 @@ + +/* Overall Layout */ + +#wrapper { + grid-template-areas: + "header" + "nav" + "main" + "side" + "footer"; +} + + +nav.secondary ul, +nav.secondary ul li { + display: inline; +} diff --git a/static/screen.css b/static/screen.css index 322ae97b3..dd5cf4045 100644 --- a/static/screen.css +++ b/static/screen.css @@ -5,34 +5,10 @@ } -/* Landscape phones and down */ -@media (min-width: 980px) -{ - -#inline_logo -{ -display: none; -} - -} - /**************** General *****************/ -body -{ - font-family: 'Source Sans Pro', sans-serif; -} - -#logo -{ - position: fixed; - left: 20px; - top: -2px; - z-index: 4000; -} - body h1 { font-size: 3em; @@ -175,10 +151,6 @@ table.list th.group i { color: #222; hypens: auto; - -webkit-hyphens: auto; - -moz-hyphens: auto; - -ms-hyphens: auto; - -o-hyphens: auto; text-align: justify; } @@ -404,6 +376,12 @@ iframe.results Footer *******************/ +footer nav { + padding: 0 20% 0 25%; + display: flex; + justify-content: space-around; +} + footer, footer a { color: #777; @@ -616,20 +594,3 @@ div.podcasts div.podcast:hover div.actions button.btn float: none; margin: 0 auto; } - -.hosting { - text-align: center; -} - -.status-success { - background-color: hsla(var(--color-status-success), 100%, 75%, 1); -} - - -.status-error { - background-color: hsla(var(--color-status-error), 100%, 75%, 1); -} - -.status-neutral { - background-color: hsla(var(--color-status-neutral), 16%, 85%, 1); -} From 34b912d4e73e03ef57520ad2ec545d3472ce2d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Wed, 15 Aug 2018 20:10:52 +0200 Subject: [PATCH 02/13] Highlight active navigation entries --- static/common.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/common.css b/static/common.css index 0a34ade1f..67e9a8380 100644 --- a/static/common.css +++ b/static/common.css @@ -53,6 +53,7 @@ nav ul { header { display: flex; + } header nav ul { @@ -67,7 +68,12 @@ header nav ul li { padding-right: 1em; } +nav ul li.active { +} +nav ul li.active a { + color: black; +} /* Footer */ From 75c3638bd8493f73e0ddf4e3dca132dd63cd84a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Wed, 15 Aug 2018 20:15:42 +0200 Subject: [PATCH 03/13] Define podcast-box component, use on dashboard --- .../templates/components/podcast-box.html | 40 +++++++++++++++++++ mygpo/web/templates/dashboard.html | 21 +--------- 2 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 mygpo/podcasts/templates/components/podcast-box.html diff --git a/mygpo/podcasts/templates/components/podcast-box.html b/mygpo/podcasts/templates/components/podcast-box.html new file mode 100644 index 000000000..b9779b6a4 --- /dev/null +++ b/mygpo/podcasts/templates/components/podcast-box.html @@ -0,0 +1,40 @@ +{% load charts %} +{% load podcasts %} +{% load humanize %} +{% load i18n %} +{% load utils %} + +{% comment %} + renders a box describing a podcast + + requires parameters: + * podcast + * long + +{% endcomment %} + +
+ +
+ + + + + + + {% podcast_link podcast %} + + +
+ {% if long %} + {{ podcast.description|default:""|truncatewords:"100"|markdown }} + {% else %} + {{ podcast.description|default:""|truncatewords:"50"|striptags }} + {% endif %} +
+ + {% if long %} + more... + {% endif %} + +
diff --git a/mygpo/web/templates/dashboard.html b/mygpo/web/templates/dashboard.html index 9462270dd..0ee4228ef 100644 --- a/mygpo/web/templates/dashboard.html +++ b/mygpo/web/templates/dashboard.html @@ -54,26 +54,7 @@

{% trans "Newest Episodes" %}

{% if random_podcast %} {% cache 3600 random_podcast_box %} -
- -

{% trans "Random" %}

- - - - - - -

{{ random_podcast.title }}

- -

- {{ random_podcast.description|default:""|truncatewords:"50" }} -

- -

- {% trans "more..." %} -

- -
+ {% include "components/podcast-box.html" with podcast=random_podcast only %} {% endcache %} {% endif %} From e0cd178ad1c621e58b2f6fe6434e8478233023fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Wed, 15 Aug 2018 20:16:14 +0200 Subject: [PATCH 04/13] Improve layout of Podcast directory --- mygpo/directory/templates/directory.html | 126 +++++++---------------- mygpo/directory/views.py | 3 +- mygpo/podcastlists/models.py | 4 + static/large.css | 17 ++- 4 files changed, 58 insertions(+), 92 deletions(-) diff --git a/mygpo/directory/templates/directory.html b/mygpo/directory/templates/directory.html index b6ff1e034..576a74a82 100644 --- a/mygpo/directory/templates/directory.html +++ b/mygpo/directory/templates/directory.html @@ -18,20 +18,12 @@

{% trans "Podcast Directory" %}

{% block content %} - {% for c in topics.categories %} - - {% if forloop.counter0|divisibleby:"2" %} -
- {% endif %} -
- {% if c.cls == "PodcastList" %} - {% url "user" c.username as user-lists-url %} -

{% blocktrans with c.title as listtitle and c.username as username %}{{ listtitle }} by {{ username }}{% endblocktrans %}

- {% else %} -

{{ c.title }}

- {% endif %} +
+ {% for c in topics.categories %} +
+

{{ c.title }}

{% for entry in c.podcasts|slice:":10" %} @@ -42,22 +34,46 @@

{{ c.title }}

- {% if c.cls == "PodcastList" %} - {% trans "more..." %} - {% else %} - {% trans "more..." %} - {% endif %} + {% trans "more..." %}
+ {% endfor %} + + {% if podcast_ad %} +
+ {% include "podcast-ad-box.html" with podcast_ad=podcast_ad only %} +
+ {% endif %} - {% if forloop.counter|divisibleby:"2" %} -
- {% endif %} + {% for pl in podcastlists %} +
+

{{ pl.title }} + {% url "user" pl.user.username as user_lists_url %} + {% trans "by" %} {{ pl.user.username }} +

+ + {% for entry in pl.entries.all|slice:":10" %} + + + + + {% endfor %} + + + + +
{% podcast_group_link entry.podcast %}
+ {% trans "more..." %} +
+
{% endfor %} + +
+
@@ -68,73 +84,3 @@

{{ c.title }}

{% endfor %}
{% endblock %} - - -{% block sidebar %} - - {% include "podcast-ad-box.html" with podcast_ad=podcast_ad only %} - - - {% for podcastlist in podcastlists %} - {% if podcastlist and podcastlist.user.username %} -
-

- - {{ podcastlist.title }} - - {% trans "Podcast List by" %} - - {{ podcastlist.user.username }} - - -

- -
- {% for podcast in podcastlist.podcasts %} - - - {{ podcast|podcast_logo }} - - - {% endfor %} - - {% if podcastlist.more_podcasts %} - {% blocktrans with podcastlist.more_podcasts as more %}and {{ more }} more{% endblocktrans %} - {% endif %} -
- - - -
- {% endif %} - {% endfor %} - - {% if random_podcast %} -
- -

{% trans "Random" %}

- - - - - - -

{{ random_podcast.title }}

- -

- {{ random_podcast.description|default:""|truncatewords:"50" }} -

- -

- {% trans "more..." %} -

- -
- {% endif %} - -{% endblock %} - diff --git a/mygpo/directory/views.py b/mygpo/directory/views.py index e292dd8d7..10dbd6698 100644 --- a/mygpo/directory/views.py +++ b/mygpo/directory/views.py @@ -136,7 +136,8 @@ def get(self, request): def get_random_list(self, podcasts_per_list=5): - random_list = PodcastList.objects.order_by('?').first() + all_lists = PodcastList.objects.filter(entries__isnull=False) + random_list = all_lists.order_by('?').first() yield random_list diff --git a/mygpo/podcastlists/models.py b/mygpo/podcastlists/models.py index 2a0ef37d0..1c9dd4d46 100644 --- a/mygpo/podcastlists/models.py +++ b/mygpo/podcastlists/models.py @@ -74,3 +74,7 @@ class Meta(OrderedModel.Meta): ('podcastlist', 'order'), ('podcastlist', 'content_type', 'object_id'), ] + + @property + def podcast(self): + return self.content_object diff --git a/static/large.css b/static/large.css index b18221452..f5f9f5084 100644 --- a/static/large.css +++ b/static/large.css @@ -6,7 +6,7 @@ "header header header" "nav main side" "footer footer footer"; - grid-template-columns: 1fr 5fr 2fr; + grid-template-columns: 10% auto fit-content(20%); grid-column-gap: 2em; } @@ -17,3 +17,18 @@ main.home { main.home div { } + + +/* Directory */ + +.categories { + display: grid; + grid-gap: 15px; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr) ) ; +} + +.categories .ad { + /* span the full 2nd row */ + grid-row: 2; + grid-column: 1 / -1; +} From 02a796e7f089b9dd030d2f21cc023d1f06014e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Sun, 19 Aug 2018 10:25:05 +0200 Subject: [PATCH 05/13] Remove bootstrap from embed template --- mygpo/web/templates/embed.html | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/mygpo/web/templates/embed.html b/mygpo/web/templates/embed.html index 4eed545f1..ed674ef1b 100644 --- a/mygpo/web/templates/embed.html +++ b/mygpo/web/templates/embed.html @@ -5,32 +5,21 @@ {% block body %} -
-
-
+
{% if messages %} - {% for message in messages %} -
- {{ message }} + {% for message in messages %} +
+ {{ message }}
- {% endfor %} + {% endfor %} {% endif %} - - {% block content %} - {% endblock %} - -
+
+ {% block content %} + {% endblock %}
- -
- - - - - {% block javascript %}{% endblock javascript %} + {% endblock %} From 843ec777a3de6a8296cb49c34dacb751a1c0a75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Mon, 15 Oct 2018 20:56:29 +0200 Subject: [PATCH 06/13] Simplify primary navigation --- .../templates/admin/activate-user.html | 1 - .../templates/admin/clients.html | 1 - .../templates/admin/filetypes.html | 1 - .../templates/admin/hostinfo.html | 1 - .../templates/admin/make-publisher-input.html | 1 - .../admin/make-publisher-result.html | 1 - .../templates/admin/merge-grouping.html | 1 - .../templates/admin/merge-select.html | 1 - .../templates/admin/overview.html | 1 - .../administration/templates/admin/stats.html | 1 - .../templates/admin/task-status.html | 1 - .../templates/admin/useragents.html | 1 - mygpo/directory/templates/carousel.html | 1 - mygpo/directory/templates/category.html | 1 - mygpo/directory/templates/directory.html | 1 - .../directory/add-podcast-status.html | 1 - .../templates/directory/license-podcasts.html | 1 - .../templates/directory/licenses.html | 1 - .../directory/templates/episode_toplist.html | 1 - mygpo/directory/templates/missing.html | 1 - mygpo/directory/templates/podcast_lists.html | 1 - mygpo/directory/templates/search.html | 1 - mygpo/directory/templates/toplist.html | 1 - mygpo/history/templates/episode-history.html | 1 - mygpo/history/templates/history.html | 1 - mygpo/history/templates/podcast-history.html | 1 - mygpo/podcastlists/templates/list.html | 8 ---- mygpo/podcastlists/templates/lists.html | 1 - mygpo/podcastlists/templates/lists_user.html | 1 - mygpo/podcasts/templates/episode.html | 1 - mygpo/podcasts/templates/episodes.html | 1 - mygpo/podcasts/templates/podcast-base.html | 1 - mygpo/podcasts/templates/podcast.html | 1 - mygpo/publisher/templates/link.html | 1 - .../templates/publisher/advertise.html | 1 - .../templates/publisher/episode.html | 1 - .../templates/publisher/episodes.html | 1 - .../publisher/templates/publisher/group.html | 1 - mygpo/publisher/templates/publisher/home.html | 1 - mygpo/publisher/templates/publisher/info.html | 1 - .../templates/publisher/podcast.html | 1 - mygpo/settings.py | 2 + mygpo/share/templates/share/favorites.html | 1 - mygpo/share/templates/share/overview.html | 1 - mygpo/share/templates/userpage-denied.html | 1 - mygpo/share/templates/userpage.html | 1 - .../templates/subscriptions.html | 1 - mygpo/suggestions/templates/suggestions.html | 1 - .../registration/activation_failed.html | 1 - .../registration/registration_complete.html | 1 - .../registration/registration_form.html | 1 - mygpo/web/nav.py | 37 +++++++++++++++++++ mygpo/web/templates/account.html | 1 - mygpo/web/templates/base.html | 16 ++------ mygpo/web/templates/contribute.html | 1 - mygpo/web/templates/csrf.html | 1 - mygpo/web/templates/dashboard.html | 1 - mygpo/web/templates/delete_account.html | 1 - mygpo/web/templates/deleted_account.html | 1 - mygpo/web/templates/developer.html | 1 - mygpo/web/templates/device-edit.html | 1 - mygpo/web/templates/device.html | 1 - mygpo/web/templates/devicelist.html | 1 - mygpo/web/templates/embed.html | 1 - mygpo/web/templates/favorites.html | 1 - mygpo/web/templates/home.html | 3 -- mygpo/web/templates/login.html | 1 - mygpo/web/templates/maintenance.html | 1 - mygpo/web/templates/mytags.html | 1 - mygpo/web/templates/privacy.html | 1 - mygpo/web/templates/privacy_policy.html | 1 - mygpo/web/templates/restore_password.html | 1 - mygpo/web/templates/user_subscriptions.html | 1 - .../templates/user_subscriptions_denied.html | 1 - mygpo/web/templatetags/menu.py | 20 ---------- 75 files changed, 42 insertions(+), 113 deletions(-) create mode 100644 mygpo/web/nav.py diff --git a/mygpo/administration/templates/admin/activate-user.html b/mygpo/administration/templates/admin/activate-user.html index 792df1f0c..f63aeabc6 100644 --- a/mygpo/administration/templates/admin/activate-user.html +++ b/mygpo/administration/templates/admin/activate-user.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Activate User" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/clients.html b/mygpo/administration/templates/admin/clients.html index 7d06439d7..25cc1e29c 100644 --- a/mygpo/administration/templates/admin/clients.html +++ b/mygpo/administration/templates/admin/clients.html @@ -4,7 +4,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Admin Area" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/filetypes.html b/mygpo/administration/templates/admin/filetypes.html index b4c06b567..c68e43aa3 100644 --- a/mygpo/administration/templates/admin/filetypes.html +++ b/mygpo/administration/templates/admin/filetypes.html @@ -4,7 +4,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "File Type Stats" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/hostinfo.html b/mygpo/administration/templates/admin/hostinfo.html index ad273f682..3880acfe8 100644 --- a/mygpo/administration/templates/admin/hostinfo.html +++ b/mygpo/administration/templates/admin/hostinfo.html @@ -4,7 +4,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Host Information" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/make-publisher-input.html b/mygpo/administration/templates/admin/make-publisher-input.html index c99d8f1fc..2ab09176d 100644 --- a/mygpo/administration/templates/admin/make-publisher-input.html +++ b/mygpo/administration/templates/admin/make-publisher-input.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Publisher Permissions" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/make-publisher-result.html b/mygpo/administration/templates/admin/make-publisher-result.html index 9685fc3eb..f82923a4d 100644 --- a/mygpo/administration/templates/admin/make-publisher-result.html +++ b/mygpo/administration/templates/admin/make-publisher-result.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Publisher Permissions" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/merge-grouping.html b/mygpo/administration/templates/admin/merge-grouping.html index 94a5c8dae..74acf7f58 100644 --- a/mygpo/administration/templates/admin/merge-grouping.html +++ b/mygpo/administration/templates/admin/merge-grouping.html @@ -4,7 +4,6 @@ {% load episodes %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Admin Area" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/merge-select.html b/mygpo/administration/templates/admin/merge-select.html index 818438b1b..4c23ff663 100644 --- a/mygpo/administration/templates/admin/merge-select.html +++ b/mygpo/administration/templates/admin/merge-select.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Admin Area" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/overview.html b/mygpo/administration/templates/admin/overview.html index 1c542533b..6c5806533 100644 --- a/mygpo/administration/templates/admin/overview.html +++ b/mygpo/administration/templates/admin/overview.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Admin Area" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/stats.html b/mygpo/administration/templates/admin/stats.html index 554c1dc58..089d9dd0b 100644 --- a/mygpo/administration/templates/admin/stats.html +++ b/mygpo/administration/templates/admin/stats.html @@ -3,7 +3,6 @@ {% load charts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Admin Area" %}{% endblock %} diff --git a/mygpo/administration/templates/admin/task-status.html b/mygpo/administration/templates/admin/task-status.html index 9abe6bdef..99967c789 100644 --- a/mygpo/administration/templates/admin/task-status.html +++ b/mygpo/administration/templates/admin/task-status.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block head %} diff --git a/mygpo/administration/templates/admin/useragents.html b/mygpo/administration/templates/admin/useragents.html index 9e941c458..236a490af 100644 --- a/mygpo/administration/templates/admin/useragents.html +++ b/mygpo/administration/templates/admin/useragents.html @@ -3,7 +3,6 @@ {% load charts %} {% load menu %} -{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} {% block title %}{% trans "Admin Area" %}{% endblock %} diff --git a/mygpo/directory/templates/carousel.html b/mygpo/directory/templates/carousel.html index 9b9a86671..71d023582 100644 --- a/mygpo/directory/templates/carousel.html +++ b/mygpo/directory/templates/carousel.html @@ -8,7 +8,6 @@ {% load cache %} {% load menu %} -{% block mainmenu %}{{ "/directory/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/directory/"|section_menu }}{% endblock %} {% block head %} diff --git a/mygpo/directory/templates/category.html b/mygpo/directory/templates/category.html index d91b84eda..c887606f2 100644 --- a/mygpo/directory/templates/category.html +++ b/mygpo/directory/templates/category.html @@ -7,7 +7,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/directory/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/directory/"|section_menu:category }}{% endblock %} {% block title %}{{ category }}{% endblock %} diff --git a/mygpo/directory/templates/directory.html b/mygpo/directory/templates/directory.html index 576a74a82..6ca8b3e59 100644 --- a/mygpo/directory/templates/directory.html +++ b/mygpo/directory/templates/directory.html @@ -7,7 +7,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/directory/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/directory/"|section_menu }}{% endblock %} {% block title %}{% trans "Podcast Directory" %}{% endblock %} diff --git a/mygpo/directory/templates/directory/add-podcast-status.html b/mygpo/directory/templates/directory/add-podcast-status.html index 5821723c5..bdd3c2d99 100644 --- a/mygpo/directory/templates/directory/add-podcast-status.html +++ b/mygpo/directory/templates/directory/add-podcast-status.html @@ -4,7 +4,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/missing/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/missing/"|section_menu }}{% endblock %} {% block head %} diff --git a/mygpo/directory/templates/directory/license-podcasts.html b/mygpo/directory/templates/directory/license-podcasts.html index af1adf1b8..197f3b534 100644 --- a/mygpo/directory/templates/directory/license-podcasts.html +++ b/mygpo/directory/templates/directory/license-podcasts.html @@ -7,7 +7,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/directory/+license"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/directory/+license"|section_menu }}{% endblock %} {% block title %}{% blocktrans with view.license_url|license_name as licensename %}Podcasts with License {{ licensename }}{% endblocktrans %}{% endblock %} diff --git a/mygpo/directory/templates/directory/licenses.html b/mygpo/directory/templates/directory/licenses.html index 03542c1d7..67b7679e6 100644 --- a/mygpo/directory/templates/directory/licenses.html +++ b/mygpo/directory/templates/directory/licenses.html @@ -7,7 +7,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/directory/+license"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/directory/+license"|section_menu }}{% endblock %} {% block title %}{% trans "Podcasts with License Information" %}{% endblock %} diff --git a/mygpo/directory/templates/episode_toplist.html b/mygpo/directory/templates/episode_toplist.html index ca61e55ee..9642aebf0 100644 --- a/mygpo/directory/templates/episode_toplist.html +++ b/mygpo/directory/templates/episode_toplist.html @@ -6,7 +6,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/toplist/episodes"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/toplist/episodes"|section_menu }}{% endblock %} {% block title %}{% trans "Episode-Toplist" %}{% endblock %} diff --git a/mygpo/directory/templates/missing.html b/mygpo/directory/templates/missing.html index 33723e424..fae37051d 100644 --- a/mygpo/directory/templates/missing.html +++ b/mygpo/directory/templates/missing.html @@ -5,7 +5,6 @@ {% load charts %} {% load menu %} -{% block mainmenu %}{{ "/missing/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/missing/"|section_menu }}{% endblock %} {% block title %}{% trans "Missing Podcast" %}{% endblock %} diff --git a/mygpo/directory/templates/podcast_lists.html b/mygpo/directory/templates/podcast_lists.html index d72bf539b..ad60524c9 100644 --- a/mygpo/directory/templates/podcast_lists.html +++ b/mygpo/directory/templates/podcast_lists.html @@ -7,7 +7,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/directory/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/lists/"|section_menu }}{% endblock %} {% block title %}{% trans "Podcast Lists" %}{% endblock %} diff --git a/mygpo/directory/templates/search.html b/mygpo/directory/templates/search.html index 565ce33be..45cc33303 100644 --- a/mygpo/directory/templates/search.html +++ b/mygpo/directory/templates/search.html @@ -5,7 +5,6 @@ {% load charts %} {% load menu %} -{% block mainmenu %}{{ "/search/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/search/"|section_menu }}{% endblock %} {% block title %}{% trans "Search" %}{% endblock %} diff --git a/mygpo/directory/templates/toplist.html b/mygpo/directory/templates/toplist.html index be3032039..4883274c2 100644 --- a/mygpo/directory/templates/toplist.html +++ b/mygpo/directory/templates/toplist.html @@ -8,7 +8,6 @@ {% load static %} {% load menu %} -{% block mainmenu %}{{ "/toplist/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/toplist/"|section_menu }}{% endblock %} {% block title %}{% trans "Toplist" %}{% endblock %} diff --git a/mygpo/history/templates/episode-history.html b/mygpo/history/templates/episode-history.html index f1b55ea5d..7de666d86 100644 --- a/mygpo/history/templates/episode-history.html +++ b/mygpo/history/templates/episode-history.html @@ -13,7 +13,6 @@ {% load static %} {% load menu %} -{% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %} {% block sectionmenu %} {% if podcast.title %} {{ "/podcast/"|section_menu:podcast.title }} diff --git a/mygpo/history/templates/history.html b/mygpo/history/templates/history.html index 53f5c5584..f226f05a5 100644 --- a/mygpo/history/templates/history.html +++ b/mygpo/history/templates/history.html @@ -6,7 +6,6 @@ {% load episodes %} {% load menu %} -{% block mainmenu %}{{ "/history/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/history/"|section_menu }}{% endblock %} {% block title %}{% trans "Subscription History" %}{% if client %} {% trans "for" %} {{ client.name|striptags }}{% endif %}{% endblock %} diff --git a/mygpo/history/templates/podcast-history.html b/mygpo/history/templates/podcast-history.html index 16fe426ba..5371fdcaf 100755 --- a/mygpo/history/templates/podcast-history.html +++ b/mygpo/history/templates/podcast-history.html @@ -10,7 +10,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %} {% block sectionmenu %} {% if podcast.title %} {{ "/podcast/"|section_menu:podcast.title }} diff --git a/mygpo/podcastlists/templates/list.html b/mygpo/podcastlists/templates/list.html index 00f2eaf0a..b65bf2262 100644 --- a/mygpo/podcastlists/templates/list.html +++ b/mygpo/podcastlists/templates/list.html @@ -8,14 +8,6 @@ {% load menu %} -{% block mainmenu %} - {% if is_own %} - {{ "/share/"|main_menu }} - {% else %} - {{ "/directory/"|main_menu }} - {% endif %} -{% endblock %} - {% block sectionmenu %} {% if is_own %} {{ "/share/lists/"|section_menu }} diff --git a/mygpo/podcastlists/templates/lists.html b/mygpo/podcastlists/templates/lists.html index eaef8c91b..55ad5cd3b 100644 --- a/mygpo/podcastlists/templates/lists.html +++ b/mygpo/podcastlists/templates/lists.html @@ -7,7 +7,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/share/lists/"|section_menu }}{% endblock %} {% block title %}{% trans "Podcast Lists" %}{% endblock %} diff --git a/mygpo/podcastlists/templates/lists_user.html b/mygpo/podcastlists/templates/lists_user.html index 71c5e9612..26d597c84 100644 --- a/mygpo/podcastlists/templates/lists_user.html +++ b/mygpo/podcastlists/templates/lists_user.html @@ -3,7 +3,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/directory/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/lists/"|section_menu }}{% endblock %} {% block title %}{% trans "Podcast Lists" %}{% endblock %} diff --git a/mygpo/podcasts/templates/episode.html b/mygpo/podcasts/templates/episode.html index 5bef39a70..4daf47947 100644 --- a/mygpo/podcasts/templates/episode.html +++ b/mygpo/podcasts/templates/episode.html @@ -13,7 +13,6 @@ {% load static %} {% load menu %} -{% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %} {% block sectionmenu %} {% if podcast.title %} {{ "/podcast/"|section_menu:podcast.title }} diff --git a/mygpo/podcasts/templates/episodes.html b/mygpo/podcasts/templates/episodes.html index cca78f4f6..daa39d949 100755 --- a/mygpo/podcasts/templates/episodes.html +++ b/mygpo/podcasts/templates/episodes.html @@ -6,7 +6,6 @@ {% load charts %} {% load menu %} -{% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %} {% block sectionmenu %} {% if podcast.title %} {{ "/podcast/"|section_menu:podcast.title }} diff --git a/mygpo/podcasts/templates/podcast-base.html b/mygpo/podcasts/templates/podcast-base.html index 258a3666d..1d85062b7 100755 --- a/mygpo/podcasts/templates/podcast-base.html +++ b/mygpo/podcasts/templates/podcast-base.html @@ -6,7 +6,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %} {% block sectionmenu %} {% if podcast.title %} {{ "/podcast/"|section_menu:podcast.title }} diff --git a/mygpo/podcasts/templates/podcast.html b/mygpo/podcasts/templates/podcast.html index 8a1d8a82f..0b6c8cf92 100755 --- a/mygpo/podcasts/templates/podcast.html +++ b/mygpo/podcasts/templates/podcast.html @@ -8,7 +8,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %} {% block sectionmenu %} {% if podcast.title %} {{ "/podcast/"|section_menu:podcast.title }} diff --git a/mygpo/publisher/templates/link.html b/mygpo/publisher/templates/link.html index d4d7b4105..cd7c3d997 100644 --- a/mygpo/publisher/templates/link.html +++ b/mygpo/publisher/templates/link.html @@ -2,7 +2,6 @@ {% load i18n %} {% load static %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/link/"|section_menu }}{% endblock %} {% block title %}{% trans "For Podcast Authors" %}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/advertise.html b/mygpo/publisher/templates/publisher/advertise.html index fa988855c..ed2c65e18 100644 --- a/mygpo/publisher/templates/publisher/advertise.html +++ b/mygpo/publisher/templates/publisher/advertise.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/advertise"|section_menu }}{% endblock %} {% block title %}{% trans "Advertise" %}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/episode.html b/mygpo/publisher/templates/publisher/episode.html index 1387fa926..19c5ccc0f 100644 --- a/mygpo/publisher/templates/publisher/episode.html +++ b/mygpo/publisher/templates/publisher/episode.html @@ -7,7 +7,6 @@ {% load pcharts %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/podcast/"|section_menu:podcast.title }}{% endblock %} {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/episodes.html b/mygpo/publisher/templates/publisher/episodes.html index d16742e7e..f277a6f06 100644 --- a/mygpo/publisher/templates/publisher/episodes.html +++ b/mygpo/publisher/templates/publisher/episodes.html @@ -6,7 +6,6 @@ {% load charts %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/podcast/"|section_menu:podcast.title }}{% endblock %} {% block title %}{{ podcast.title|default:"Unnamed Podcast"|striptags }}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/group.html b/mygpo/publisher/templates/publisher/group.html index 5de05befb..ef7b8de44 100644 --- a/mygpo/publisher/templates/publisher/group.html +++ b/mygpo/publisher/templates/publisher/group.html @@ -6,7 +6,6 @@ {% load pcharts %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/podcast/"|section_menu:group.title }}{% endblock %} {% block title %}{{ group.title|striptags }}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/home.html b/mygpo/publisher/templates/publisher/home.html index 266f1f22a..359ac74e0 100644 --- a/mygpo/publisher/templates/publisher/home.html +++ b/mygpo/publisher/templates/publisher/home.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/"|section_menu }}{% endblock %} {% block title %}{% trans "Podcasts Published by Me" %}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/info.html b/mygpo/publisher/templates/publisher/info.html index 5c560100b..37fff68ab 100644 --- a/mygpo/publisher/templates/publisher/info.html +++ b/mygpo/publisher/templates/publisher/info.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/"|section_menu }}{% endblock %} {% block title %}{% trans "Publisher Pages" %}{% endblock %} diff --git a/mygpo/publisher/templates/publisher/podcast.html b/mygpo/publisher/templates/publisher/podcast.html index 314ab388e..374ff777b 100644 --- a/mygpo/publisher/templates/publisher/podcast.html +++ b/mygpo/publisher/templates/publisher/podcast.html @@ -8,7 +8,6 @@ {% load static %} {% load menu %} {% load utils %} -{% block mainmenu %}{{ "/publisher/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/publisher/podcast/"|section_menu:podcast.title }}{% endblock %} {% block title %}{{ podcast.title|default:"Unnamed Podcast"|striptags }}{% endblock %} diff --git a/mygpo/settings.py b/mygpo/settings.py index c64e2bd7f..bedd1043e 100644 --- a/mygpo/settings.py +++ b/mygpo/settings.py @@ -109,6 +109,8 @@ def get_intOrNone(name, default): # templates. this is used to direct users to previous # page after login 'django.template.context_processors.request', + + 'mygpo.web.nav.primary_navigation', ], 'libraries': { 'staticfiles' : 'django.templatetags.static', diff --git a/mygpo/share/templates/share/favorites.html b/mygpo/share/templates/share/favorites.html index 9f4a5faff..ecbe10b19 100644 --- a/mygpo/share/templates/share/favorites.html +++ b/mygpo/share/templates/share/favorites.html @@ -4,7 +4,6 @@ {% load episodes %} {% load menu %} -{% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/share/favorites"|section_menu }}{% endblock %} {% block title %}{% trans "Share your favorite episodes" %}{% endblock %} diff --git a/mygpo/share/templates/share/overview.html b/mygpo/share/templates/share/overview.html index b0fc7ed85..0742cb6df 100644 --- a/mygpo/share/templates/share/overview.html +++ b/mygpo/share/templates/share/overview.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load static %} {% load menu %} -{% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/share/"|section_menu }}{% endblock %} {% block title %}{% trans "Sharing" %}{% endblock %} diff --git a/mygpo/share/templates/userpage-denied.html b/mygpo/share/templates/userpage-denied.html index a47f2b082..873112017 100644 --- a/mygpo/share/templates/userpage-denied.html +++ b/mygpo/share/templates/userpage-denied.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/share/"|section_menu:other_user.username }}{% endblock %} {% block title %}{{ other_user.username }}{% endblock %} diff --git a/mygpo/share/templates/userpage.html b/mygpo/share/templates/userpage.html index 9ac0e2ac3..10e4f0ee0 100644 --- a/mygpo/share/templates/userpage.html +++ b/mygpo/share/templates/userpage.html @@ -10,7 +10,6 @@ {% load gravatar %} {% load menu %} -{% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/share/me"|section_menu:page_user.username }}{% endblock %} {% block title %}{{ page_user.username }}{% endblock %} diff --git a/mygpo/subscriptions/templates/subscriptions.html b/mygpo/subscriptions/templates/subscriptions.html index 96f566abf..8e1795067 100644 --- a/mygpo/subscriptions/templates/subscriptions.html +++ b/mygpo/subscriptions/templates/subscriptions.html @@ -5,7 +5,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/subscriptions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/subscriptions/"|section_menu }}{% endblock %} {% block title %}{% trans "Podcast Subscriptions" %}{% endblock %} diff --git a/mygpo/suggestions/templates/suggestions.html b/mygpo/suggestions/templates/suggestions.html index a5827d844..20d4a4c97 100644 --- a/mygpo/suggestions/templates/suggestions.html +++ b/mygpo/suggestions/templates/suggestions.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/suggestions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/suggestions/"|section_menu }}{% endblock %} {% block title %}{% trans "Suggested Podcasts" %}{% endblock %} diff --git a/mygpo/users/templates/registration/activation_failed.html b/mygpo/users/templates/registration/activation_failed.html index cafdce72c..2b621f25e 100644 --- a/mygpo/users/templates/registration/activation_failed.html +++ b/mygpo/users/templates/registration/activation_failed.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/register/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/register/"|section_menu }}{% endblock %} {% block title %}{% trans "Activation failed" %}{% endblock %} diff --git a/mygpo/users/templates/registration/registration_complete.html b/mygpo/users/templates/registration/registration_complete.html index 9b8d2ca2b..167347028 100644 --- a/mygpo/users/templates/registration/registration_complete.html +++ b/mygpo/users/templates/registration/registration_complete.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/register/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/register/"|section_menu }}{% endblock %} {% block header %} diff --git a/mygpo/users/templates/registration/registration_form.html b/mygpo/users/templates/registration/registration_form.html index 424d3f60b..90c01f723 100644 --- a/mygpo/users/templates/registration/registration_form.html +++ b/mygpo/users/templates/registration/registration_form.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/register/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/register/"|section_menu }}{% endblock %} {% block title %}{% trans "Create Account" %}{% endblock %} diff --git a/mygpo/web/nav.py b/mygpo/web/nav.py new file mode 100644 index 000000000..72bdcdd8c --- /dev/null +++ b/mygpo/web/nav.py @@ -0,0 +1,37 @@ + +import collections + +NavEntry = collections.namedtuple('NavEntry', 'urlname label') + +PRIMARY_NAV = [ + NavEntry('home', 'gpodder.net'), + NavEntry('directory-home', 'Directory'), + NavEntry('subscriptions', 'Subscriptions'), + NavEntry('share', 'Community'), + NavEntry('publisher', 'Publish'), +] + +PRIMARY_NAV_AUTH = [ + NavEntry('account', 'Account'), + NavEntry('logout', 'Logout'), +] + +PRIMARY_NAV_ANON = [ + NavEntry('login', 'Login'), + NavEntry('register', 'Register'), +] + + +# context processor for primary navigation +def primary_navigation(request): + + user = request.user + + if user.is_authenticated: + nav = PRIMARY_NAV + PRIMARY_NAV_AUTH + else: + nav = PRIMARY_NAV + PRIMARY_NAV_ANON + + return { + 'primary_nav': nav, + } diff --git a/mygpo/web/templates/account.html b/mygpo/web/templates/account.html index 25c9cbc5a..0d376bf08 100644 --- a/mygpo/web/templates/account.html +++ b/mygpo/web/templates/account.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/account/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/account/"|section_menu }}{% endblock %} {% block title %}{% trans "Account Settings" %}{% endblock %} diff --git a/mygpo/web/templates/base.html b/mygpo/web/templates/base.html index fe31c3ea2..e70ee389b 100644 --- a/mygpo/web/templates/base.html +++ b/mygpo/web/templates/base.html @@ -17,20 +17,10 @@
diff --git a/mygpo/web/templates/contribute.html b/mygpo/web/templates/contribute.html index 97053e279..cde943435 100644 --- a/mygpo/web/templates/contribute.html +++ b/mygpo/web/templates/contribute.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/online-help"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/contribute/"|section_menu }}{% endblock %} {% block title %}{% trans "Contribute" %}{% endblock %} diff --git a/mygpo/web/templates/csrf.html b/mygpo/web/templates/csrf.html index eb3b92f1d..8abd15088 100644 --- a/mygpo/web/templates/csrf.html +++ b/mygpo/web/templates/csrf.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/"|section_menu }}{% endblock %} {% block title %}{% trans "Attention!" %}{% endblock %} diff --git a/mygpo/web/templates/dashboard.html b/mygpo/web/templates/dashboard.html index 0ee4228ef..2253758a3 100644 --- a/mygpo/web/templates/dashboard.html +++ b/mygpo/web/templates/dashboard.html @@ -8,7 +8,6 @@ {% load utils %} {% load menu %} -{% block mainmenu %}{{ "/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/"|section_menu }}{% endblock %} {% block title %}{% trans "Overview" %}{% endblock %} diff --git a/mygpo/web/templates/delete_account.html b/mygpo/web/templates/delete_account.html index 5359d4c03..32dd4753e 100644 --- a/mygpo/web/templates/delete_account.html +++ b/mygpo/web/templates/delete_account.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/account/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/account/"|section_menu }}{% endblock %} {% block title %} diff --git a/mygpo/web/templates/deleted_account.html b/mygpo/web/templates/deleted_account.html index 539953076..bb1c24f9b 100644 --- a/mygpo/web/templates/deleted_account.html +++ b/mygpo/web/templates/deleted_account.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/account/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/account/"|section_menu }}{% endblock %} {% block title %} diff --git a/mygpo/web/templates/developer.html b/mygpo/web/templates/developer.html index ba1607704..510b38d5f 100644 --- a/mygpo/web/templates/developer.html +++ b/mygpo/web/templates/developer.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/online-help"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/developer/"|section_menu }}{% endblock %} {% block title %}{% trans "Development" %}{% endblock %} diff --git a/mygpo/web/templates/device-edit.html b/mygpo/web/templates/device-edit.html index 594deadd6..43d5487ca 100644 --- a/mygpo/web/templates/device-edit.html +++ b/mygpo/web/templates/device-edit.html @@ -5,7 +5,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/subscriptions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/device/"|section_menu:device.name }}{% endblock %} {% block title %}{% blocktrans with device.name|striptags as devicename %}Device {{ devicename }}{% endblocktrans %}{% endblock %} diff --git a/mygpo/web/templates/device.html b/mygpo/web/templates/device.html index a0fc219dd..a7952ce97 100644 --- a/mygpo/web/templates/device.html +++ b/mygpo/web/templates/device.html @@ -5,7 +5,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/device/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/device/"|section_menu:device.name }}{% endblock %} {% block title %}{% blocktrans with device.name|striptags as devicename %}Device {{ devicename }}{% endblocktrans %}{% endblock %} diff --git a/mygpo/web/templates/devicelist.html b/mygpo/web/templates/devicelist.html index 3846e96b0..cea5519d4 100644 --- a/mygpo/web/templates/devicelist.html +++ b/mygpo/web/templates/devicelist.html @@ -4,7 +4,6 @@ {% load devices %} {% load menu %} -{% block mainmenu %}{{ "/devices/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/devices/"|section_menu }}{% endblock %} {% block title %}{% trans "Managed Devices" %}{% endblock %} diff --git a/mygpo/web/templates/embed.html b/mygpo/web/templates/embed.html index ed674ef1b..179e2039b 100644 --- a/mygpo/web/templates/embed.html +++ b/mygpo/web/templates/embed.html @@ -1,6 +1,5 @@ {% extends "skeleton.html" %} {% load i18n %} -{% load menu %} {% load static %} {% block body %} diff --git a/mygpo/web/templates/favorites.html b/mygpo/web/templates/favorites.html index a62d82602..bbba39e6c 100644 --- a/mygpo/web/templates/favorites.html +++ b/mygpo/web/templates/favorites.html @@ -4,7 +4,6 @@ {% load episodes %} {% load menu %} -{% block mainmenu %}{{ "/subscriptions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/favorites/"|section_menu }}{% endblock %} {% block title %}{% trans "Favorite Episodes" %}{% endblock %} diff --git a/mygpo/web/templates/home.html b/mygpo/web/templates/home.html index 3808f50ab..7805cbec3 100644 --- a/mygpo/web/templates/home.html +++ b/mygpo/web/templates/home.html @@ -20,9 +20,6 @@
  • gpodder.net
  • - {% block mainmenu %} - {{ "/"|main_menu }} - {% endblock %} {% if user.is_authenticated %}
  • {{ user.username }}
  • Sign Out
  • diff --git a/mygpo/web/templates/login.html b/mygpo/web/templates/login.html index 9b6099ab9..41f59bdb5 100644 --- a/mygpo/web/templates/login.html +++ b/mygpo/web/templates/login.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/login/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/login/"|section_menu }}{% endblock %} {% block title %}{% trans "Login" %}{% endblock %} diff --git a/mygpo/web/templates/maintenance.html b/mygpo/web/templates/maintenance.html index 952b5412b..d53a94b85 100644 --- a/mygpo/web/templates/maintenance.html +++ b/mygpo/web/templates/maintenance.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/"|section_menu }}{% endblock %} {% block title %}{% trans "Maintenance" %}{% endblock %} diff --git a/mygpo/web/templates/mytags.html b/mygpo/web/templates/mytags.html index e9ca2f670..ec4a3dca0 100644 --- a/mygpo/web/templates/mytags.html +++ b/mygpo/web/templates/mytags.html @@ -5,7 +5,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/subscriptions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/tags/"|section_menu }}{% endblock %} {% block title %}{% trans "My Tags" %}{% endblock %} diff --git a/mygpo/web/templates/privacy.html b/mygpo/web/templates/privacy.html index 2dcf076f4..4dcf399d9 100644 --- a/mygpo/web/templates/privacy.html +++ b/mygpo/web/templates/privacy.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/account/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/account/privacy"|section_menu }}{% endblock %} {% block title %}{% trans "Privacy Settings" %}{% endblock %} diff --git a/mygpo/web/templates/privacy_policy.html b/mygpo/web/templates/privacy_policy.html index 1afe0cbe0..819e4e77f 100644 --- a/mygpo/web/templates/privacy_policy.html +++ b/mygpo/web/templates/privacy_policy.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/privacy"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/privacy/"|section_menu }}{% endblock %} {% block title %}{% trans "Privacy Policy" %}{% endblock %} diff --git a/mygpo/web/templates/restore_password.html b/mygpo/web/templates/restore_password.html index 1b69cc6fa..185c45a43 100644 --- a/mygpo/web/templates/restore_password.html +++ b/mygpo/web/templates/restore_password.html @@ -2,7 +2,6 @@ {% load i18n %} {% load menu %} -{% block mainmenu %}{{ "/login/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/login/"|section_menu }}{% endblock %} {% block title %}{% trans "Login" %}{% endblock %} diff --git a/mygpo/web/templates/user_subscriptions.html b/mygpo/web/templates/user_subscriptions.html index 7ec5d85ed..cdc291561 100644 --- a/mygpo/web/templates/user_subscriptions.html +++ b/mygpo/web/templates/user_subscriptions.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/user/subscriptions/"|section_menu:other_user.username }}{% endblock %} {% block head %} diff --git a/mygpo/web/templates/user_subscriptions_denied.html b/mygpo/web/templates/user_subscriptions_denied.html index 9e6b705ba..4bf185d66 100644 --- a/mygpo/web/templates/user_subscriptions_denied.html +++ b/mygpo/web/templates/user_subscriptions_denied.html @@ -3,7 +3,6 @@ {% load podcasts %} {% load menu %} -{% block mainmenu %}{{ "/user/subscriptions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/user/subscriptions/"|section_menu:other_user.username }}{% endblock %} {% block title %} diff --git a/mygpo/web/templatetags/menu.py b/mygpo/web/templatetags/menu.py index 7effd73d8..0f893b73f 100644 --- a/mygpo/web/templatetags/menu.py +++ b/mygpo/web/templatetags/menu.py @@ -69,26 +69,6 @@ )), ) -@register.filter() -def main_menu(selected): - found_section = False - links = [] - for label, items in MENU_STRUCTURE[1:]: - uris = [uri for uri, caption in items] - if selected in uris: - found_section = True - links.append((items[0][0], label, uris)) - - items = [] - for uri, caption, subpages in links: - if selected in subpages or ('/' in subpages and not found_section): - items.append('
  • %s
  • ' % \ - (uri, ugettext(caption))) - else: - items.append('
  • %s
  • ' % (uri, ugettext(caption))) - - return mark_safe('\n'.join(items)) - def get_section_items(selected): for label, items in MENU_STRUCTURE: if selected in (uri for uri, caption in items): From 1f580ef093f394d1f2b787e730ebe80909409024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Mon, 15 Oct 2018 21:03:19 +0200 Subject: [PATCH 07/13] Remove secondary navigation from "gpodder.net" primary nav --- mygpo/web/templates/base.html | 5 +++-- mygpo/web/templatetags/menu.py | 10 ---------- mygpo/web/urls.py | 3 ++- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/mygpo/web/templates/base.html b/mygpo/web/templates/base.html index e70ee389b..cbd0a5174 100644 --- a/mygpo/web/templates/base.html +++ b/mygpo/web/templates/base.html @@ -96,8 +96,9 @@

    Block "header" not defined for this template

      @@ -114,7 +115,7 @@

      Block "header" not defined for this template

      -
    • {% trans "Develop" %}
    • +
    • {% trans "Develop" %}
    • {% trans "API" %}
    • {% trans "Libraries" %}
    • {% trans "Clients" %}
    • diff --git a/mygpo/web/templatetags/menu.py b/mygpo/web/templatetags/menu.py index 0f893b73f..c7725797f 100644 --- a/mygpo/web/templatetags/menu.py +++ b/mygpo/web/templatetags/menu.py @@ -18,16 +18,6 @@ ) MENU_STRUCTURE = ( - ('', ( - ('/', _('Home')), - ('/login/', _('Login')), - ('/register/', _('Register')), - ('', _('Docs')), - ('/contribute/', _('Contribute')), - ('/developer/', _('Development')), - ('/privacy/', _('Privacy Policy')), - ('/online-help', _('Help')), - )), (_('Discover'), ( ('/directory/', _('Directory')), ('/podcast/', _('Podcast')), diff --git a/mygpo/web/urls.py b/mygpo/web/urls.py index 5f2374a85..cbd9e8235 100644 --- a/mygpo/web/urls.py +++ b/mygpo/web/urls.py @@ -40,7 +40,8 @@ name='help'), path('developer/', - TemplateView.as_view(template_name='developer.html')), + TemplateView.as_view(template_name='developer.html'), + name='developer'), path('contribute/', TemplateView.as_view(template_name='contribute.html'), From fda9d91f28980edb4788f84d7e74a47f01f5ea25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Mon, 15 Oct 2018 21:24:48 +0200 Subject: [PATCH 08/13] Remove secondary navigation from "Directory" primary nav --- mygpo/directory/templates/directory.html | 12 ++++++++++++ mygpo/directory/templates/search.html | 4 ++++ mygpo/web/templatetags/menu.py | 14 -------------- static/common.css | 12 +++++++++++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/mygpo/directory/templates/directory.html b/mygpo/directory/templates/directory.html index 6ca8b3e59..28d3bfeb4 100644 --- a/mygpo/directory/templates/directory.html +++ b/mygpo/directory/templates/directory.html @@ -13,6 +13,18 @@ {% block header %}

      {% trans "Podcast Directory" %}

      + + + {% endblock %} diff --git a/mygpo/directory/templates/search.html b/mygpo/directory/templates/search.html index 45cc33303..93f50900e 100644 --- a/mygpo/directory/templates/search.html +++ b/mygpo/directory/templates/search.html @@ -77,6 +77,10 @@

      {% trans "Search" %}

      {% trans "Nothing found" %}
      +
      + +
      + {% endif %} {% endif %} diff --git a/mygpo/web/templatetags/menu.py b/mygpo/web/templatetags/menu.py index c7725797f..5b066df21 100644 --- a/mygpo/web/templatetags/menu.py +++ b/mygpo/web/templatetags/menu.py @@ -18,20 +18,6 @@ ) MENU_STRUCTURE = ( - (_('Discover'), ( - ('/directory/', _('Directory')), - ('/podcast/', _('Podcast')), - ('/search/', _('Search')), - ('/missing/', _('Missing Podcast')), - ('/lists/', _('Podcast Lists')), - ('/user/subscriptions/', _('User subscriptions')), - ('/suggestions/', _('Suggestions')), - ('', _('Features')), - ('/directory/+license', _('License')), - ('', _('Toplists')), - ('/toplist/', _('Podcasts')), - ('/toplist/episodes', _('Episodes')), - )), (_('Subscriptions'), ( ('/subscriptions/', _('Subscriptions')), ('/favorites/', _('Favorite Episodes')), diff --git a/static/common.css b/static/common.css index 67e9a8380..c1e565bdb 100644 --- a/static/common.css +++ b/static/common.css @@ -53,7 +53,6 @@ nav ul { header { display: flex; - } header nav ul { @@ -97,3 +96,14 @@ nav ul li.active a { background-color: hsla(var(--color-status-neutral), 16%, 85%, 1); } + +/* Sections Navigation */ + +ul.sections li { + display: inline; +} + +ul.sections li + li:before +{ + content: 'ยท '; +} From fb0d5bad371921d82151f13f6970a1b3d59af938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Mon, 15 Oct 2018 21:57:12 +0200 Subject: [PATCH 09/13] Remove secondary navigation from "Subscriptions" primary nav --- mygpo/subscriptions/templates/subscriptions.html | 10 ++++++++++ mygpo/web/templatetags/menu.py | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/mygpo/subscriptions/templates/subscriptions.html b/mygpo/subscriptions/templates/subscriptions.html index 8e1795067..58e318115 100644 --- a/mygpo/subscriptions/templates/subscriptions.html +++ b/mygpo/subscriptions/templates/subscriptions.html @@ -12,6 +12,16 @@ {% block header %}

      {% trans "Podcast Subscriptions" %}

      + + + {% endblock %} diff --git a/mygpo/web/templatetags/menu.py b/mygpo/web/templatetags/menu.py index 5b066df21..3abb3527e 100644 --- a/mygpo/web/templatetags/menu.py +++ b/mygpo/web/templatetags/menu.py @@ -18,14 +18,6 @@ ) MENU_STRUCTURE = ( - (_('Subscriptions'), ( - ('/subscriptions/', _('Subscriptions')), - ('/favorites/', _('Favorite Episodes')), - ('/tags/', _('My Tags')), - ('/devices/', _('Devices')), - ('/device/', _('Device')), - ('/history/', _('History')), - )), (_('Community'), ( ('/share/', _('Overview')), ('/share/favorites', _('Favorite Episodes')), From 00d9d6d8b26bc5ed029c7b5ece3a43b09f9d659a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Mon, 15 Oct 2018 22:07:52 +0200 Subject: [PATCH 10/13] Remove secondary navigation from "Community" primary nav --- mygpo/directory/templates/directory.html | 2 +- mygpo/share/templates/share/overview.html | 12 ++++++++++++ mygpo/web/templatetags/menu.py | 7 ------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mygpo/directory/templates/directory.html b/mygpo/directory/templates/directory.html index 28d3bfeb4..fd8a8c5a1 100644 --- a/mygpo/directory/templates/directory.html +++ b/mygpo/directory/templates/directory.html @@ -17,7 +17,7 @@

      {% trans "Podcast Directory" %}