From 7beec38881e8e9e5c79a0a4503c366315592014b Mon Sep 17 00:00:00 2001 From: Basraah Date: Sat, 23 Sep 2017 06:48:51 +1000 Subject: [PATCH] Move templates and fix namespacing Move base template Refactor services urls and templates Refactor groupmanagement urls and templates Refactor notifications urls and templates --- .../templates/authentication/dashboard.html | 2 +- allianceauth/authentication/urls.py | 2 +- .../corputils/templates/corputils/base.html | 2 +- .../characternotexisting.html | 2 +- .../fatlinkformatter.html | 2 +- .../fleetactivitytracking/fatlinkmodify.html | 2 +- .../fatlinkpersonalmonthlystatisticsview.html | 2 +- .../fatlinkpersonalstatisticsview.html | 2 +- .../fatlinkstatisticscorpview.html | 2 +- .../fatlinkstatisticsview.html | 2 +- .../fleetactivitytracking/fatlinkview.html | 2 +- allianceauth/fleetactivitytracking/urls.py | 3 +- .../fleetup/templates/fleetup/characters.html | 2 +- .../fleetup/templates/fleetup/doctrine.html | 2 +- .../templates/fleetup/doctrinesview.html | 2 +- .../fleetup/templates/fleetup/fitting.html | 2 +- .../templates/fleetup/fittingsview.html | 2 +- .../fleetup/templates/fleetup/index.html | 2 +- .../groupmanagement}/groupmembers.html | 6 +- .../groupmanagement}/groupmembership.html | 6 +- .../templates/groupmanagement}/groups.html | 8 +-- .../templates/groupmanagement/index.html} | 12 ++-- .../templates/groupmanagement/menu.html} | 4 +- allianceauth/groupmanagement/urls.py | 31 +++++++++ allianceauth/groupmanagement/views.py | 34 +++++----- .../templates/hrapplications/corpchoice.html | 2 +- .../templates/hrapplications/create.html | 2 +- .../templates/hrapplications/management.html | 2 +- .../templates/hrapplications/searchview.html | 2 +- .../templates/hrapplications/view.html | 2 +- .../templates/notifications/list.html} | 14 ++-- .../templates/notifications/view.html} | 6 +- allianceauth/notifications/urls.py | 12 ++++ allianceauth/notifications/views.py | 12 ++-- .../optimer/templates/optimer/add.html | 2 +- .../optimer/templates/optimer/management.html | 2 +- .../optimer/templates/optimer/update.html | 2 +- .../templates/permissions_tool/audit.html | 2 +- .../templates/permissions_tool/overview.html | 2 +- allianceauth/permissions_tool/urls.py | 2 + allianceauth/services/auth_hooks.py | 2 +- allianceauth/services/hooks.py | 2 +- .../services/modules/discord/auth_hooks.py | 2 +- .../discord}/discord_service_ctrl.html | 8 +-- .../services/modules/discord/tests.py | 6 +- allianceauth/services/modules/discord/urls.py | 12 ++-- .../services/modules/discord/views.py | 10 +-- .../services/modules/discourse/auth_hooks.py | 2 +- .../discourse}/discourse_service_ctrl.html | 0 .../services/modules/discourse/tests.py | 2 +- allianceauth/services/modules/example/urls.py | 2 +- .../services/modules/ips4/auth_hooks.py | 8 +-- allianceauth/services/modules/ips4/tests.py | 24 +++---- allianceauth/services/modules/ips4/urls.py | 10 +-- allianceauth/services/modules/ips4/views.py | 14 ++-- .../services/modules/market/auth_hooks.py | 8 +-- allianceauth/services/modules/market/tests.py | 26 ++++---- allianceauth/services/modules/market/urls.py | 10 +-- allianceauth/services/modules/market/views.py | 14 ++-- .../services/modules/mumble/auth_hooks.py | 10 +-- .../mumble}/mumble_service_ctrl.html | 0 allianceauth/services/modules/mumble/tests.py | 24 +++---- allianceauth/services/modules/mumble/urls.py | 10 +-- allianceauth/services/modules/mumble/views.py | 14 ++-- .../services/modules/openfire/auth_hooks.py | 12 ++-- .../services/openfire/broadcast.html} | 2 +- .../services/modules/openfire/tests.py | 26 ++++---- .../services/modules/openfire/urls.py | 23 ++----- .../services/modules/openfire/views.py | 16 ++--- .../services/modules/phpbb3/auth_hooks.py | 8 +-- allianceauth/services/modules/phpbb3/tests.py | 26 ++++---- allianceauth/services/modules/phpbb3/urls.py | 10 +-- allianceauth/services/modules/phpbb3/views.py | 14 ++-- .../services/modules/seat/auth_hooks.py | 8 +-- allianceauth/services/modules/seat/tests.py | 26 ++++---- allianceauth/services/modules/seat/urls.py | 10 +-- allianceauth/services/modules/seat/views.py | 16 ++--- .../services/modules/smf/auth_hooks.py | 8 +-- allianceauth/services/modules/smf/tests.py | 26 ++++---- allianceauth/services/modules/smf/urls.py | 10 +-- allianceauth/services/modules/smf/views.py | 14 ++-- .../services/modules/teamspeak3/auth_hooks.py | 2 +- .../teamspeak3}/teamspeak3_service_ctrl.html | 8 +-- .../services/teamspeak3}/teamspeakjoin.html | 4 +- .../services/modules/teamspeak3/tests.py | 24 +++---- .../services/modules/teamspeak3/urls.py | 10 +-- .../services/modules/teamspeak3/views.py | 16 ++--- .../services/modules/xenforo/auth_hooks.py | 8 +-- .../services/modules/xenforo/tests.py | 24 +++---- allianceauth/services/modules/xenforo/urls.py | 10 +-- .../services/modules/xenforo/views.py | 14 ++-- .../services}/fleetformattertool.html | 2 +- .../services}/service_credentials.html | 4 +- .../templates/services}/service_password.html | 2 +- .../templates/services}/services.html | 2 +- .../templates/services}/services_ctrl.html | 0 allianceauth/services/urls.py | 18 ++++++ allianceauth/services/views.py | 4 +- allianceauth/srp/templates/srp/add.html | 2 +- allianceauth/srp/templates/srp/data.html | 2 +- .../srp/templates/srp/management.html | 2 +- allianceauth/srp/templates/srp/request.html | 2 +- allianceauth/srp/templates/srp/update.html | 2 +- allianceauth/srp/urls.py | 2 +- .../allianceauth}/base.html | 10 +-- .../{registered => allianceauth}/help.html | 2 +- .../timerboard/templates/timerboard/add.html | 2 +- .../templates/timerboard/management.html | 2 +- .../templates/timerboard/update.html | 2 +- allianceauth/urls.py | 64 ++++--------------- 110 files changed, 468 insertions(+), 457 deletions(-) rename allianceauth/{templates/registered => groupmanagement/templates/groupmanagement}/groupmembers.html (88%) rename allianceauth/{templates/registered => groupmanagement/templates/groupmanagement}/groupmembership.html (91%) rename allianceauth/{templates/registered => groupmanagement/templates/groupmanagement}/groups.html (87%) rename allianceauth/{templates/registered/groupmanagement.html => groupmanagement/templates/groupmanagement/index.html} (85%) rename allianceauth/{templates/registered/groupmanagementmenu.html => groupmanagement/templates/groupmanagement/menu.html} (83%) create mode 100644 allianceauth/groupmanagement/urls.py rename allianceauth/{templates/registered/notification_list.html => notifications/templates/notifications/list.html} (93%) rename allianceauth/{templates/registered/notification_view.html => notifications/templates/notifications/view.html} (82%) create mode 100644 allianceauth/notifications/urls.py rename allianceauth/services/modules/discord/templates/{registered => services/discord}/discord_service_ctrl.html (69%) rename allianceauth/services/modules/discourse/templates/{registered => services/discourse}/discourse_service_ctrl.html (100%) rename allianceauth/services/modules/mumble/templates/{registered => services/mumble}/mumble_service_ctrl.html (100%) rename allianceauth/{templates/registered/jabberbroadcast.html => services/modules/openfire/templates/services/openfire/broadcast.html} (96%) rename allianceauth/services/modules/teamspeak3/templates/{registered => services/teamspeak3}/teamspeak3_service_ctrl.html (68%) rename allianceauth/{templates/registered => services/modules/teamspeak3/templates/services/teamspeak3}/teamspeakjoin.html (92%) rename allianceauth/{templates/registered => services/templates/services}/fleetformattertool.html (96%) rename allianceauth/{templates/registered => services/templates/services}/service_credentials.html (83%) rename allianceauth/{templates/registered => services/templates/services}/service_password.html (96%) rename allianceauth/{templates/registered => services/templates/services}/services.html (95%) rename allianceauth/{templates/registered => services/templates/services}/services_ctrl.html (100%) create mode 100644 allianceauth/services/urls.py rename allianceauth/{authentication/templates/registered => templates/allianceauth}/base.html (92%) rename allianceauth/templates/{registered => allianceauth}/help.html (93%) diff --git a/allianceauth/authentication/templates/authentication/dashboard.html b/allianceauth/authentication/templates/authentication/dashboard.html index 0cb36f7a..8800985a 100644 --- a/allianceauth/authentication/templates/authentication/dashboard.html +++ b/allianceauth/authentication/templates/authentication/dashboard.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/authentication/urls.py b/allianceauth/authentication/urls.py index cd35db3e..c3089b84 100644 --- a/allianceauth/authentication/urls.py +++ b/allianceauth/authentication/urls.py @@ -11,7 +11,7 @@ urlpatterns = [ url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='login'), url(r'^account/characters/main/$', views.main_character_change, name='change_main_character'), url(r'^account/characters/add/$', views.add_character, name='add_character'), - url(r'^help/$', login_required(TemplateView.as_view(template_name='registered/help.html')), name='help'), + url(r'^help/$', login_required(TemplateView.as_view(template_name='allianceauth/help.html')), name='help'), url(r'^dashboard/$', login_required(TemplateView.as_view(template_name='authentication/dashboard.html')), name='dashboard'), ] diff --git a/allianceauth/corputils/templates/corputils/base.html b/allianceauth/corputils/templates/corputils/base.html index 1140e4f3..a2f3de93 100644 --- a/allianceauth/corputils/templates/corputils/base.html +++ b/allianceauth/corputils/templates/corputils/base.html @@ -1,4 +1,4 @@ -{% extends 'registered/base.html' %} +{% extends 'allianceauth/base.html' %} {% load i18n %} {% block title %}{% trans "Corporation Member Data" %}{% endblock %} {% block page_title %}{% trans "Corporation Member Data" %}{% endblock %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html index 3477f152..3de8baeb 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html @@ -1,4 +1,4 @@ -{% extends 'registered/base.html' %} +{% extends 'allianceauth/base.html' %} {% load i18n %} {% block title %}Fleet Participation{% endblock %} {% block page_title %}{% trans "Fleet Participation" %}{% endblock %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html index 84519100..88d703eb 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html index 33a35e29..8b507612 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html index daaeb94d..a06ac2ba 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html index df415267..59654b7b 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html index 980013df..ea3113ef 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html index c7ac83f0..6445b9be 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html index ce2ae787..52a40d65 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetactivitytracking/urls.py b/allianceauth/fleetactivitytracking/urls.py index e6e6113a..0d7984fb 100644 --- a/allianceauth/fleetactivitytracking/urls.py +++ b/allianceauth/fleetactivitytracking/urls.py @@ -1,6 +1,7 @@ from django.conf.urls import url from . import views +app_name = 'fleetactivitytracking' urlpatterns = [ # FleetActivityTracking (FAT) @@ -30,4 +31,4 @@ urlpatterns = [ url(r'^link/$', views.fatlink_view, name='click_fatlink'), url(r'^link/(?P[a-zA-Z0-9]+)/(?P[a-z0-9_-]+)/$', views.click_fatlink_view), - ] \ No newline at end of file +] diff --git a/allianceauth/fleetup/templates/fleetup/characters.html b/allianceauth/fleetup/templates/fleetup/characters.html index b03738ca..63b4c502 100644 --- a/allianceauth/fleetup/templates/fleetup/characters.html +++ b/allianceauth/fleetup/templates/fleetup/characters.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetup/templates/fleetup/doctrine.html b/allianceauth/fleetup/templates/fleetup/doctrine.html index 04a0a11b..0f3cf34f 100644 --- a/allianceauth/fleetup/templates/fleetup/doctrine.html +++ b/allianceauth/fleetup/templates/fleetup/doctrine.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetup/templates/fleetup/doctrinesview.html b/allianceauth/fleetup/templates/fleetup/doctrinesview.html index 95c22446..d0747bc0 100644 --- a/allianceauth/fleetup/templates/fleetup/doctrinesview.html +++ b/allianceauth/fleetup/templates/fleetup/doctrinesview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetup/templates/fleetup/fitting.html b/allianceauth/fleetup/templates/fleetup/fitting.html index eff0956a..f0677757 100644 --- a/allianceauth/fleetup/templates/fleetup/fitting.html +++ b/allianceauth/fleetup/templates/fleetup/fitting.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetup/templates/fleetup/fittingsview.html b/allianceauth/fleetup/templates/fleetup/fittingsview.html index 3d2c73b6..f40d7d62 100644 --- a/allianceauth/fleetup/templates/fleetup/fittingsview.html +++ b/allianceauth/fleetup/templates/fleetup/fittingsview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/fleetup/templates/fleetup/index.html b/allianceauth/fleetup/templates/fleetup/index.html index b216bdb6..91e55353 100644 --- a/allianceauth/fleetup/templates/fleetup/index.html +++ b/allianceauth/fleetup/templates/fleetup/index.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/templates/registered/groupmembers.html b/allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html similarity index 88% rename from allianceauth/templates/registered/groupmembers.html rename to allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html index 4cb24985..70958e50 100644 --- a/allianceauth/templates/registered/groupmembers.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} @@ -10,7 +10,7 @@ {% block content %}

- {% include 'registered/groupmanagementmenu.html' %} + {% include 'groupmanagement/menu.html' %}

{{ group.name }} {% trans 'Members' %}

{% if group.user_set %} @@ -29,7 +29,7 @@ {{ member.main_char.corporation_name }} {{ member.main_char.alliance_name }} - diff --git a/allianceauth/templates/registered/groupmembership.html b/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html similarity index 91% rename from allianceauth/templates/registered/groupmembership.html rename to allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html index 4d7896bf..cb53129c 100644 --- a/allianceauth/templates/registered/groupmembership.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} @@ -10,7 +10,7 @@ {% block content %}

- {% include 'registered/groupmanagementmenu.html' %} + {% include 'groupmanagement/menu.html' %}
{% if groups %}

Groups

@@ -39,7 +39,7 @@ {{ group.num_members }} - diff --git a/allianceauth/templates/registered/groups.html b/allianceauth/groupmanagement/templates/groupmanagement/groups.html similarity index 87% rename from allianceauth/templates/registered/groups.html rename to allianceauth/groupmanagement/templates/groupmanagement/groups.html index 9cd222c1..dd2ea948 100644 --- a/allianceauth/templates/registered/groups.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groups.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} @@ -6,7 +6,7 @@ {% block page_title %}{% trans "Available" %}{% endblock page_title %} {% block extra_css %}{% endblock extra_css %} - +url {% block content %}

{% trans "Available Groups" %}

@@ -25,7 +25,7 @@ {% if g.group in user.groups.all %} {% if not g.request %} - + {% trans "Leave" %} {% else %} @@ -34,7 +34,7 @@ {% endif %} {% elif not g.request %} - + {% trans "Request" %} {% else %} diff --git a/allianceauth/templates/registered/groupmanagement.html b/allianceauth/groupmanagement/templates/groupmanagement/index.html similarity index 85% rename from allianceauth/templates/registered/groupmanagement.html rename to allianceauth/groupmanagement/templates/groupmanagement/index.html index 84d077d5..a403f42c 100644 --- a/allianceauth/templates/registered/groupmanagement.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/index.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} @@ -10,7 +10,7 @@ {% block content %}

