label = _('Moderators') def is_effective(self, project): return True def get_base_url(self, project): return reverse('a4dashboard:dashboard-moderators-edit', kwargs={'project_slug': project.slug}) def get_urls(self): return [(r'^projects/(?P<project_slug>[-\w_]+)/moderators/$', views.DashboardProjectModeratorsView.as_view(component=self), 'dashboard-moderators-edit')] components.register_project(ModeratorsComponent()) class ExportQuestionsComponent(DashboardComponent): identifier = 'questions_export' weight = 30 label = _('Export Excel') def is_effective(self, module): return True def get_base_url(self, module): return reverse('a4dashboard:dashboard-questions-export', kwargs={'module_slug': module.slug}) def get_urls(self):
from django.utils.translation import ugettext_lazy as _ from adhocracy4.dashboard import ProjectFormComponent from adhocracy4.dashboard import components from . import forms class PlanComponent(ProjectFormComponent): identifier = 'plans' weight = 33 label = _('Plans') form_title = _('Edit Plan') form_class = forms.ProjectPlansDashboardForm form_template_name = 'meinberlin_plans/project_plans_form.html' components.register_project(PlanComponent())
return [ (r'^projects/(?P<project_slug>[-\w_]+)/participants/$', views.DashboardProjectParticipantsView.as_view(component=self), 'dashboard-participants-edit') ] class ModeratorsComponent(DashboardComponent): identifier = 'moderators' weight = 32 label = _('Moderators') def is_effective(self, project): return True def get_base_url(self, project): return reverse('a4dashboard:dashboard-moderators-edit', kwargs={ 'organisation_slug': project.organisation.slug, 'project_slug': project.slug }) def get_urls(self): return [(r'^projects/(?P<project_slug>[-\w_]+)/moderators/$', views.DashboardProjectModeratorsView.as_view(component=self), 'dashboard-moderators-edit')] components.register_project(ModeratorsComponent()) components.register_project(ParticipantsComponent())
form_class = forms.ContainerProjectsForm form_template_name = 'meinberlin_projectcontainers/includes' \ '/container_projects_form.html' def is_effective(self, project): project_type = get_project_type(project) return project_type == 'container' def get_base_url(self, project): return reverse('a4dashboard:dashboard-container-projects', kwargs={'project_slug': project.slug}) def get_urls(self): return [(r'^projects/(?P<project_slug>[-\w_]+)/container-projects/$', views.ContainerProjectsView.as_view( component=self, title=self.form_title, form_class=self.form_class, form_template_name=self.form_template_name), 'dashboard-container-projects')] def get_progress(self, project): if project.projectcontainer.projects.all().exists(): return 1, 1 return 0, 1 components.register_project(ContainerBasicComponent()) components.register_project(ContainerInformationComponent()) components.register_project(ContainerProjectsComponent())
def is_effective(self, project): project_type = get_project_type(project) return project_type == 'bplan' def get_base_url(self, project): return reverse('a4dashboard:dashboard-bplan-project-edit', kwargs={'project_slug': project.slug}) def get_urls(self): return [(r'^projects/(?P<project_slug>[-\w_]+)/bplan/$', views.BplanProjectUpdateView.as_view( component=self, title=self.form_title, form_class=self.form_class, form_template_name=self.form_template_name), 'dashboard-bplan-project-edit')] def get_progress(self, project): project = project.externalproject.bplan num_valid, num_required = super().get_progress(project) phase_num_valid, phase_num_required = \ self._get_progress_for_object(project.phase, ['start_date', 'end_date']) return num_valid + phase_num_valid, num_required + phase_num_required components.register_project(BplanProjectComponent())
components) from . import forms class ProjectBasicComponent(ProjectFormComponent): identifier = 'speakup-basic' weight = 10 label = _('Basic settings') form_title = _('Edit basic settings') form_class = forms.ProjectBasicForm form_template_name = 'a4dashboard/includes/project_basic_form.html' def is_effective(self, project): return True class ModulePhasesComponent(ModuleFormSetComponent): identifier = 'speakup-phases' weight = 11 label = _('Time Period') form_title = _('Edit time period') form_class = forms.SpeakupPhaseFormSet form_template_name = 'a4dashboard/includes/module_phases_form.html' components.register_project(ProjectBasicComponent()) components.register_module(ModulePhasesComponent())
from adhocracy4.dashboard import components from . import views class AdminLogComponent(DashboardComponent): identifier = 'adminlog' weight = 60 label = _('Log') def is_effective(self, project): return True def get_progress(self, project): return 0, 0 def get_base_url(self, project): return reverse('a4dashboard:adminlog', kwargs={ 'project_slug': project.slug, }) def get_urls(self): return [ (r'^projects/(?P<project_slug>[-\w_]+)/log/$', views.AdminLogProjectDashboardView.as_view(component=self), 'adminlog'), ] components.register_project(AdminLogComponent())
def is_effective(self, project): return True def get_progress(self, project): return 0, 0 def get_base_url(self, project): return reverse('a4dashboard:offlineevent-list', kwargs={ 'organisation_slug': project.organisation.slug, 'project_slug': project.slug }) def get_urls(self): return [ (r'^offlineevents/projects/(?P<project_slug>[-\w_]+)/$', views.OfflineEventListView.as_view(component=self), 'offlineevent-list'), (r'^offlineevents/create/project/(?P<project_slug>[-\w_]+)/$', views.OfflineEventCreateView.as_view(component=self), 'offlineevent-create'), (r'^offlineevents/(?P<slug>[-\w_]+)/update/$', views.OfflineEventUpdateView.as_view(component=self), 'offlineevent-update'), (r'^offlineevents/(?P<slug>[-\w_]+)/delete/$', views.OfflineEventDeleteView.as_view(component=self), 'offlineevent-delete') ] components.register_project(OfflineEventsComponent())
class ExternalProjectComponent(ProjectFormComponent): identifier = 'external' weight = 10 label = _('External project settings') form_title = _('Edit external project settings') form_class = forms.ExternalProjectForm form_template_name = 'meinberlin_extprojects/includes' \ '/external_project_form.html' def is_effective(self, project): project_type = get_project_type(project) return project_type == 'external' def get_base_url(self, project): return reverse('a4dashboard:dashboard-external-project-edit', kwargs={'project_slug': project.slug}) def get_urls(self): return [(r'^projects/(?P<project_slug>[-\w_]+)/external/$', views.ExternalProjectUpdateView.as_view( component=self, title=self.form_title, form_class=self.form_class, form_template_name=self.form_template_name), 'dashboard-external-project-edit')] components.register_project(ExternalProjectComponent())