From 931af16f7e0a7be1d6c0d93832efdfe2b986cbdb Mon Sep 17 00:00:00 2001 From: fuzzylogic2000 Date: Wed, 28 Sep 2022 13:37:28 +0200 Subject: [PATCH] apps/votes/dashboard: make naming more descriptive --- meinberlin/apps/votes/dashboard.py | 44 +++++++++---------- ...board.html => token_export_dashboard.html} | 2 +- ...d.html => token_generation_dashboard.html} | 0 meinberlin/apps/votes/views.py | 14 +++--- 4 files changed, 30 insertions(+), 30 deletions(-) rename meinberlin/apps/votes/templates/meinberlin_votes/{voting_dashboard.html => token_export_dashboard.html} (94%) rename meinberlin/apps/votes/templates/meinberlin_votes/{voting_code_dashboard.html => token_generation_dashboard.html} (100%) diff --git a/meinberlin/apps/votes/dashboard.py b/meinberlin/apps/votes/dashboard.py index a86ed94b84..4af5b7989d 100644 --- a/meinberlin/apps/votes/dashboard.py +++ b/meinberlin/apps/votes/dashboard.py @@ -7,10 +7,11 @@ from . import views -class VotesComponent(DashboardComponent): - identifier = 'voting_token_export' - weight = 49 - label = _('Code download') +class GenerateTokenComponent(DashboardComponent): + identifier = 'voting_token_generation' + weight = 48 + label = _('Code generation') + for_superuser_only = True def is_effective(self, module): return module.blueprint_type == 'PB3' @@ -19,26 +20,22 @@ def get_progress(self, module): return 0, 0 def get_base_url(self, module): - return reverse('a4dashboard:voting-tokens', kwargs={ + return reverse('a4dashboard:voting-token-generation', kwargs={ 'module_slug': module.slug, }) def get_urls(self): return [ - (r'^modules/(?P[-\w_]+)/download-codes/$', - views.VotingDashboardView.as_view(component=self), - 'voting-tokens'), - (r'^modules/(?P[-\w_]+)/download-codes/export/$', - views.TokenExportView.as_view(), - 'token-export'), + (r'^modules/(?P[-\w_]+)/generate-codes/$', + views.TokenGenerationDashboardView.as_view(component=self), + 'voting-token-generation'), ] -class GenerateVotesComponent(DashboardComponent): - identifier = 'voting_token_generation' - weight = 48 - label = _('Code generation') - for_superuser_only = True +class ExportTokenComponent(DashboardComponent): + identifier = 'voting_token_export' + weight = 49 + label = _('Code download') def is_effective(self, module): return module.blueprint_type == 'PB3' @@ -47,17 +44,20 @@ def get_progress(self, module): return 0, 0 def get_base_url(self, module): - return reverse('a4dashboard:voting-token-generation', kwargs={ + return reverse('a4dashboard:voting-tokens', kwargs={ 'module_slug': module.slug, }) def get_urls(self): return [ - (r'^modules/(?P[-\w_]+)/generate-codes/$', - views.VotingGenerationDashboardView.as_view(component=self), - 'voting-token-generation'), + (r'^modules/(?P[-\w_]+)/download-codes/$', + views.ExportTokenDashboardView.as_view(component=self), + 'voting-tokens'), + (r'^modules/(?P[-\w_]+)/download-codes/export/$', + views.TokenExportView.as_view(), + 'token-export'), ] -components.register_module(VotesComponent()) -components.register_module(GenerateVotesComponent()) +components.register_module(GenerateTokenComponent()) +components.register_module(ExportTokenComponent()) diff --git a/meinberlin/apps/votes/templates/meinberlin_votes/voting_dashboard.html b/meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html similarity index 94% rename from meinberlin/apps/votes/templates/meinberlin_votes/voting_dashboard.html rename to meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html index 33cef58352..8a6f524c6a 100644 --- a/meinberlin/apps/votes/templates/meinberlin_votes/voting_dashboard.html +++ b/meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html @@ -11,7 +11,7 @@

{% translate 'Download voting codes' %}

{% for page in token_export_iterator %}
  • - {% translate " code package no." %} - {{ page }} + {% translate " code package no." %} {{ page }}
    {% translate "Download" %} diff --git a/meinberlin/apps/votes/templates/meinberlin_votes/voting_code_dashboard.html b/meinberlin/apps/votes/templates/meinberlin_votes/token_generation_dashboard.html similarity index 100% rename from meinberlin/apps/votes/templates/meinberlin_votes/voting_code_dashboard.html rename to meinberlin/apps/votes/templates/meinberlin_votes/token_generation_dashboard.html diff --git a/meinberlin/apps/votes/views.py b/meinberlin/apps/votes/views.py index a48efa69ca..3c8cd4182a 100644 --- a/meinberlin/apps/votes/views.py +++ b/meinberlin/apps/votes/views.py @@ -22,12 +22,12 @@ TOKENS_PER_MODULE = int(5e6) -class VotingDashboardView(ProjectMixin, - dashboard_mixins.DashboardBaseMixin, - dashboard_mixins.DashboardComponentMixin, - generic.TemplateView): +class ExportTokenDashboardView(ProjectMixin, + dashboard_mixins.DashboardBaseMixin, + dashboard_mixins.DashboardComponentMixin, + generic.TemplateView): permission_required = 'a4projects.change_project' - template_name = 'meinberlin_votes/voting_dashboard.html' + template_name = 'meinberlin_votes/token_export_dashboard.html' def _get_number_of_tokens(self): return VotingToken.objects.filter( @@ -99,7 +99,7 @@ def raise_exception(self): return self.request.user.is_authenticated -class VotingGenerationDashboardView( +class TokenGenerationDashboardView( ProjectMixin, dashboard_mixins.DashboardBaseMixin, dashboard_mixins.DashboardComponentMixin, generic.base.TemplateResponseMixin, generic.edit.FormMixin, @@ -115,7 +115,7 @@ class VotingGenerationDashboardView( _('Please adjust your number of codes. Per module you can ' 'generate up to {} codes.')) permission_required = 'is_superuser' - template_name = 'meinberlin_votes/voting_code_dashboard.html' + template_name = 'meinberlin_votes/token_generation_dashboard.html' def _get_number_of_tokens(self): return VotingToken.objects.filter(