- {% include 'registered/groupmanagementmenu.html' %} + {% include 'groupmanagement/menu.html' %} @@ -41,11 +41,11 @@ {{ notif.timestamp }} {{ notif.title }} - - @@ -73,11 +73,11 @@ {{ notif.timestamp }} {{ notif.title }} - - diff --git a/allianceauth/templates/registered/notification_view.html b/allianceauth/notifications/templates/notifications/view.html similarity index 82% rename from allianceauth/templates/registered/notification_view.html rename to allianceauth/notifications/templates/notifications/view.html index b23702a9..785b1e90 100644 --- a/allianceauth/templates/registered/notification_view.html +++ b/allianceauth/notifications/templates/notifications/view.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} @@ -11,12 +11,12 @@

{% trans "View Notification" %}

-
+
diff --git a/allianceauth/notifications/urls.py b/allianceauth/notifications/urls.py new file mode 100644 index 00000000..e4ac9644 --- /dev/null +++ b/allianceauth/notifications/urls.py @@ -0,0 +1,12 @@ +from django.conf.urls import url +from . import views + +app_name = 'notifications' +# Notifications +urlpatterns = [ + url(r'^remove_notifications/(\w+)/$', views.remove_notification, name='remove'), + url(r'^notifications/mark_all_read/$', views.mark_all_read, name='mark_all_read'), + url(r'^notifications/delete_all_read/$', views.delete_all_read, name='delete_all_read'), + url(r'^notifications/$', views.notification_list, name='list'), + url(r'^notifications/(\w+)/$', views.notification_view, name='view'), +] diff --git a/allianceauth/notifications/views.py b/allianceauth/notifications/views.py index d6acbd26..dc66fe87 100644 --- a/allianceauth/notifications/views.py +++ b/allianceauth/notifications/views.py @@ -18,7 +18,7 @@ def notification_list(request): 'read': old_notifs, 'unread': new_notifs, } - return render(request, 'registered/notification_list.html', context) + return render(request, 'notifications/list.html', context) @login_required @@ -29,12 +29,12 @@ def notification_view(request, notif_id): logger.debug("Providing notification for user %s" % request.user) context = {'notif': notif} notif.view() - return render(request, 'registered/notification_view.html', context) + return render(request, 'notifications/view.html', context) else: logger.warn( "User %s not authorized to view notif_id %s belonging to user %s" % (request.user, notif_id, notif.user)) messages.error(request, _('You are not authorized to view that notification.')) - return redirect('auth_notification_list') + return redirect('notifications:list') @login_required @@ -50,7 +50,7 @@ def remove_notification(request, notif_id): logger.error( "Unable to delete notif id %s for user %s - notif matching id not found." % (notif_id, request.user)) messages.error(request, _('Failed to locate notification.')) - return redirect('auth_notification_list') + return redirect('notifications:list') @login_required @@ -58,7 +58,7 @@ def mark_all_read(request): logger.debug('mark all notifications read called by user %s' % request.user) Notification.objects.filter(user=request.user).update(viewed=True) messages.success(request, _('Marked all notifications as read.')) - return redirect('auth_notification_list') + return redirect('notifications:list') @login_required @@ -66,4 +66,4 @@ def delete_all_read(request): logger.debug('delete all read notifications called by user %s' % request.user) Notification.objects.filter(user=request.user).filter(viewed=True).delete() messages.success(request, _('Deleted all read notifications.')) - return redirect('auth_notification_list') + return redirect('notifications:list') diff --git a/allianceauth/optimer/templates/optimer/add.html b/allianceauth/optimer/templates/optimer/add.html index f893e5f3..da33abbd 100644 --- a/allianceauth/optimer/templates/optimer/add.html +++ b/allianceauth/optimer/templates/optimer/add.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/optimer/templates/optimer/management.html b/allianceauth/optimer/templates/optimer/management.html index 760751c4..3b57da48 100644 --- a/allianceauth/optimer/templates/optimer/management.html +++ b/allianceauth/optimer/templates/optimer/management.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} {% get_current_language as LANGUAGE_CODE %} diff --git a/allianceauth/optimer/templates/optimer/update.html b/allianceauth/optimer/templates/optimer/update.html index 5fc2b53a..78a0ad6c 100644 --- a/allianceauth/optimer/templates/optimer/update.html +++ b/allianceauth/optimer/templates/optimer/update.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/permissions_tool/templates/permissions_tool/audit.html b/allianceauth/permissions_tool/templates/permissions_tool/audit.html index 69657f8e..660d8dcb 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/audit.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/audit.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/permissions_tool/templates/permissions_tool/overview.html b/allianceauth/permissions_tool/templates/permissions_tool/overview.html index bb1b0de1..86f5daf4 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/overview.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/overview.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/permissions_tool/urls.py b/allianceauth/permissions_tool/urls.py index faa8bdd1..b0e1b6a9 100644 --- a/allianceauth/permissions_tool/urls.py +++ b/allianceauth/permissions_tool/urls.py @@ -2,6 +2,8 @@ from django.conf.urls import url from . import views +app_name = 'permissions_tool' + urlpatterns = [ url(r'^overview/$', views.permissions_overview, name='overview'), url(r'^audit/(?P[\w\-_]+)/(?P[\w\-_]+)/(?P[\w\-_]+)/$', views.permissions_audit, diff --git a/allianceauth/services/auth_hooks.py b/allianceauth/services/auth_hooks.py index 1b888d5b..f549685c 100644 --- a/allianceauth/services/auth_hooks.py +++ b/allianceauth/services/auth_hooks.py @@ -8,7 +8,7 @@ class Services(MenuItemHook): MenuItemHook.__init__(self, 'Services', 'fa fa-cogs fa-fw grayiconecolor', - 'auth_services', 100) + 'services:services', 100) def render(self, request): for svc in ServicesHook.get_services(): diff --git a/allianceauth/services/hooks.py b/allianceauth/services/hooks.py index d5cd35ec..e4d79121 100644 --- a/allianceauth/services/hooks.py +++ b/allianceauth/services/hooks.py @@ -14,7 +14,7 @@ class ServicesHook: def __init__(self): self.name = 'Undefined' self.urlpatterns = [] - self.service_ctrl_template = 'registered/services_ctrl.html' + self.service_ctrl_template = 'services/services_ctrl.html' self.access_perm = None @property diff --git a/allianceauth/services/modules/discord/auth_hooks.py b/allianceauth/services/modules/discord/auth_hooks.py index a863b620..d0f1e622 100644 --- a/allianceauth/services/modules/discord/auth_hooks.py +++ b/allianceauth/services/modules/discord/auth_hooks.py @@ -15,7 +15,7 @@ class DiscordService(ServicesHook): ServicesHook.__init__(self) self.urlpatterns = urlpatterns self.name = 'discord' - self.service_ctrl_template = 'registered/discord_service_ctrl.html' + self.service_ctrl_template = 'services/discord/discord_service_ctrl.html' self.access_perm = 'discord.access_discord' def delete_user(self, user, notify_user=False): diff --git a/allianceauth/services/modules/discord/templates/registered/discord_service_ctrl.html b/allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html similarity index 69% rename from allianceauth/services/modules/discord/templates/registered/discord_service_ctrl.html rename to allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html index a2449910..74b2030d 100644 --- a/allianceauth/services/modules/discord/templates/registered/discord_service_ctrl.html +++ b/allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html @@ -7,20 +7,20 @@ https://discordapp.com {% if not discord_uid %} - + {% else %} - + - + {% endif %} {% if request.user.is_superuser %} {% endif %} diff --git a/allianceauth/services/modules/discord/tests.py b/allianceauth/services/modules/discord/tests.py index a93dc6ea..c7de8f2d 100644 --- a/allianceauth/services/modules/discord/tests.py +++ b/allianceauth/services/modules/discord/tests.py @@ -120,7 +120,7 @@ class DiscordHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) @@ -166,7 +166,7 @@ class DiscordViewsTestCase(TestCase): self.assertTrue(manager.add_user.called) self.assertEqual(manager.update_nickname.called, settings.DISCORD_SYNC_NAMES) self.assertEqual(self.member.discord.uid, '1234') - self.assertRedirects(response, expected_url='/en/services/', target_status_code=200) + self.assertRedirects(response, expected_url='/services/', target_status_code=200) @mock.patch(MODULE_PATH + '.tasks.DiscordOAuthManager') def test_reset(self, manager): @@ -187,7 +187,7 @@ class DiscordViewsTestCase(TestCase): response = self.client.get('/discord/deactivate/') self.assertTrue(manager.delete_user.called) - self.assertRedirects(response, expected_url='/en/services/', target_status_code=200) + self.assertRedirects(response, expected_url='/services/', target_status_code=200) with self.assertRaises(ObjectDoesNotExist): discord_user = User.objects.get(pk=self.member.pk).discord diff --git a/allianceauth/services/modules/discord/urls.py b/allianceauth/services/modules/discord/urls.py index af324c73..056ebc3e 100644 --- a/allianceauth/services/modules/discord/urls.py +++ b/allianceauth/services/modules/discord/urls.py @@ -4,13 +4,13 @@ from . import views module_urls = [ # Discord Service Control - url(r'^activate/$', views.activate_discord, name='auth_activate_discord'), - url(r'^deactivate/$', views.deactivate_discord, name='auth_deactivate_discord'), - url(r'^reset/$', views.reset_discord, name='auth_reset_discord'), - url(r'^callback/$', views.discord_callback, name='auth_discord_callback'), - url(r'^add_bot/$', views.discord_add_bot, name='auth_discord_add_bot'), + url(r'^activate/$', views.activate_discord, name='activate'), + url(r'^deactivate/$', views.deactivate_discord, name='deactivate'), + url(r'^reset/$', views.reset_discord, name='reset'), + url(r'^callback/$', views.discord_callback, name='callback'), + url(r'^add_bot/$', views.discord_add_bot, name='add_bot'), ] urlpatterns = [ - url(r'^discord/', include(module_urls)) + url(r'^discord/', include(module_urls, namespace='discord')) ] diff --git a/allianceauth/services/modules/discord/views.py b/allianceauth/services/modules/discord/views.py index 9b5fc1bb..53e4f9aa 100644 --- a/allianceauth/services/modules/discord/views.py +++ b/allianceauth/services/modules/discord/views.py @@ -25,7 +25,7 @@ def deactivate_discord(request): else: logger.error("Unsuccessful attempt to deactivate discord for user %s" % request.user) messages.error(request, 'An error occurred while processing your Discord account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -34,10 +34,10 @@ def reset_discord(request): logger.debug("reset_discord called by user %s" % request.user) if DiscordTasks.delete_user(request.user): logger.info("Successfully deleted discord user for user %s - forwarding to discord activation." % request.user) - return redirect("auth_activate_discord") + return redirect("discord:activate") logger.error("Unsuccessful attempt to reset discord for user %s" % request.user) messages.error(request, 'An error occurred while processing your Discord account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -54,14 +54,14 @@ def discord_callback(request): code = request.GET.get('code', None) if not code: logger.warn("Did not receive OAuth code from callback of user %s" % request.user) - return redirect("auth_services") + return redirect("services:services") if DiscordTasks.add_user(request.user, code): logger.info("Successfully activated Discord for user %s" % request.user) messages.success(request, 'Activated Discord account.') else: logger.error("Failed to activate Discord for user %s" % request.user) messages.error(request, 'An error occurred while processing your Discord account.') - return redirect("auth_services") + return redirect("services:services") @login_required diff --git a/allianceauth/services/modules/discourse/auth_hooks.py b/allianceauth/services/modules/discourse/auth_hooks.py index 30e40471..4a33b960 100644 --- a/allianceauth/services/modules/discourse/auth_hooks.py +++ b/allianceauth/services/modules/discourse/auth_hooks.py @@ -15,7 +15,7 @@ class DiscourseService(ServicesHook): ServicesHook.__init__(self) self.urlpatterns = urlpatterns self.name = 'discourse' - self.service_ctrl_template = 'registered/discourse_service_ctrl.html' + self.service_ctrl_template = 'services/discourse/discourse_service_ctrl.html' self.access_perm = 'discourse.access_discourse' def delete_user(self, user, notify_user=False): diff --git a/allianceauth/services/modules/discourse/templates/registered/discourse_service_ctrl.html b/allianceauth/services/modules/discourse/templates/services/discourse/discourse_service_ctrl.html similarity index 100% rename from allianceauth/services/modules/discourse/templates/registered/discourse_service_ctrl.html rename to allianceauth/services/modules/discourse/templates/services/discourse/discourse_service_ctrl.html diff --git a/allianceauth/services/modules/discourse/tests.py b/allianceauth/services/modules/discourse/tests.py index 8944a1ca..189a0c55 100644 --- a/allianceauth/services/modules/discourse/tests.py +++ b/allianceauth/services/modules/discourse/tests.py @@ -102,7 +102,7 @@ class DiscourseHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) diff --git a/allianceauth/services/modules/example/urls.py b/allianceauth/services/modules/example/urls.py index 3a387d4f..3df31b1a 100644 --- a/allianceauth/services/modules/example/urls.py +++ b/allianceauth/services/modules/example/urls.py @@ -5,5 +5,5 @@ module_urls = [ ] urlpatterns = [ - url(r'^example/', include(module_urls)), + url(r'^example/', include(module_urls, namespace='example')), ] diff --git a/allianceauth/services/modules/ips4/auth_hooks.py b/allianceauth/services/modules/ips4/auth_hooks.py index 77bdfe88..45f5c511 100644 --- a/allianceauth/services/modules/ips4/auth_hooks.py +++ b/allianceauth/services/modules/ips4/auth_hooks.py @@ -31,10 +31,10 @@ class Ips4Service(ServicesHook): :return: """ urls = self.Urls() - urls.auth_activate = 'auth_activate_ips4' - urls.auth_deactivate = 'auth_deactivate_ips4' - urls.auth_reset_password = 'auth_reset_ips4_password' - urls.auth_set_password = 'auth_set_ips4_password' + urls.auth_activate = 'ips4:activate' + urls.auth_deactivate = 'ips4:deactivate' + urls.auth_reset_password = 'ips4:reset_password' + urls.auth_set_password = 'ips4:set_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, 'urls': urls, diff --git a/allianceauth/services/modules/ips4/tests.py b/allianceauth/services/modules/ips4/tests.py index c9b24bf4..613c95d5 100644 --- a/allianceauth/services/modules/ips4/tests.py +++ b/allianceauth/services/modules/ips4/tests.py @@ -53,16 +53,16 @@ class Ips4HooksTestCase(TestCase): response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_set_ips4_password'), response) - self.assertIn(urls.reverse('auth_reset_ips4_password'), response) - self.assertIn(urls.reverse('auth_deactivate_ips4'), response) + self.assertIn(urls.reverse('ips4:set_password'), response) + self.assertIn(urls.reverse('ips4:reset_password'), response) + self.assertIn(urls.reverse('ips4:deactivate'), response) # Test register becomes available member.ips4.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_ips4'), response) + self.assertIn(urls.reverse('ips4:activate'), response) class Ips4ViewsTestCase(TestCase): @@ -86,14 +86,14 @@ class Ips4ViewsTestCase(TestCase): manager.add_user.return_value = (expected_username, expected_password, expected_id) - response = self.client.get(urls.reverse('auth_activate_ips4'), follow=False) + response = self.client.get(urls.reverse('ips4:activate'), follow=False) self.assertTrue(manager.add_user.called) args, kwargs = manager.add_user.call_args self.assertEqual(args[0], expected_username) self.assertEqual(args[1], self.member.email) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, expected_username) self.assertContains(response, expected_password) @@ -103,10 +103,10 @@ class Ips4ViewsTestCase(TestCase): Ips4User.objects.create(user=self.member, username='12345', id='1234') manager.delete_user.return_value = True - response = self.client.get(urls.reverse('auth_deactivate_ips4')) + response = self.client.get(urls.reverse('ips4:deactivate')) self.assertTrue(manager.delete_user.called) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): ips4_user = User.objects.get(pk=self.member.pk).ips4 @@ -117,22 +117,22 @@ class Ips4ViewsTestCase(TestCase): expected_password = 'password' manager.update_user_password.return_value = expected_password - response = self.client.post(urls.reverse('auth_set_ips4_password'), data={'password': expected_password}) + response = self.client.post(urls.reverse('ips4:set_password'), data={'password': expected_password}) self.assertTrue(manager.update_custom_password.called) args, kwargs = manager.update_custom_password.call_args self.assertEqual(kwargs['plain_password'], expected_password) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) @mock.patch(MODULE_PATH + '.views.Ips4Manager') def test_reset_password(self, manager): self.login() Ips4User.objects.create(user=self.member, username='12345', id='1234') - response = self.client.get(urls.reverse('auth_reset_ips4_password')) + response = self.client.get(urls.reverse('ips4:reset_password')) self.assertTrue(manager.update_user_password.called) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') class Ips4ManagerTestCase(TestCase): diff --git a/allianceauth/services/modules/ips4/urls.py b/allianceauth/services/modules/ips4/urls.py index c6f5779d..f6c65907 100644 --- a/allianceauth/services/modules/ips4/urls.py +++ b/allianceauth/services/modules/ips4/urls.py @@ -4,12 +4,12 @@ from . import views module_urls = [ # IPS4 Service Control - url(r'^activate/$', views.activate_ips4, name='auth_activate_ips4'), - url(r'^deactivate/$', views.deactivate_ips4, name='auth_deactivate_ips4'), - url(r'^reset_password/$', views.reset_ips4_password, name='auth_reset_ips4_password'), - url(r'^set_password/$', views.set_ips4_password, name='auth_set_ips4_password'), + url(r'^activate/$', views.activate_ips4, name='activate'), + url(r'^deactivate/$', views.deactivate_ips4, name='deactivate'), + url(r'^reset_password/$', views.reset_ips4_password, name='reset_password'), + url(r'^set_password/$', views.set_ips4_password, name='set_password'), ] urlpatterns = [ - url(r'^ips4/', include(module_urls)) + url(r'^ips4/', include(module_urls, namespace='ips4')) ] diff --git a/allianceauth/services/modules/ips4/views.py b/allianceauth/services/modules/ips4/views.py index 3834a715..a86de328 100644 --- a/allianceauth/services/modules/ips4/views.py +++ b/allianceauth/services/modules/ips4/views.py @@ -32,12 +32,12 @@ def activate_ips4(request): 'username': result[0], 'password': result[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'IPSuite4'}) else: logger.error("Unsuccessful attempt to activate IPS4 for user %s" % request.user) messages.error(request, 'An error occurred while processing your IPSuite4 account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -54,12 +54,12 @@ def reset_ips4_password(request): 'username': request.user.ips4.username, 'password': result, } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'IPSuite4'}) logger.error("Unsuccessful attempt to reset IPS4 password for user %s" % request.user) messages.error(request, 'An error occurred while processing your IPSuite4 account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -80,14 +80,14 @@ def set_ips4_password(request): else: logger.error("Failed to install custom IPS4 password for user %s" % request.user) messages.error(request, 'An error occurred while processing your IPSuite4 account.') - return redirect('auth_services') + return redirect('services:services') else: logger.debug("Request is not type POST - providing empty form.") form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'IPS4'} - return render(request, 'registered/service_password.html', context=context) + return render(request, 'services/service_password.html', context=context) @login_required @@ -100,5 +100,5 @@ def deactivate_ips4(request): else: logger.error("Unsuccessful attempt to deactivate IPS4 for user %s" % request.user) messages.error(request, 'An error occurred while processing your IPSuite4 account.') - return redirect("auth_services") + return redirect("services:services") diff --git a/allianceauth/services/modules/market/auth_hooks.py b/allianceauth/services/modules/market/auth_hooks.py index 19e115fa..472f8574 100644 --- a/allianceauth/services/modules/market/auth_hooks.py +++ b/allianceauth/services/modules/market/auth_hooks.py @@ -37,10 +37,10 @@ class MarketService(ServicesHook): def render_services_ctrl(self, request): urls = self.Urls() - urls.auth_activate = 'auth_activate_market' - urls.auth_deactivate = 'auth_deactivate_market' - urls.auth_reset_password = 'auth_reset_market_password' - urls.auth_set_password = 'auth_set_market_password' + urls.auth_activate = 'evernusmarket:activate' + urls.auth_deactivate = 'evernusmarket:deactivate' + urls.auth_reset_password = 'evernusmarket:reset_password' + urls.auth_set_password = 'evernusmarket:set_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, 'urls': urls, diff --git a/allianceauth/services/modules/market/tests.py b/allianceauth/services/modules/market/tests.py index 3c9f5f63..fa463925 100644 --- a/allianceauth/services/modules/market/tests.py +++ b/allianceauth/services/modules/market/tests.py @@ -76,21 +76,21 @@ class MarketHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_set_market_password'), response) - self.assertIn(urls.reverse('auth_reset_market_password'), response) - self.assertIn(urls.reverse('auth_deactivate_market'), response) + self.assertIn(urls.reverse('evernusmarket:set_password'), response) + self.assertIn(urls.reverse('evernusmarket:reset_password'), response) + self.assertIn(urls.reverse('evernusmarket:deactivate'), response) # Test register becomes available member.market.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_market'), response) + self.assertIn(urls.reverse('evernusmarket:activate'), response) class MarketViewsTestCase(TestCase): @@ -114,14 +114,14 @@ class MarketViewsTestCase(TestCase): manager.add_user.return_value = (expected_username, expected_password, expected_id) - response = self.client.get(urls.reverse('auth_activate_market'), follow=False) + response = self.client.get(urls.reverse('evernusmarket:activate'), follow=False) self.assertTrue(manager.add_user.called) args, kwargs = manager.add_user.call_args self.assertEqual(args[0], expected_username) self.assertEqual(args[1], self.member.email) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, expected_username) self.assertContains(response, expected_password) @@ -131,10 +131,10 @@ class MarketViewsTestCase(TestCase): MarketUser.objects.create(user=self.member, username='12345') manager.disable_user.return_value = True - response = self.client.get(urls.reverse('auth_deactivate_market')) + response = self.client.get(urls.reverse('evernusmarket:deactivate')) self.assertTrue(manager.disable_user.called) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): market_user = User.objects.get(pk=self.member.pk).market @@ -145,22 +145,22 @@ class MarketViewsTestCase(TestCase): expected_password = 'password' manager.update_user_password.return_value = expected_password - response = self.client.post(urls.reverse('auth_set_market_password'), data={'password': expected_password}) + response = self.client.post(urls.reverse('evernusmarket:set_password'), data={'password': expected_password}) self.assertTrue(manager.update_custom_password.called) args, kwargs = manager.update_custom_password.call_args self.assertEqual(args[1], expected_password) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) @mock.patch(MODULE_PATH + '.views.MarketManager') def test_reset_password(self, manager): self.login() MarketUser.objects.create(user=self.member, username='12345') - response = self.client.get(urls.reverse('auth_reset_market_password')) + response = self.client.get(urls.reverse('evernusmarket:reset_password')) self.assertTrue(manager.update_user_password.called) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') class MarketManagerTestCase(TestCase): diff --git a/allianceauth/services/modules/market/urls.py b/allianceauth/services/modules/market/urls.py index 175fccf0..d588c792 100644 --- a/allianceauth/services/modules/market/urls.py +++ b/allianceauth/services/modules/market/urls.py @@ -4,12 +4,12 @@ from . import views module_urls = [ # Alliance Market Control - url(r'^activate/$', views.activate_market, name='auth_activate_market'), - url(r'^deactivate/$', views.deactivate_market, name='auth_deactivate_market'), - url(r'^reset_password/$', views.reset_market_password, name='auth_reset_market_password'), - url(r'^set_password/$', views.set_market_password, name='auth_set_market_password'), + url(r'^activate/$', views.activate_market, name='activate'), + url(r'^deactivate/$', views.deactivate_market, name='deactivate'), + url(r'^reset_password/$', views.reset_market_password, name='reset_password'), + url(r'^set_password/$', views.set_market_password, name='set_password'), ] urlpatterns = [ - url(r'^evernus-market/', include(module_urls)) + url(r'^evernus-market/', include(module_urls, namespace='evernusmarket')) ] diff --git a/allianceauth/services/modules/market/views.py b/allianceauth/services/modules/market/views.py index 1b93ce41..e15c5890 100644 --- a/allianceauth/services/modules/market/views.py +++ b/allianceauth/services/modules/market/views.py @@ -33,11 +33,11 @@ def activate_market(request): 'username': result[0], 'password': result[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Alliance Market'}) logger.error("Unsuccessful attempt to activate market for user %s" % request.user) messages.error(request, 'An error occurred while processing your Alliance Market account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -51,7 +51,7 @@ def deactivate_market(request): else: logger.error("Unsuccessful attempt to activate market for user %s" % request.user) messages.error(request, 'An error occurred while processing your Alliance Market account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -68,12 +68,12 @@ def reset_market_password(request): 'username': request.user.market.username, 'password': result, } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Alliance Market'}) logger.error("Unsuccessful attempt to reset market password for user %s" % request.user) messages.error(request, 'An error occurred while processing your Alliance Market account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -94,11 +94,11 @@ def set_market_password(request): else: logger.error("Failed to install custom market password for user %s" % request.user) messages.error(request, 'An error occurred while processing your Alliance Market account.') - return redirect("auth_services") + return redirect("services:services") else: logger.debug("Request is not type POST - providing empty form.") form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'Market'} - return render(request, 'registered/service_password.html', context=context) + return render(request, 'services/service_password.html', context=context) diff --git a/allianceauth/services/modules/mumble/auth_hooks.py b/allianceauth/services/modules/mumble/auth_hooks.py index 0af2cf13..94301aaf 100644 --- a/allianceauth/services/modules/mumble/auth_hooks.py +++ b/allianceauth/services/modules/mumble/auth_hooks.py @@ -20,7 +20,7 @@ class MumbleService(ServicesHook): self.urlpatterns = urlpatterns self.service_url = settings.MUMBLE_URL self.access_perm = 'mumble.access_mumble' - self.service_ctrl_template = 'registered/mumble_service_ctrl.html' + self.service_ctrl_template = 'services/mumble/mumble_service_ctrl.html' def delete_user(self, user, notify_user=False): logging.debug("Deleting user %s %s account" % (user, self.name)) @@ -48,10 +48,10 @@ class MumbleService(ServicesHook): def render_services_ctrl(self, request): urls = self.Urls() - urls.auth_activate = 'auth_activate_mumble' - urls.auth_deactivate = 'auth_deactivate_mumble' - urls.auth_reset_password = 'auth_reset_mumble_password' - urls.auth_set_password = 'auth_set_mumble_password' + urls.auth_activate = 'mumble:activate' + urls.auth_deactivate = 'mumble:deactivate' + urls.auth_reset_password = 'mumble:reset_password' + urls.auth_set_password = 'mumble:set_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, diff --git a/allianceauth/services/modules/mumble/templates/registered/mumble_service_ctrl.html b/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html similarity index 100% rename from allianceauth/services/modules/mumble/templates/registered/mumble_service_ctrl.html rename to allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html diff --git a/allianceauth/services/modules/mumble/tests.py b/allianceauth/services/modules/mumble/tests.py index 99526421..4cd16cc0 100644 --- a/allianceauth/services/modules/mumble/tests.py +++ b/allianceauth/services/modules/mumble/tests.py @@ -99,21 +99,21 @@ class MumbleHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_deactivate_mumble'), response) - self.assertIn(urls.reverse('auth_reset_mumble_password'), response) - self.assertIn(urls.reverse('auth_set_mumble_password'), response) + self.assertIn(urls.reverse('mumble:deactivate'), response) + self.assertIn(urls.reverse('mumble:reset_password'), response) + self.assertIn(urls.reverse('mumble:set_password'), response) # Test register becomes available member.mumble.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_mumble'), response) + self.assertIn(urls.reverse('mumble:activate'), response) class MumbleViewsTestCase(TestCase): @@ -132,7 +132,7 @@ class MumbleViewsTestCase(TestCase): def test_activate(self): self.login() expected_username = '[TESTR]auth_member' - response = self.client.get(urls.reverse('auth_activate_mumble'), follow=False) + response = self.client.get(urls.reverse('mumble:activate'), follow=False) self.assertEqual(response.status_code, 200) self.assertContains(response, expected_username) mumble_user = MumbleUser.objects.get(user=self.member) @@ -144,9 +144,9 @@ class MumbleViewsTestCase(TestCase): self.login() MumbleUser.objects.create(user=self.member, username='some member') - response = self.client.get(urls.reverse('auth_deactivate_mumble')) + response = self.client.get(urls.reverse('mumble:deactivate')) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): mumble_user = User.objects.get(pk=self.member.pk).mumble @@ -154,19 +154,19 @@ class MumbleViewsTestCase(TestCase): self.login() MumbleUser.objects.create(user=self.member, username='some member', pwhash='old') - response = self.client.post(urls.reverse('auth_set_mumble_password'), data={'password': '1234asdf'}) + response = self.client.post(urls.reverse('mumble:set_password'), data={'password': '1234asdf'}) self.assertNotEqual(MumbleUser.objects.get(user=self.member).pwhash, 'old') - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) def test_reset_password(self): self.login() MumbleUser.objects.create(user=self.member, username='some member', pwhash='old') - response = self.client.get(urls.reverse('auth_reset_mumble_password')) + response = self.client.get(urls.reverse('mumble:reset_password')) self.assertNotEqual(MumbleUser.objects.get(user=self.member).pwhash, 'old') - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, 'some member') diff --git a/allianceauth/services/modules/mumble/urls.py b/allianceauth/services/modules/mumble/urls.py index 06933069..b60034a9 100644 --- a/allianceauth/services/modules/mumble/urls.py +++ b/allianceauth/services/modules/mumble/urls.py @@ -4,13 +4,13 @@ from . import views module_urls = [ # Mumble service control - url(r'^activate/$', views.activate_mumble, name='auth_activate_mumble'), - url(r'^deactivate/$', views.deactivate_mumble, name='auth_deactivate_mumble'), + url(r'^activate/$', views.activate_mumble, name='activate'), + url(r'^deactivate/$', views.deactivate_mumble, name='deactivate'), url(r'^reset_password/$', views.reset_mumble_password, - name='auth_reset_mumble_password'), - url(r'^set_password/$', views.set_mumble_password, name='auth_set_mumble_password'), + name='reset_password'), + url(r'^set_password/$', views.set_mumble_password, name='set_password'), ] urlpatterns = [ - url(r'^mumble/', include(module_urls)) + url(r'^mumble/', include(module_urls, namespace='mumble')) ] diff --git a/allianceauth/services/modules/mumble/views.py b/allianceauth/services/modules/mumble/views.py index 47c1aa11..6df48c5a 100644 --- a/allianceauth/services/modules/mumble/views.py +++ b/allianceauth/services/modules/mumble/views.py @@ -32,12 +32,12 @@ def activate_mumble(request): 'username': result[0], 'password': result[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Mumble'}) else: logger.error("Unsuccessful attempt to activate mumble for user %s" % request.user) messages.error(request, 'An error occurred while processing your Mumble account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -51,7 +51,7 @@ def deactivate_mumble(request): else: logger.error("Unsuccessful attempt to deactivate mumble for user %s" % request.user) messages.error(request, 'An error occurred while processing your Mumble account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -68,12 +68,12 @@ def reset_mumble_password(request): 'username': request.user.mumble.username, 'password': result, } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Mumble'}) else: logger.error("Unsuccessful attempt to reset mumble password for user %s" % request.user) messages.error(request, 'An error occurred while processing your Mumble account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -94,11 +94,11 @@ def set_mumble_password(request): else: logger.error("Failed to install custom mumble password for user %s" % request.user) messages.error(request, 'An error occurred while processing your Mumble account.') - return redirect("auth_services") + return redirect("services:services") else: logger.debug("Request is not type POST - providing empty form.") form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'Mumble'} - return render(request, 'registered/service_password.html', context=context) + return render(request, 'services/service_password.html', context=context) diff --git a/allianceauth/services/modules/openfire/auth_hooks.py b/allianceauth/services/modules/openfire/auth_hooks.py index 049dcd72..202d19fc 100644 --- a/allianceauth/services/modules/openfire/auth_hooks.py +++ b/allianceauth/services/modules/openfire/auth_hooks.py @@ -53,10 +53,10 @@ class OpenfireService(ServicesHook): :return: """ urls = self.Urls() - urls.auth_activate = 'auth_activate_openfire' - urls.auth_deactivate = 'auth_deactivate_openfire' - urls.auth_set_password = 'auth_set_openfire_password' - urls.auth_reset_password = 'auth_reset_openfire_password' + urls.auth_activate = 'openfire:activate' + urls.auth_deactivate = 'openfire:deactivate' + urls.auth_set_password = 'openfire:set_password' + urls.auth_reset_password = 'openfire:reset_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, 'urls': urls, @@ -75,7 +75,7 @@ class JabberBroadcast(MenuItemHook): MenuItemHook.__init__(self, 'Jabber Broadcast', 'fa fa-lock fa-fw fa-bullhorn grayiconecolor', - 'auth_jabber_broadcast_view') + 'openfire:broadcast') def render(self, request): if request.user.has_perm('auth.jabber_broadcast') or request.user.has_perm('auth.jabber_broadcast_all'): @@ -88,7 +88,7 @@ class FleetBroadcastFormatter(MenuItemHook): MenuItemHook.__init__(self, 'Fleet Broadcast Formatter', 'fa fa-lock fa-fw fa-space-shuttle grayiconecolor', - 'auth_fleet_format_tool_view') + 'services:fleet_format_tool') def render(self, request): if request.user.has_perm('auth.jabber_broadcast') or request.user.has_perm('auth.jabber_broadcast_all'): diff --git a/allianceauth/templates/registered/jabberbroadcast.html b/allianceauth/services/modules/openfire/templates/services/openfire/broadcast.html similarity index 96% rename from allianceauth/templates/registered/jabberbroadcast.html rename to allianceauth/services/modules/openfire/templates/services/openfire/broadcast.html index 60535dcd..81ad6a63 100755 --- a/allianceauth/templates/registered/jabberbroadcast.html +++ b/allianceauth/services/modules/openfire/templates/services/openfire/broadcast.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/services/modules/openfire/tests.py b/allianceauth/services/modules/openfire/tests.py index 05ae865f..503c948c 100644 --- a/allianceauth/services/modules/openfire/tests.py +++ b/allianceauth/services/modules/openfire/tests.py @@ -103,21 +103,21 @@ class OpenfireHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_deactivate_openfire'), response) - self.assertIn(urls.reverse('auth_reset_openfire_password'), response) - self.assertIn(urls.reverse('auth_set_openfire_password'), response) + self.assertIn(urls.reverse('openfire:deactivate'), response) + self.assertIn(urls.reverse('openfire:reset_password'), response) + self.assertIn(urls.reverse('openfire:set_password'), response) # Test register becomes available member.openfire.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_openfire'), response) + self.assertIn(urls.reverse('openfire:activate'), response) class OpenfireViewsTestCase(TestCase): @@ -139,12 +139,12 @@ class OpenfireViewsTestCase(TestCase): expected_username = 'auth_member' manager.add_user.return_value = (expected_username, 'abc123') - response = self.client.get(urls.reverse('auth_activate_openfire')) + response = self.client.get(urls.reverse('openfire:activate')) self.assertTrue(manager.add_user.called) self.assertTrue(tasks_manager.update_user_groups.called) self.assertEqual(response.status_code, 200) - self.assertTemplateUsed('registered/service_credentials.html') + self.assertTemplateUsed('services/service_credentials.html') self.assertContains(response, expected_username) openfire_user = OpenfireUser.objects.get(user=self.member) self.assertEqual(openfire_user.username, expected_username) @@ -154,10 +154,10 @@ class OpenfireViewsTestCase(TestCase): self.login() OpenfireUser.objects.create(user=self.member, username='some member') - response = self.client.get(urls.reverse('auth_deactivate_openfire')) + response = self.client.get(urls.reverse('openfire:deactivate')) self.assertTrue(manager.delete_user.called) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): openfire_user = User.objects.get(pk=self.member.pk).openfire @@ -166,12 +166,12 @@ class OpenfireViewsTestCase(TestCase): self.login() OpenfireUser.objects.create(user=self.member, username='some member') - response = self.client.post(urls.reverse('auth_set_openfire_password'), data={'password': '1234asdf'}) + response = self.client.post(urls.reverse('openfire:set_password'), data={'password': '1234asdf'}) self.assertTrue(manager.update_user_pass.called) args, kwargs = manager.update_user_pass.call_args self.assertEqual(kwargs['password'], '1234asdf') - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) @mock.patch(MODULE_PATH + '.views.OpenfireManager') def test_reset_password(self, manager): @@ -180,9 +180,9 @@ class OpenfireViewsTestCase(TestCase): manager.update_user_pass.return_value = 'hunter2' - response = self.client.get(urls.reverse('auth_reset_openfire_password')) + response = self.client.get(urls.reverse('openfire:reset_password')) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, 'some member') self.assertContains(response, 'hunter2') diff --git a/allianceauth/services/modules/openfire/urls.py b/allianceauth/services/modules/openfire/urls.py index 86212275..4e80a4a9 100644 --- a/allianceauth/services/modules/openfire/urls.py +++ b/allianceauth/services/modules/openfire/urls.py @@ -1,27 +1,16 @@ from django.conf.urls import url, include -from django.conf.urls.i18n import i18n_patterns -from django.utils.translation import ugettext_lazy as _ from . import views module_urls = [ # Jabber Service Control - url(r'^activate/$', views.activate_jabber, name='auth_activate_openfire'), - url(r'^deactivate/$', views.deactivate_jabber, name='auth_deactivate_openfire'), - url(r'^reset_password/$', views.reset_jabber_password, name='auth_reset_openfire_password'), -] - -module_i18n_urls = [ - url(_(r'^set_password/$'), views.set_jabber_password, name='auth_set_openfire_password'), + url(r'^activate/$', views.activate_jabber, name='activate'), + url(r'^deactivate/$', views.deactivate_jabber, name='deactivate'), + url(r'^reset_password/$', views.reset_jabber_password, name='reset_password'), + url(r'^set_password/$', views.set_jabber_password, name='set_password'), + url(r'^broadcast/$', views.jabber_broadcast_view, name='broadcast'), ] urlpatterns = [ - url(r'^openfire/', include(module_urls)) + url(r'^openfire/', include(module_urls, namespace='openfire')), ] - -urlpatterns += i18n_patterns( - # Jabber Broadcast - url(_(r'^services/jabber_broadcast/$'), views.jabber_broadcast_view, name='auth_jabber_broadcast_view'), - # Jabber - url(r'openfire/', include(module_i18n_urls)) -) diff --git a/allianceauth/services/modules/openfire/views.py b/allianceauth/services/modules/openfire/views.py index 58034cf3..e3598718 100644 --- a/allianceauth/services/modules/openfire/views.py +++ b/allianceauth/services/modules/openfire/views.py @@ -35,12 +35,12 @@ def activate_jabber(request): 'username': info[0], 'password': info[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Jabber'}) else: logger.error("Unsuccessful attempt to activate jabber for user %s" % request.user) messages.error(request, 'An error occurred while processing your jabber account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -53,7 +53,7 @@ def deactivate_jabber(request): else: logger.error("Unsuccessful attempt to deactivate jabber for user %s" % request.user) messages.error(request, 'An error occurred while processing your jabber account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -70,11 +70,11 @@ def reset_jabber_password(request): 'username': request.user.openfire.username, 'password': result, } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Jabber'}) logger.error("Unsuccessful attempt to reset jabber for user %s" % request.user) messages.error(request, 'An error occurred while processing your jabber account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -126,7 +126,7 @@ def jabber_broadcast_view(request): request.user, len(form.fields['group'].choices))) context = {'form': form} - return render(request, 'registered/jabberbroadcast.html', context=context) + return render(request, 'services/openfire/broadcast.html', context=context) @login_required @@ -147,11 +147,11 @@ def set_jabber_password(request): else: logger.error("Failed to install custom jabber password for user %s" % request.user) messages.error(request, 'An error occurred while processing your jabber account.') - return redirect("auth_services") + return redirect("services:services") else: logger.debug("Request is not type POST - providing empty form.") form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'Jabber'} - return render(request, 'registered/service_password.html', context=context) + return render(request, 'services/service_password.html', context=context) diff --git a/allianceauth/services/modules/phpbb3/auth_hooks.py b/allianceauth/services/modules/phpbb3/auth_hooks.py index 117c0d1f..8f04de98 100644 --- a/allianceauth/services/modules/phpbb3/auth_hooks.py +++ b/allianceauth/services/modules/phpbb3/auth_hooks.py @@ -46,10 +46,10 @@ class Phpbb3Service(ServicesHook): def render_services_ctrl(self, request): urls = self.Urls() - urls.auth_activate = 'auth_activate_phpbb3' - urls.auth_deactivate = 'auth_deactivate_phpbb3' - urls.auth_reset_password = 'auth_reset_phpbb3_password' - urls.auth_set_password = 'auth_set_phpbb3_password' + urls.auth_activate = 'phpbb3:activate' + urls.auth_deactivate = 'phpbb3:deactivate' + urls.auth_reset_password = 'phpbb3:reset_password' + urls.auth_set_password = 'phpbb3:set_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, 'urls': urls, diff --git a/allianceauth/services/modules/phpbb3/tests.py b/allianceauth/services/modules/phpbb3/tests.py index f7d86976..42feb087 100644 --- a/allianceauth/services/modules/phpbb3/tests.py +++ b/allianceauth/services/modules/phpbb3/tests.py @@ -103,21 +103,21 @@ class Phpbb3HooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_deactivate_phpbb3'), response) - self.assertIn(urls.reverse('auth_reset_phpbb3_password'), response) - self.assertIn(urls.reverse('auth_set_phpbb3_password'), response) + self.assertIn(urls.reverse('phpbb3:deactivate'), response) + self.assertIn(urls.reverse('phpbb3:reset_password'), response) + self.assertIn(urls.reverse('phpbb3:set_password'), response) # Test register becomes available member.phpbb3.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_phpbb3'), response) + self.assertIn(urls.reverse('phpbb3:activate'), response) class Phpbb3ViewsTestCase(TestCase): @@ -139,12 +139,12 @@ class Phpbb3ViewsTestCase(TestCase): expected_username = 'auth_member' manager.add_user.return_value = (expected_username, 'abc123') - response = self.client.get(urls.reverse('auth_activate_phpbb3')) + response = self.client.get(urls.reverse('phpbb3:activate')) self.assertTrue(manager.add_user.called) self.assertTrue(tasks_manager.update_groups.called) self.assertEqual(response.status_code, 200) - self.assertTemplateUsed('registered/service_credentials.html') + self.assertTemplateUsed('services/service_credentials.html') self.assertContains(response, expected_username) phpbb3_user = Phpbb3User.objects.get(user=self.member) self.assertEqual(phpbb3_user.username, expected_username) @@ -154,10 +154,10 @@ class Phpbb3ViewsTestCase(TestCase): self.login() Phpbb3User.objects.create(user=self.member, username='some member') - response = self.client.get(urls.reverse('auth_deactivate_phpbb3')) + response = self.client.get(urls.reverse('phpbb3:deactivate')) self.assertTrue(manager.disable_user.called) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): phpbb3_user = User.objects.get(pk=self.member.pk).phpbb3 @@ -166,12 +166,12 @@ class Phpbb3ViewsTestCase(TestCase): self.login() Phpbb3User.objects.create(user=self.member, username='some member') - response = self.client.post(urls.reverse('auth_set_phpbb3_password'), data={'password': '1234asdf'}) + response = self.client.post(urls.reverse('phpbb3:set_password'), data={'password': '1234asdf'}) self.assertTrue(manager.update_user_password.called) args, kwargs = manager.update_user_password.call_args self.assertEqual(kwargs['password'], '1234asdf') - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) @mock.patch(MODULE_PATH + '.views.Phpbb3Manager') def test_reset_password(self, manager): @@ -180,9 +180,9 @@ class Phpbb3ViewsTestCase(TestCase): manager.update_user_password.return_value = 'hunter2' - response = self.client.get(urls.reverse('auth_reset_phpbb3_password')) + response = self.client.get(urls.reverse('phpbb3:reset_password')) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, 'some member') self.assertContains(response, 'hunter2') diff --git a/allianceauth/services/modules/phpbb3/urls.py b/allianceauth/services/modules/phpbb3/urls.py index 431dde5d..fd1840a5 100644 --- a/allianceauth/services/modules/phpbb3/urls.py +++ b/allianceauth/services/modules/phpbb3/urls.py @@ -4,12 +4,12 @@ from . import views module_urls = [ # Forum Service Control - url(r'^activate/$', views.activate_forum, name='auth_activate_phpbb3'), - url(r'^deactivate/$', views.deactivate_forum, name='auth_deactivate_phpbb3'), - url(r'^reset_password/$', views.reset_forum_password, name='auth_reset_phpbb3_password'), - url(r'^set_password/$', views.set_forum_password, name='auth_set_phpbb3_password'), + url(r'^activate/$', views.activate_forum, name='activate'), + url(r'^deactivate/$', views.deactivate_forum, name='deactivate'), + url(r'^reset_password/$', views.reset_forum_password, name='reset_password'), + url(r'^set_password/$', views.set_forum_password, name='set_password'), ] urlpatterns = [ - url(r'^phpbb3/', include(module_urls)) + url(r'^phpbb3/', include(module_urls, namespace='phpbb3')) ] diff --git a/allianceauth/services/modules/phpbb3/views.py b/allianceauth/services/modules/phpbb3/views.py index 4aa0fca7..e8dcf16d 100644 --- a/allianceauth/services/modules/phpbb3/views.py +++ b/allianceauth/services/modules/phpbb3/views.py @@ -34,12 +34,12 @@ def activate_forum(request): 'username': result[0], 'password': result[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Forum'}) else: logger.error("Unsuccessful attempt to activate forum for user %s" % request.user) messages.error(request, 'An error occurred while processing your forum account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -53,7 +53,7 @@ def deactivate_forum(request): else: logger.error("Unsuccessful attempt to activate forum for user %s" % request.user) messages.error(request, 'An error occurred while processing your forum account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -71,12 +71,12 @@ def reset_forum_password(request): 'username': request.user.phpbb3.username, 'password': result, } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'Forum'}) logger.error("Unsuccessful attempt to reset forum password for user %s" % request.user) messages.error(request, 'An error occurred while processing your forum account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -99,11 +99,11 @@ def set_forum_password(request): else: logger.error("Failed to install custom forum password for user %s" % request.user) messages.error(request, 'An error occurred while processing your forum account.') - return redirect("auth_services") + return redirect("services:services") else: logger.debug("Request is not type POST - providing empty form.") form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'Forum'} - return render(request, 'registered/service_password.html', context=context) + return render(request, 'services/service_password.html', context=context) diff --git a/allianceauth/services/modules/seat/auth_hooks.py b/allianceauth/services/modules/seat/auth_hooks.py index d080bbaa..6b51089b 100644 --- a/allianceauth/services/modules/seat/auth_hooks.py +++ b/allianceauth/services/modules/seat/auth_hooks.py @@ -46,10 +46,10 @@ class SeatService(ServicesHook): def render_services_ctrl(self, request): urls = self.Urls() - urls.auth_activate = 'auth_activate_seat' - urls.auth_deactivate = 'auth_deactivate_seat' - urls.auth_reset_password = 'auth_reset_seat_password' - urls.auth_set_password = 'auth_set_seat_password' + urls.auth_activate = 'seat:activate' + urls.auth_deactivate = 'seat:deactivate' + urls.auth_reset_password = 'seat:reset_password' + urls.auth_set_password = 'seat:set_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, 'urls': urls, diff --git a/allianceauth/services/modules/seat/tests.py b/allianceauth/services/modules/seat/tests.py index 60727bc5..54a2db0b 100644 --- a/allianceauth/services/modules/seat/tests.py +++ b/allianceauth/services/modules/seat/tests.py @@ -107,21 +107,21 @@ class SeatHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_deactivate_seat'), response) - self.assertIn(urls.reverse('auth_reset_seat_password'), response) - self.assertIn(urls.reverse('auth_set_seat_password'), response) + self.assertIn(urls.reverse('seat:deactivate'), response) + self.assertIn(urls.reverse('seat:reset_password'), response) + self.assertIn(urls.reverse('seat:set_password'), response) # Test register becomes available member.seat.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_seat'), response) + self.assertIn(urls.reverse('seat:activate'), response) class SeatViewsTestCase(TestCase): @@ -144,12 +144,12 @@ class SeatViewsTestCase(TestCase): manager.check_user_status.return_value = {} manager.add_user.return_value = (expected_username, 'abc123') - response = self.client.get(urls.reverse('auth_activate_seat')) + response = self.client.get(urls.reverse('seat:activate')) self.assertTrue(manager.add_user.called) self.assertTrue(tasks_manager.update_roles.called) self.assertEqual(response.status_code, 200) - self.assertTemplateUsed('registered/service_credentials.html') + self.assertTemplateUsed('services/service_credentials.html') self.assertContains(response, expected_username) seat_user = SeatUser.objects.get(user=self.member) self.assertEqual(seat_user.username, expected_username) @@ -160,10 +160,10 @@ class SeatViewsTestCase(TestCase): self.login() SeatUser.objects.create(user=self.member, username='some member') - response = self.client.get(urls.reverse('auth_deactivate_seat')) + response = self.client.get(urls.reverse('seat:deactivate')) self.assertTrue(manager.delete_user.called) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): seat_user = User.objects.get(pk=self.member.pk).seat @@ -172,12 +172,12 @@ class SeatViewsTestCase(TestCase): self.login() SeatUser.objects.create(user=self.member, username='some member') - response = self.client.post(urls.reverse('auth_set_seat_password'), data={'password': '1234asdf'}) + response = self.client.post(urls.reverse('seat:set_password'), data={'password': '1234asdf'}) self.assertTrue(manager.update_user_password.called) args, kwargs = manager.update_user_password.call_args self.assertEqual(kwargs['plain_password'], '1234asdf') - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) @mock.patch(MODULE_PATH + '.views.SeatManager') def test_reset_password(self, manager): @@ -186,9 +186,9 @@ class SeatViewsTestCase(TestCase): manager.update_user_password.return_value = 'hunter2' - response = self.client.get(urls.reverse('auth_reset_seat_password')) + response = self.client.get(urls.reverse('seat:reset_password')) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, 'some member') self.assertContains(response, 'hunter2') diff --git a/allianceauth/services/modules/seat/urls.py b/allianceauth/services/modules/seat/urls.py index 768c22fd..418f6c6f 100644 --- a/allianceauth/services/modules/seat/urls.py +++ b/allianceauth/services/modules/seat/urls.py @@ -4,12 +4,12 @@ from . import views module_urls = [ # SeAT Service Control - url(r'^activate/$', views.activate_seat, name='auth_activate_seat'), - url(r'^deactivate/$', views.deactivate_seat, name='auth_deactivate_seat'), - url(r'^reset_password/$', views.reset_seat_password, name='auth_reset_seat_password'), - url(r'^set_password/$', views.set_seat_password, name='auth_set_seat_password'), + url(r'^activate/$', views.activate_seat, name='activate'), + url(r'^deactivate/$', views.deactivate_seat, name='deactivate'), + url(r'^reset_password/$', views.reset_seat_password, name='reset_password'), + url(r'^set_password/$', views.set_seat_password, name='set_password'), ] urlpatterns = [ - url(r'^seat/', include(module_urls)), + url(r'^seat/', include(module_urls, namespace='seat')), ] diff --git a/allianceauth/services/modules/seat/views.py b/allianceauth/services/modules/seat/views.py index 0dde8d7b..157cc335 100644 --- a/allianceauth/services/modules/seat/views.py +++ b/allianceauth/services/modules/seat/views.py @@ -44,13 +44,13 @@ def activate_seat(request): 'username': request.user.seat.username, 'password': result[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'SeAT'}) messages.add_message(request, messages.ERROR, _('Failed to activate your %(service)s account, please contact your administrator.') % SERVICE_NAME) logger.error("Unsuccessful attempt to activate seat for user %s" % request.user) - return redirect("auth_services") + return redirect("services:services") @login_required @@ -62,14 +62,14 @@ def deactivate_seat(request): messages.add_message(request, messages.SUCCESS, _('Successfully deactivated your %(service)s account.') % SERVICE_NAME) logger.info("Successfully deactivated SeAT for user %s" % request.user) - return redirect("auth_services") + return redirect("services:services") else: logging.error("User does not have a SeAT account") messages.add_message(request, messages.ERROR, _('Failed to deactivate your %(service)s account, please contact your administrator.') % SERVICE_NAME) logger.error("Unsuccessful attempt to activate SeAT for user %s" % request.user) - return redirect("auth_services") + return redirect("services:services") @login_required @@ -87,13 +87,13 @@ def reset_seat_password(request): messages.add_message(request, messages.SUCCESS, _('Successfully reset your %(service)s password.') % {'service': 'SeAT'}) logger.info("Succesfully reset SeAT password for user %s" % request.user) - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'SeAT'}) logger.error("Unsuccessful attempt to reset SeAT password for user %s" % request.user) messages.add_message(request, messages.ERROR, _('Failed to reset your %(service)s password, please contact your administrator.') % {'service': 'SeAT'}) - return redirect("auth_services") + return redirect("services:services") @login_required @@ -114,7 +114,7 @@ def set_seat_password(request): messages.add_message(request, messages.SUCCESS, _('Successfully set your %(service)s password.') % SERVICE_NAME) logger.info("Succesfully reset SeAT password for user %s" % request.user) - return redirect("auth_services") + return redirect("services:services") else: messages.add_message(request, messages.ERROR, _('Failed to set your %(service)s password, please contact your administrator.') % @@ -128,4 +128,4 @@ def set_seat_password(request): form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'SeAT'} - return render(request, 'registered/service_password.html', context) + return render(request, 'services/service_password.html', context) diff --git a/allianceauth/services/modules/smf/auth_hooks.py b/allianceauth/services/modules/smf/auth_hooks.py index 48da4444..d6ccf5d5 100644 --- a/allianceauth/services/modules/smf/auth_hooks.py +++ b/allianceauth/services/modules/smf/auth_hooks.py @@ -46,10 +46,10 @@ class SmfService(ServicesHook): def render_services_ctrl(self, request): urls = self.Urls() - urls.auth_activate = 'auth_activate_smf' - urls.auth_deactivate = 'auth_deactivate_smf' - urls.auth_reset_password = 'auth_reset_smf_password' - urls.auth_set_password = 'auth_set_smf_password' + urls.auth_activate = 'smf:activate' + urls.auth_deactivate = 'smf:deactivate' + urls.auth_reset_password = 'smf:reset_password' + urls.auth_set_password = 'smf:set_password' return render_to_string(self.service_ctrl_template, { 'service_name': self.title, 'urls': urls, diff --git a/allianceauth/services/modules/smf/tests.py b/allianceauth/services/modules/smf/tests.py index 78b77009..c185c407 100644 --- a/allianceauth/services/modules/smf/tests.py +++ b/allianceauth/services/modules/smf/tests.py @@ -103,21 +103,21 @@ class SmfHooksTestCase(TestCase): def test_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) - request = RequestFactory().get('/en/services/') + request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_template) - self.assertIn(urls.reverse('auth_deactivate_smf'), response) - self.assertIn(urls.reverse('auth_reset_smf_password'), response) - self.assertIn(urls.reverse('auth_set_smf_password'), response) + self.assertIn(urls.reverse('smf:deactivate'), response) + self.assertIn(urls.reverse('smf:reset_password'), response) + self.assertIn(urls.reverse('smf:set_password'), response) # Test register becomes available member.smf.delete() member = User.objects.get(username=self.member) request.user = member response = service.render_services_ctrl(request) - self.assertIn(urls.reverse('auth_activate_smf'), response) + self.assertIn(urls.reverse('smf:activate'), response) class SmfViewsTestCase(TestCase): @@ -139,12 +139,12 @@ class SmfViewsTestCase(TestCase): expected_username = 'auth_member' manager.add_user.return_value = (expected_username, 'abc123') - response = self.client.get(urls.reverse('auth_activate_smf')) + response = self.client.get(urls.reverse('smf:activate')) self.assertTrue(manager.add_user.called) self.assertTrue(tasks_manager.update_groups.called) self.assertEqual(response.status_code, 200) - self.assertTemplateUsed('registered/service_credentials.html') + self.assertTemplateUsed('services/service_credentials.html') self.assertContains(response, expected_username) smf_user = SmfUser.objects.get(user=self.member) self.assertEqual(smf_user.username, expected_username) @@ -154,10 +154,10 @@ class SmfViewsTestCase(TestCase): self.login() SmfUser.objects.create(user=self.member, username='some member') - response = self.client.get(urls.reverse('auth_deactivate_smf')) + response = self.client.get(urls.reverse('smf:deactivate')) self.assertTrue(manager.disable_user.called) - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(ObjectDoesNotExist): smf_user = User.objects.get(pk=self.member.pk).smf @@ -166,12 +166,12 @@ class SmfViewsTestCase(TestCase): self.login() SmfUser.objects.create(user=self.member, username='some member') - response = self.client.post(urls.reverse('auth_set_smf_password'), data={'password': '1234asdf'}) + response = self.client.post(urls.reverse('smf:set_password'), data={'password': '1234asdf'}) self.assertTrue(manager.update_user_password.called) args, kwargs = manager.update_user_password.call_args self.assertEqual(kwargs['password'], '1234asdf') - self.assertRedirects(response, expected_url=urls.reverse('auth_services'), target_status_code=200) + self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) @mock.patch(MODULE_PATH + '.views.SmfManager') def test_reset_password(self, manager): @@ -180,9 +180,9 @@ class SmfViewsTestCase(TestCase): manager.update_user_password.return_value = 'hunter2' - response = self.client.get(urls.reverse('auth_reset_smf_password')) + response = self.client.get(urls.reverse('smf:reset_password')) - self.assertTemplateUsed(response, 'registered/service_credentials.html') + self.assertTemplateUsed(response, 'services/service_credentials.html') self.assertContains(response, 'some member') self.assertContains(response, 'hunter2') diff --git a/allianceauth/services/modules/smf/urls.py b/allianceauth/services/modules/smf/urls.py index 41a0500d..475ee98d 100644 --- a/allianceauth/services/modules/smf/urls.py +++ b/allianceauth/services/modules/smf/urls.py @@ -4,12 +4,12 @@ from . import views module_urls = [ # SMF Service Control - url(r'^activate/$', views.activate_smf, name='auth_activate_smf'), - url(r'^deactivate/$', views.deactivate_smf, name='auth_deactivate_smf'), - url(r'^reset_password/$', views.reset_smf_password, name='auth_reset_smf_password'), - url(r'^set_password/$', views.set_smf_password, name='auth_set_smf_password'), + url(r'^activate/$', views.activate_smf, name='activate'), + url(r'^deactivate/$', views.deactivate_smf, name='deactivate'), + url(r'^reset_password/$', views.reset_smf_password, name='reset_password'), + url(r'^set_password/$', views.set_smf_password, name='set_password'), ] urlpatterns = [ - url(r'^smf/', include(module_urls)), + url(r'^smf/', include(module_urls, namespace='smf')), ] diff --git a/allianceauth/services/modules/smf/views.py b/allianceauth/services/modules/smf/views.py index 22335d8a..8fc1e112 100644 --- a/allianceauth/services/modules/smf/views.py +++ b/allianceauth/services/modules/smf/views.py @@ -33,12 +33,12 @@ def activate_smf(request): 'username': result[0], 'password': result[1], } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'SMF'}) else: logger.error("Unsuccessful attempt to activate smf for user %s" % request.user) messages.error(request, 'An error occurred while processing your SMF account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -53,7 +53,7 @@ def deactivate_smf(request): else: logger.error("Unsuccessful attempt to activate smf for user %s" % request.user) messages.error(request, 'An error occurred while processing your SMF account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -71,11 +71,11 @@ def reset_smf_password(request): 'username': request.user.smf.username, 'password': result, } - return render(request, 'registered/service_credentials.html', + return render(request, 'services/service_credentials.html', context={'credentials': credentials, 'service': 'SMF'}) logger.error("Unsuccessful attempt to reset smf password for user %s" % request.user) messages.error(request, 'An error occurred while processing your SMF account.') - return redirect("auth_services") + return redirect("services:services") @login_required @@ -98,11 +98,11 @@ def set_smf_password(request): else: logger.error("Failed to install custom smf password for user %s" % request.user) messages.error(request, 'An error occurred while processing your SMF account.') - return redirect("auth_services") + return redirect("services:services") else: logger.debug("Request is not type POST - providing empty form.") form = ServicePasswordForm() logger.debug("Rendering form for user %s" % request.user) context = {'form': form, 'service': 'SMF'} - return render(request, 'registered/service_password.html', context=context) + return render(request, 'services/service_password.html', context=context) diff --git a/allianceauth/services/modules/teamspeak3/auth_hooks.py b/allianceauth/services/modules/teamspeak3/auth_hooks.py index 7d72c204..c5121468 100644 --- a/allianceauth/services/modules/teamspeak3/auth_hooks.py +++ b/allianceauth/services/modules/teamspeak3/auth_hooks.py @@ -15,7 +15,7 @@ class Teamspeak3Service(ServicesHook): ServicesHook.__init__(self) self.name = 'teamspeak3' self.urlpatterns = urlpatterns - self.service_ctrl_template = 'registered/teamspeak3_service_ctrl.html' + self.service_ctrl_template = 'services/teamspeak3/teamspeak3_service_ctrl.html' self.access_perm = 'teamspeak3.access_teamspeak3' def delete_user(self, user, notify_user=False): diff --git a/allianceauth/services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html similarity index 68% rename from allianceauth/services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html rename to allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html index 775d6bf7..a88f61d7 100644 --- a/allianceauth/services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html +++ b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html @@ -6,17 +6,17 @@ {{ TEAMSPEAK3_PUBLIC_URL }} {% ifequal authinfo.teamspeak3_uid "" %} - + {% else %} - + - + - + diff --git a/allianceauth/templates/registered/teamspeakjoin.html b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeakjoin.html similarity index 92% rename from allianceauth/templates/registered/teamspeakjoin.html rename to allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeakjoin.html index f740e2e6..c0530d63 100644 --- a/allianceauth/templates/registered/teamspeakjoin.html +++ b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeakjoin.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} @@ -15,7 +15,7 @@
{% trans "Join Server" %}
-
{% endfor %} - {% trans "Continue" %} + {% trans "Continue" %}
diff --git a/allianceauth/templates/registered/service_password.html b/allianceauth/services/templates/services/service_password.html similarity index 96% rename from allianceauth/templates/registered/service_password.html rename to allianceauth/services/templates/services/service_password.html index b4b465a3..1ff919d3 100644 --- a/allianceauth/templates/registered/service_password.html +++ b/allianceauth/services/templates/services/service_password.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/templates/registered/services.html b/allianceauth/services/templates/services/services.html similarity index 95% rename from allianceauth/templates/registered/services.html rename to allianceauth/services/templates/services/services.html index 7ee5ba36..a29ba52b 100755 --- a/allianceauth/templates/registered/services.html +++ b/allianceauth/services/templates/services/services.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/templates/registered/services_ctrl.html b/allianceauth/services/templates/services/services_ctrl.html similarity index 100% rename from allianceauth/templates/registered/services_ctrl.html rename to allianceauth/services/templates/services/services_ctrl.html diff --git a/allianceauth/services/urls.py b/allianceauth/services/urls.py new file mode 100644 index 00000000..1a341255 --- /dev/null +++ b/allianceauth/services/urls.py @@ -0,0 +1,18 @@ +from django.conf.urls import include, url +from allianceauth.hooks import get_hooks + +from . import views + +urlpatterns = [ + # Services + url(r'^services/', include([ + url(r'^$', views.services_view, name='services'), + # Tools + url(r'^tool/fleet_formatter_tool/$', views.fleet_formatter_view, name='fleet_format_tool'), + ], namespace='services')), +] + +# Append hooked service urls +services = get_hooks('services_hook') +for svc in services: + urlpatterns += svc().urlpatterns diff --git a/allianceauth/services/views.py b/allianceauth/services/views.py index 1e1a4525..b99604a3 100755 --- a/allianceauth/services/views.py +++ b/allianceauth/services/views.py @@ -36,7 +36,7 @@ def fleet_formatter_view(request): context = {'form': form, 'generated': generated} - return render(request, 'registered/fleetformattertool.html', context=context) + return render(request, 'services/fleetformattertool.html', context=context) @login_required @@ -50,7 +50,7 @@ def services_view(request): if svc.show_service_ctrl(request.user): context['service_ctrls'].append(svc.render_services_ctrl(request)) - return render(request, 'registered/services.html', context=context) + return render(request, 'services/services.html', context=context) def superuser_test(user): diff --git a/allianceauth/srp/templates/srp/add.html b/allianceauth/srp/templates/srp/add.html index b97e0364..898d09d6 100644 --- a/allianceauth/srp/templates/srp/add.html +++ b/allianceauth/srp/templates/srp/add.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/srp/templates/srp/data.html b/allianceauth/srp/templates/srp/data.html index 12106d07..3311806f 100644 --- a/allianceauth/srp/templates/srp/data.html +++ b/allianceauth/srp/templates/srp/data.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/srp/templates/srp/management.html b/allianceauth/srp/templates/srp/management.html index b65693a1..c3fd7089 100644 --- a/allianceauth/srp/templates/srp/management.html +++ b/allianceauth/srp/templates/srp/management.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/srp/templates/srp/request.html b/allianceauth/srp/templates/srp/request.html index 95a1192d..49e1382b 100644 --- a/allianceauth/srp/templates/srp/request.html +++ b/allianceauth/srp/templates/srp/request.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/srp/templates/srp/update.html b/allianceauth/srp/templates/srp/update.html index 7fa4bf1f..7b0e4347 100644 --- a/allianceauth/srp/templates/srp/update.html +++ b/allianceauth/srp/templates/srp/update.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/srp/urls.py b/allianceauth/srp/urls.py index 7aef37b4..e93525b0 100644 --- a/allianceauth/srp/urls.py +++ b/allianceauth/srp/urls.py @@ -29,4 +29,4 @@ urlpatterns = [ name='request_reject'), url(r'^request/(\w+)/update', views.srp_request_update_amount, name="request_update_amount"), - ] \ No newline at end of file +] diff --git a/allianceauth/authentication/templates/registered/base.html b/allianceauth/templates/allianceauth/base.html similarity index 92% rename from allianceauth/authentication/templates/registered/base.html rename to allianceauth/templates/allianceauth/base.html index 914e1af9..35411ff6 100644 --- a/allianceauth/authentication/templates/registered/base.html +++ b/allianceauth/templates/allianceauth/base.html @@ -52,7 +52,7 @@ {% if notifications %} {% else %} - {% endif %} @@ -88,15 +88,15 @@
  • - + {% trans " Groups" %}
  • {% if can_manage_groups %}
  • - + {% trans " Group Management" %}
  • diff --git a/allianceauth/templates/registered/help.html b/allianceauth/templates/allianceauth/help.html similarity index 93% rename from allianceauth/templates/registered/help.html rename to allianceauth/templates/allianceauth/help.html index 2f7b3cfb..32a07998 100644 --- a/allianceauth/templates/registered/help.html +++ b/allianceauth/templates/allianceauth/help.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% block title %}Alliance Auth{% endblock %} diff --git a/allianceauth/timerboard/templates/timerboard/add.html b/allianceauth/timerboard/templates/timerboard/add.html index 785b17a1..b0ce16ad 100644 --- a/allianceauth/timerboard/templates/timerboard/add.html +++ b/allianceauth/timerboard/templates/timerboard/add.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/timerboard/templates/timerboard/management.html b/allianceauth/timerboard/templates/timerboard/management.html index 4c19b230..a63cb810 100644 --- a/allianceauth/timerboard/templates/timerboard/management.html +++ b/allianceauth/timerboard/templates/timerboard/management.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load staticfiles %} {% load i18n %} {% get_current_language as LANGUAGE_CODE %} diff --git a/allianceauth/timerboard/templates/timerboard/update.html b/allianceauth/timerboard/templates/timerboard/update.html index dc0d922e..1b4482c2 100644 --- a/allianceauth/timerboard/templates/timerboard/update.html +++ b/allianceauth/timerboard/templates/timerboard/update.html @@ -1,4 +1,4 @@ -{% extends "registered/base.html" %} +{% extends "allianceauth/base.html" %} {% load bootstrap %} {% load staticfiles %} {% load i18n %} diff --git a/allianceauth/urls.py b/allianceauth/urls.py index f66f47a9..65046588 100755 --- a/allianceauth/urls.py +++ b/allianceauth/urls.py @@ -1,15 +1,14 @@ import esi.urls -import allianceauth.groupmanagement.views -import allianceauth.notifications.views -import allianceauth.services.views + from django.conf.urls import include, url -from django.conf.urls.i18n import i18n_patterns from django.contrib import admin -from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import TemplateView import allianceauth.authentication.views import allianceauth.authentication.urls +import allianceauth.notifications.urls +import allianceauth.groupmanagement.urls +import allianceauth.services.urls from allianceauth import NAME from allianceauth.authentication import hmac_urls @@ -36,56 +35,15 @@ urlpatterns = [ url(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'), # Notifications - url(r'^remove_notifications/(\w+)/$', allianceauth.notifications.views.remove_notification, name='auth_remove_notification'), - url(r'^notifications/mark_all_read/$', allianceauth.notifications.views.mark_all_read, name='auth_mark_all_notifications_read'), - url(r'^notifications/delete_all_read/$', allianceauth.notifications.views.delete_all_read, - name='auth_delete_all_read_notifications'), + url(r'', include(allianceauth.notifications.urls)), + + # Groups + url(r'', include(allianceauth.groupmanagement.urls)), + + # Services + url(r'', include(allianceauth.services.urls)), ] -# User viewed/translated URLS -urlpatterns += i18n_patterns( - # Group management - url(_(r'^groups/'), allianceauth.groupmanagement.views.groups_view, name='auth_groups'), - url(_(r'^group/management/'), allianceauth.groupmanagement.views.group_management, - name='auth_group_management'), - url(_(r'^group/membership/$'), allianceauth.groupmanagement.views.group_membership, - name='auth_group_membership'), - url(_(r'^group/membership/(\w+)/$'), allianceauth.groupmanagement.views.group_membership_list, - name='auth_group_membership_list'), - url(_(r'^group/membership/(\w+)/remove/(\w+)/$'), allianceauth.groupmanagement.views.group_membership_remove, - name='auth_group_membership_remove'), - url(_(r'^group/request_add/(\w+)'), allianceauth.groupmanagement.views.group_request_add, - name='auth_group_request_add'), - url(_(r'^group/request/accept/(\w+)'), allianceauth.groupmanagement.views.group_accept_request, - name='auth_group_accept_request'), - url(_(r'^group/request/reject/(\w+)'), allianceauth.groupmanagement.views.group_reject_request, - name='auth_group_reject_request'), - - url(_(r'^group/request_leave/(\w+)'), allianceauth.groupmanagement.views.group_request_leave, - name='auth_group_request_leave'), - url(_(r'group/leave_request/accept/(\w+)'), allianceauth.groupmanagement.views.group_leave_accept_request, - name='auth_group_leave_accept_request'), - url(_(r'^group/leave_request/reject/(\w+)'), allianceauth.groupmanagement.views.group_leave_reject_request, - name='auth_group_leave_reject_request'), - - url(_(r'^services/$'), allianceauth.services.views.services_view, name='auth_services'), - - # Tools - url(_(r'^tool/fleet_formatter_tool/$'), allianceauth.services.views.fleet_formatter_view, - name='auth_fleet_format_tool_view'), - - # Notifications - url(_(r'^notifications/$'), allianceauth.notifications.views.notification_list, name='auth_notification_list'), - url(_(r'^notifications/(\w+)/$'), allianceauth.notifications.views.notification_view, name='auth_notification_view'), - - -) - -# Append hooked service urls -services = get_hooks('services_hook') -for svc in services: - urlpatterns += svc().urlpatterns - # Append app urls app_urls = get_hooks('url_hook') for app in app_urls: