From db339b086d0cf345f4d516c434cab01f14adde18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 22:32:51 +0100 Subject: [PATCH 01/11] Fix timezones --- src/ekklesia_portal/app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ekklesia_portal/app.py b/src/ekklesia_portal/app.py index 5c7b6061..e836a326 100644 --- a/src/ekklesia_portal/app.py +++ b/src/ekklesia_portal/app.py @@ -48,6 +48,7 @@ def app_setting_section(): "log_environment_on_startup": False, "internal_login_enabled": True, "languages": ["de", "en"], + "timezone": "UTC", "login_visible": False, "report_url": None, "source_code_url": "https://github.com/edemocracy/ekklesia-portal", @@ -276,5 +277,6 @@ def make_wsgi_app(settings_filepath=None, testing=False): database.configure_sqlalchemy(app.settings.database, testing) app.babel_init() app.babel.localeselector(get_locale) + app.babel.timezoneselector(lambda: app.settings.app.timezone) return app From 0a22af4e8bcda993d6db6bc6689f0de43c1e328c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 22:34:28 +0100 Subject: [PATCH 02/11] fix button layout in header bar --- .../concepts/ekklesia_portal/templates/layout.j2.jade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ekklesia_portal/concepts/ekklesia_portal/templates/layout.j2.jade b/src/ekklesia_portal/concepts/ekklesia_portal/templates/layout.j2.jade index abe7db80..a7ea027a 100644 --- a/src/ekklesia_portal/concepts/ekklesia_portal/templates/layout.j2.jade +++ b/src/ekklesia_portal/concepts/ekklesia_portal/templates/layout.j2.jade @@ -44,7 +44,7 @@ body input.form-control(type="text", placeholder=_("search_for"), name="search", value=search_query) button.search_button(type="submit") i.fas.fa-search   - = _('button_search') + = _('button_search') if current_user is not none |   @@ -54,12 +54,12 @@ body form.top_logout(action=logout_action, method="POST") button.logout_button(type="submit") i.fas.fa-sign-out-alt   - = _('button_logout') + = _('button_logout') else if show_login_button a.login_button(href=login_url) i.fas.fa-sign-in-alt   - = _("button_login") + = _("button_login") - block messages From 123710a7b18c91d724e45ecf865a78249c3a674f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 22:37:09 +0100 Subject: [PATCH 03/11] Increase minimum title length according to Discourse --- .../concepts/proposition/proposition_contracts.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ekklesia_portal/concepts/proposition/proposition_contracts.py b/src/ekklesia_portal/concepts/proposition/proposition_contracts.py index 12282488..098deb0b 100644 --- a/src/ekklesia_portal/concepts/proposition/proposition_contracts.py +++ b/src/ekklesia_portal/concepts/proposition/proposition_contracts.py @@ -17,8 +17,9 @@ 'related_proposition_id': HiddenWidget() } + class PropositionSchema(Schema): - title = string_property(title=_('title'), validator=Length(min=5, max=255)) + title = string_property(title=_('title'), validator=Length(min=7, max=255)) content = string_property(title=_('content'), validator=Length(min=10, max=100_000)) motivation = string_property(title=_('motivation'), missing='', validator=Length(max=100_000)) tags = set_property(title=_('tags'), missing=tuple()) @@ -48,7 +49,7 @@ class PropositionEditSchema(PropositionSchema): class PropositionNewDraftSchema(Schema): - title = string_property(title=_('title'), validator=Length(min=5, max=255)) + title = string_property(title=_('title'), validator=Length(min=7, max=255)) content = string_property(title=_('content'), validator=Length(min=10, max=100_000)) motivation = string_property(title=_('motivation'), missing='', validator=Length(max=100_000)) tags = set_property(title=_('tags'), missing=tuple()) From 25575e15c6422c9e3c35a3505719b0cbe2de0072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 22:54:53 +0100 Subject: [PATCH 04/11] Fix and improve proposition history date display --- .../concepts/proposition/proposition_cells.py | 4 ++-- .../proposition_history_finished.j2.jade | 4 ++-- .../proposition_history_qualified.j2.jade | 18 +++++++++++++++ .../proposition_history_scheduled.j2.jade | 14 ++++++++---- .../proposition_history_voting.j2.jade | 22 +++++++++++++++++++ src/ekklesia_portal/datamodel.py | 4 ++-- .../translations/de/LC_MESSAGES/messages.po | 10 ++++++++- .../translations/en/LC_MESSAGES/messages.po | 12 ++++++++-- 8 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade create mode 100644 src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade diff --git a/src/ekklesia_portal/concepts/proposition/proposition_cells.py b/src/ekklesia_portal/concepts/proposition/proposition_cells.py index 06aca4c3..a7b721ff 100644 --- a/src/ekklesia_portal/concepts/proposition/proposition_cells.py +++ b/src/ekklesia_portal/concepts/proposition/proposition_cells.py @@ -93,9 +93,9 @@ def history(self): PropositionStatus.CHANGING: 'submitted', PropositionStatus.SUBMITTED: 'submitted', PropositionStatus.ABANDONED: 'submitted', - PropositionStatus.QUALIFIED: 'submitted', + PropositionStatus.QUALIFIED: 'qualified', PropositionStatus.SCHEDULED: 'scheduled', - PropositionStatus.VOTING: 'scheduled', + PropositionStatus.VOTING: 'voting', PropositionStatus.FINISHED: 'finished', } variant = status_to_variant[self._model.status] diff --git a/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade index e6a5683c..01a6f25a 100644 --- a/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade +++ b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade @@ -12,7 +12,7 @@ if show_full_history = _('submitted_on', date=submitted_at|dateformat) .proposition_history_item - if voting_phase.target - = _('finished_on', date=voting_phase.target|dateformat) + if voting_phase.voting_end + = _('finished_on', date=voting_phase.voting_end|dateformat) else = _('finished_no_date') diff --git a/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade new file mode 100644 index 00000000..c3c00894 --- /dev/null +++ b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade @@ -0,0 +1,18 @@ +if show_full_history + if author + .proposition_history_item + = _("created_by", author=author.name) + + if created_at + .proposition_history_item + = _("created_on", date=created_at|dateformat) + + if submitted_at + .proposition_history_item + = _('submitted_on', date=submitted_at|dateformat) + +.proposition_history_item + if qualified_at + = _('qualified_on', date=qualified_at|dateformat) + else + = _('qualified_no_date') diff --git a/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade index 5ef7894a..35226ccd 100644 --- a/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade +++ b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade @@ -15,8 +15,14 @@ if show_full_history .proposition_history_item = _('qualified_on', date=qualified_at|dateformat) -.proposition_history_item - if voting_phase.target - = _('voting_ends_at', datetime=voting_phase.target|datetimeformat) - else +if voting_phase.voting_start or voting_phase.voting_end + if voting_phase.voting_start: + .proposition_history_item + = _('voting_starts_at', datetime=voting_phase.voting_start|datetimeformat) + + if voting_phase.voting_end: + .proposition_history_item + = _('voting_ends_at', datetime=voting_phase.voting_end|datetimeformat) +else + .proposition_history_item = _('voting_no_date') diff --git a/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade new file mode 100644 index 00000000..77374693 --- /dev/null +++ b/src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade @@ -0,0 +1,22 @@ +if show_full_history + if author + .proposition_history_item + = _("created_by", author=author.name) + + if created_at + .proposition_history_item + = _("created_on", date=created_at|dateformat) + + if submitted_at + .proposition_history_item + = _('submitted_on', date=submitted_at|dateformat) + + if qualified_at + .proposition_history_item + = _('qualified_on', date=qualified_at|dateformat) + +.proposition_history_item + if voting_phase.voting_end + = _('voting_ends_at', datetime=voting_phase.voting_end|datetimeformat) + else + = _('voting_no_date') diff --git a/src/ekklesia_portal/datamodel.py b/src/ekklesia_portal/datamodel.py index bcd52346..331045b1 100644 --- a/src/ekklesia_portal/datamodel.py +++ b/src/ekklesia_portal/datamodel.py @@ -402,7 +402,7 @@ def registration_end(self): days = self.registration_end_days or self.phase_type.registration_end_days or 0 - return self.target - timedelta(days=days) + return self.target - timedelta(days=days) - timedelta(seconds=1) @property def voting_can_be_created(self): @@ -426,7 +426,7 @@ def voting_start(self): @property def voting_end(self): - return self.target + return self.target - timedelta(seconds=1) class Supporter(Base): # §3.5 diff --git a/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po b/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po index 2a068af7..2d379867 100644 --- a/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po +++ b/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po @@ -1082,7 +1082,15 @@ msgstr "Abgeschlossen" msgid "qualified_on" msgstr "Zur Abstimmung qualifiziert am %(date)s" -#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:10 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:18 +msgid "qualified_no_date" +msgstr "Zur Abstimmung qualifiziert" + +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:21 +msgid "voting_starts_at" +msgstr "Abstimmung beginnt am %(datetime)s" + +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:23 msgid "voting_ends_at" msgstr "Abstimmung endet am %(datetime)s" diff --git a/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po b/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po index d6b338f0..a3015fea 100644 --- a/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po +++ b/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po @@ -314,7 +314,7 @@ msgstr "External voting module settings" #: src/ekklesia_portal/concepts/department/templates/department.j2.jade:8 msgid "number_of_members" -msgstr "(%(num_members)s members)" +msgstr "(%(num)s members)" #: src/ekklesia_portal/concepts/department/templates/departments.j2.jade:5 #: src/ekklesia_portal/concepts/ekklesia_portal/templates/admin_box.j2.jade:38 @@ -1072,7 +1072,15 @@ msgstr "Finished" msgid "qualified_on" msgstr "Qualified for voting on %(date)s" -#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:10 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:18 +msgid "qualified_no_date" +msgstr "Qualified for voting" + +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:21 +msgid "voting_starts_at" +msgstr "Voting starts at %(datetime)s" + +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:23 msgid "voting_ends_at" msgstr "Voting ends at %(datetime)s" From 81b9a89f2882a123501bb2a78cc12c49f5798d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 23:08:00 +0100 Subject: [PATCH 05/11] Add proposition filter to show only supported propositions --- .../concepts/proposition/proposition_cells.py | 9 +++++---- .../concepts/proposition/proposition_views.py | 2 +- .../concepts/proposition/propositions.py | 20 ++++++++++++++----- .../templates/propositions.j2.jade | 8 ++++++++ .../concepts/user/templates/user.j2.jade | 3 +++ .../concepts/user/user_cells.py | 12 +++++++++-- .../translations/de/LC_MESSAGES/messages.po | 8 ++++++++ .../translations/en/LC_MESSAGES/messages.po | 8 ++++++++ 8 files changed, 58 insertions(+), 12 deletions(-) diff --git a/src/ekklesia_portal/concepts/proposition/proposition_cells.py b/src/ekklesia_portal/concepts/proposition/proposition_cells.py index a7b721ff..c47d77fd 100644 --- a/src/ekklesia_portal/concepts/proposition/proposition_cells.py +++ b/src/ekklesia_portal/concepts/proposition/proposition_cells.py @@ -459,7 +459,7 @@ def _prepare_form_for_render(self): departments = self._request.current_user.departments tags = self._request.q(Tag).all() - items = items_for_proposition_select_widgets(departments, tags, selected_tag_names) + items = items_for_proposition_select_widgets(departments, tags, selected_tags=selected_tag_names) self._form.prepare_for_render(items) def department_name(self): @@ -507,17 +507,18 @@ class PropositionsCell(LayoutCell): 'tag_values', 'type', 'without_tag_values', + 'only_supporting' ] pager = Cell.fragment("propositions_pager") def propositions(self): is_admin = self.current_user and self._request.identity.has_global_admin_permissions - return list(self._model.propositions(self._request.q, is_admin)) + return list(self._model.propositions(self._request.q, self.current_user, is_admin)) def prop_count(self): is_admin = self.current_user and self._request.identity.has_global_admin_permissions - return self._model.propositions(self._request.q, is_admin, count=True) + return self._model.propositions(self._request.q, self.current_user, is_admin, count=True) def page_count(self): per_page = self.prop_per_page @@ -607,7 +608,7 @@ def _prepare_form_for_render(self): selected_tag_names = self._form.cstruct['tags'] tags = self._request.q(Tag).all() - items = items_for_proposition_select_widgets([], tags, selected_tag_names) + items = items_for_proposition_select_widgets([], tags, selected_tags=selected_tag_names) self._form.prepare_for_render(items) def department_name(self): diff --git a/src/ekklesia_portal/concepts/proposition/proposition_views.py b/src/ekklesia_portal/concepts/proposition/proposition_views.py index 862a0c33..c64ae069 100644 --- a/src/ekklesia_portal/concepts/proposition/proposition_views.py +++ b/src/ekklesia_portal/concepts/proposition/proposition_views.py @@ -245,7 +245,7 @@ def index_csv(self, request): optional_fields = TableRowOptionalFields() optional_fields.submitters = is_global_admin content = propositions_to_csv( - self.propositions(request.q, is_global_admin), + self.propositions(request.q, request.current_user, is_global_admin), origin=request.app.settings.common.instance_name, optional_fields=optional_fields ) diff --git a/src/ekklesia_portal/concepts/proposition/propositions.py b/src/ekklesia_portal/concepts/proposition/propositions.py index b67ca134..46cc1549 100644 --- a/src/ekklesia_portal/concepts/proposition/propositions.py +++ b/src/ekklesia_portal/concepts/proposition/propositions.py @@ -9,9 +9,8 @@ from sqlalchemy.orm import joinedload from sqlalchemy.sql.functions import coalesce -from ekklesia_common.lid import LID -from ekklesia_portal.datamodel import Ballot, Changeset, Department, Proposition, PropositionType, SubjectArea, Tag, VotingPhase -from ekklesia_portal.enums import PropositionStatus, PropositionVisibility, PropositionRelationType +from ekklesia_portal.datamodel import Ballot, Changeset, Department, Proposition, PropositionType, SubjectArea, Tag, VotingPhase, Supporter +from ekklesia_portal.enums import PropositionStatus, PropositionVisibility, PropositionRelationType, SupporterStatus @dataclass @@ -31,6 +30,7 @@ class Propositions: association_type: PropositionRelationType = None association_id: str = None include_amendments: str = None + only_supporting: str = None # Initialization with numbers instead of None is necessary because otherwise the # query values are not actually converted to an integer on assignment page: Optional[int] = 1 # Ranges: x<=1 = None => First page; x>1 => Show page x @@ -51,6 +51,7 @@ def __post_init__(self): self.type = self.type or None self.status = self.status or None self.include_amendments = self.include_amendments or None + self.only_supporting = self.only_supporting or None self.status_values = None self.tag_values = None @@ -163,6 +164,8 @@ def parse_search_filter(self, key, value): self.visibility = value case "include_amendments": self.include_amendments = value + case "only_supporting": + self.only_supporting = value def build_search_query(self): query = [] @@ -190,6 +193,8 @@ def build_search_query(self): query.append("visibility:" + self.maybe_add_quotes(self.visibility)) if self.include_amendments: query.append("include_amendments:" + self.include_amendments) + if self.only_supporting: + query.append("only_supporting:" + self.only_supporting) return " ".join(query) @@ -204,7 +209,7 @@ def maybe_add_quotes(value): return value @log_call - def propositions(self, q, is_admin=False, count=False): + def propositions(self, q, current_user, is_admin=False, count=False): Message.log( message_type="propositions_filters", @@ -275,7 +280,12 @@ def propositions(self, q, is_admin=False, count=False): propositions = propositions.filter(~Proposition.tags.contains(tag)) if not self.include_amendments: - propositions = propositions.filter(Proposition.modifies_id.is_(None)) + propositions = propositions.filter(Proposition.modifies_id.is_(None)) + + if self.only_supporting: + propositions = (propositions.join(Supporter) + .filter(Supporter.member_id == current_user.id) + .filter(Supporter.status == SupporterStatus.ACTIVE)) if count: propositions = propositions.count() diff --git a/src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade b/src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade index e570455f..f1ffc2c8 100644 --- a/src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade +++ b/src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade @@ -126,6 +126,14 @@ li a.btn_filter_remove(href=change_self_link(without_tags=none), title=_('remove_filter')) X + if only_supporting + li.nav-item + ul.proposition_filter + li + = _('only_supporting') + li + a.btn_filter_remove(href=change_self_link(only_supporting = none), title=_('remove_filter')) X + div.page-selector = pager() diff --git a/src/ekklesia_portal/concepts/user/templates/user.j2.jade b/src/ekklesia_portal/concepts/user/templates/user.j2.jade index 753a2ba6..3a7487b6 100644 --- a/src/ekklesia_portal/concepts/user/templates/user.j2.jade +++ b/src/ekklesia_portal/concepts/user/templates/user.j2.jade @@ -45,6 +45,9 @@   if member_in_area = _('member_in_area') + a(href=supported_link(subject_area=area)) + = _('supported_propositions') + br if area in supported_areas = _('cant_leave_supporting_area') else diff --git a/src/ekklesia_portal/concepts/user/user_cells.py b/src/ekklesia_portal/concepts/user/user_cells.py index 11edbf1c..28e36e7e 100644 --- a/src/ekklesia_portal/concepts/user/user_cells.py +++ b/src/ekklesia_portal/concepts/user/user_cells.py @@ -4,8 +4,9 @@ from ekklesia_portal.app import App from ekklesia_portal.concepts.ekklesia_portal.cell.form import EditFormCell from ekklesia_portal.concepts.ekklesia_portal.cell.layout import LayoutCell +from ekklesia_portal.concepts.proposition import Propositions from ekklesia_portal.concepts.user.user_helper import items_for_user_select_widgets -from ekklesia_portal.datamodel import Group, User, UserProfile +from ekklesia_portal.datamodel import Group, User, UserProfile, SubjectArea from ekklesia_portal.enums import PropositionStatus, SupporterStatus @@ -40,9 +41,16 @@ def member_area_action(self): return self.link(self._model, name='member_area') def supported_areas(self): - return [support.proposition.ballot.area for support in self._model.member_propositions \ + return [support.proposition.ballot.area for support in self._model.member_propositions if support.status == SupporterStatus.ACTIVE and support.proposition.status == PropositionStatus.SUBMITTED] + def supported_link(self, subject_area: SubjectArea): + return self.class_link(Propositions, { + "department": subject_area.department.name, + "subject_area": subject_area.name, + "only_supporting": "yes" + }) + @App.cell('edit') class EditUserCell(EditFormCell): diff --git a/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po b/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po index 2d379867..90f6d1b4 100644 --- a/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po +++ b/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po @@ -899,6 +899,10 @@ msgstr "Anträge mit Tags" msgid "propositions_without_tags" msgstr "Anträge ohne Tags" +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:133 +msgid "only_supporting" +msgstr "Nur unterstützte Anträge" + #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:78 msgid "no_propositions_found" msgstr "Keine Anträge gefunden" @@ -1271,6 +1275,10 @@ msgstr "(Du bist Teilnehmer): " msgid "not_member_in_area" msgstr "(Du bist kein Teilnehmer): " +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:50 +msgid "supported_propositions" +msgstr "Unterstützte Anträge" + #: src/ekklesia_portal/concepts/user/templates/user.j2.jade:49 msgid "cant_leave_supporting_area" msgstr "Solange du Anträge in diesem Themenbereich unterstützt, kannst du ihn nicht verlassen" diff --git a/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po b/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po index a3015fea..8cf48c3c 100644 --- a/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po +++ b/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po @@ -895,6 +895,10 @@ msgstr "Tagged propositions" msgid "propositions_without_tags" msgstr "Propositions without tags" +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:133 +msgid "only_supporting" +msgstr "Only supported propositions" + #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:78 msgid "no_propositions_found" msgstr "No propositions found" @@ -1261,6 +1265,10 @@ msgstr "(You are participating): " msgid "not_member_in_area" msgstr "(You are not participating): " +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:50 +msgid "supported_propositions" +msgstr "Supported Propositions" + #: src/ekklesia_portal/concepts/user/templates/user.j2.jade:49 msgid "cant_leave_supporting_area" msgstr "As long as you support propositions in this subject area, you can't quit the participation" From 331c12064599f8cf7c2b6e6d3afed1046ce4303e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 23:10:47 +0100 Subject: [PATCH 06/11] Allow entering a time in addition to a date for the voting phase target --- .../concepts/voting_phase/voting_phase_contracts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py b/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py index bc99f113..2c03f756 100644 --- a/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py +++ b/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py @@ -1,7 +1,7 @@ from colander import Length from deform import Button from deform.widget import SelectWidget, TextAreaWidget -from ekklesia_common.contract import Form, Schema, bool_property, date_property, enum_property, int_property, json_property, string_property +from ekklesia_common.contract import Form, Schema, bool_property, datetime_property, enum_property, int_property, json_property, string_property from ekklesia_common.translation import _ from ekklesia_portal.enums import VotingStatus @@ -10,7 +10,7 @@ class VotingPhaseSchema(Schema): name = string_property(title=_('name'), validator=Length(max=23), missing='') title = string_property(title=_('title'), validator=Length(max=160), missing='') - target = date_property(title=_('target'), description=_('voting_phase_target_description'), missing=None) + target = datetime_property(title=_('target'), description=_('voting_phase_target_description'), missing=None) status = enum_property(VotingStatus, title=_('voting_status')) department_id = int_property(title=_('department')) phase_type_id = int_property(title=_('voting_phase_type')) From f45310a927751e4ba55e63be9766f3f8388ae28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 23:14:59 +0100 Subject: [PATCH 07/11] Hacky fix for when Discourse doesn't accept our tags --- src/ekklesia_portal/lib/discourse.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ekklesia_portal/lib/discourse.py b/src/ekklesia_portal/lib/discourse.py index aa9286c4..8d12d5f7 100644 --- a/src/ekklesia_portal/lib/discourse.py +++ b/src/ekklesia_portal/lib/discourse.py @@ -25,19 +25,26 @@ class DiscourseError(Exception): pass -def create_discourse_topic(config: DiscourseConfig, topic: DiscourseTopic): +def create_discourse_topic(config: DiscourseConfig, topic: DiscourseTopic, without_tags: bool = False): headers = {'accept': 'application/json', 'api-key': config.api_key, 'api-username': config.api_username} - req = {'raw': topic.content, 'category': config.category, 'title': topic.title, 'tags': topic.tags} + if without_tags: + req = {'raw': topic.content, 'category': config.category, 'title': topic.title} + else: + req = {'raw': topic.content, 'category': config.category, 'title': topic.title, 'tags': topic.tags} - with start_action(action_type="discourse_post") as action: + with start_action(action_type="discourse_post", without_tags=without_tags) as action: resp = requests.post(f"{config.base_url}/posts.json", json=req, headers=headers) action.add_success_fields(response=resp.json()) try: resp.raise_for_status() except HTTPError as e: - raise DiscourseError(e) + if e.response.status_code == 422 and not without_tags: + # Try again once without tags + return create_discourse_topic(config, topic, True) + else: + raise DiscourseError(e) return resp From 09e86938b4a3926412bf0f25e1e3048801bdb91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 23:16:13 +0100 Subject: [PATCH 08/11] Update messages.pot --- src/ekklesia_portal/translations/messages.pot | 257 ++++++++++-------- 1 file changed, 147 insertions(+), 110 deletions(-) diff --git a/src/ekklesia_portal/translations/messages.pot b/src/ekklesia_portal/translations/messages.pot index c04a3d15..c49d3270 100644 --- a/src/ekklesia_portal/translations/messages.pot +++ b/src/ekklesia_portal/translations/messages.pot @@ -1,33 +1,33 @@ # Translations template for PROJECT. -# Copyright (C) 2023 ORGANIZATION +# Copyright (C) 2024 ORGANIZATION # This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2023. +# FIRST AUTHOR , 2024. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-06-23 02:59+0200\n" +"POT-Creation-Date: 2024-02-11 23:15+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.12.1\n" +"Generated-By: Babel 2.14.0\n" #: src/ekklesia_portal/concepts/argument/argument_contracts.py:12 #: src/ekklesia_portal/concepts/page/page_contracts.py:11 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:21 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:51 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:22 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:52 #: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:12 msgid "title" msgstr "" #: src/ekklesia_portal/concepts/argument/argument_contracts.py:13 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:25 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:55 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:26 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:56 msgid "abstract" msgstr "" @@ -44,8 +44,8 @@ msgstr "" #: src/ekklesia_portal/concepts/ekklesia_portal/contracts/token.py:14 #: src/ekklesia_portal/concepts/page/page_contracts.py:19 #: src/ekklesia_portal/concepts/policy/policy_contracts.py:30 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:84 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:128 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:85 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:130 #: src/ekklesia_portal/concepts/proposition_note/proposition_note_contracts.py:20 #: src/ekklesia_portal/concepts/proposition_type/proposition_type_contracts.py:18 #: src/ekklesia_portal/concepts/subject_area/subject_area_contracts.py:17 @@ -104,7 +104,7 @@ msgstr "" #: src/ekklesia_portal/concepts/ballot/ballot_contracts.py:14 #: src/ekklesia_portal/concepts/ballot/templates/ballot.j2.jade:21 #: src/ekklesia_portal/concepts/document/document_contracts.py:11 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:31 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:32 #: src/ekklesia_portal/concepts/proposition/templates/edit_proposition.j2.jade:7 #: src/ekklesia_portal/concepts/proposition/templates/proposition_badges.j2.jade:4 #: src/ekklesia_portal/concepts/proposition/templates/proposition_submit_draft.j2.jade:15 @@ -122,7 +122,7 @@ msgstr "" #: src/ekklesia_portal/concepts/ballot/ballot_contracts.py:16 #: src/ekklesia_portal/concepts/ballot/templates/ballot.j2.jade:23 #: src/ekklesia_portal/concepts/document/templates/document.j2.jade:15 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:32 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:33 #: src/ekklesia_portal/concepts/proposition/templates/proposition_submit_draft.j2.jade:17 #: src/ekklesia_portal/concepts/proposition_type/templates/proposition_type.j2.jade:3 msgid "proposition_type" @@ -142,7 +142,7 @@ msgstr "" #: src/ekklesia_portal/concepts/ballot/templates/ballot.j2.jade:13 #: src/ekklesia_portal/concepts/document/document_helper.py:15 #: src/ekklesia_portal/concepts/document/document_helper.py:16 -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:54 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:59 msgid "not_determined" msgstr "" @@ -161,7 +161,7 @@ msgstr "" #: src/ekklesia_portal/concepts/ballot/templates/ballot.j2.jade:7 #: src/ekklesia_portal/concepts/proposition/templates/edit_proposition.j2.jade:12 #: src/ekklesia_portal/concepts/proposition/templates/edit_proposition.j2.jade:13 -#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:10 +#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:5 msgid "ballot" msgstr "" @@ -200,7 +200,7 @@ msgstr "" #: src/ekklesia_portal/concepts/ekklesia_portal/templates/admin_box.j2.jade:2 #: src/ekklesia_portal/concepts/ekklesia_portal/templates/index.j2.jade:16 #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:3 -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:37 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:42 msgid "propositions" msgstr "" @@ -220,7 +220,7 @@ msgstr "" #: src/ekklesia_portal/concepts/ballot/templates/ballots.j2.jade:5 #: src/ekklesia_portal/concepts/ekklesia_portal/templates/admin_box.j2.jade:26 -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:40 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:45 msgid "ballots" msgstr "" @@ -577,7 +577,7 @@ msgstr "" #: src/ekklesia_portal/concepts/policy/policy_contracts.py:16 #: src/ekklesia_portal/concepts/policy/templates/policy.j2.jade:16 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:39 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:15 msgid "qualification_quorum" msgstr "" @@ -637,71 +637,71 @@ msgstr "" msgid "days" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:22 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:52 -msgid "content" -msgstr "" - #: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:23 #: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:53 -msgid "motivation" +msgid "content" msgstr "" #: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:24 #: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:54 -msgid "tags" +msgid "motivation" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:34 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:57 -msgid "editing_remarks" +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:25 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:55 +msgid "tags" msgstr "" #: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:35 #: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:58 +msgid "editing_remarks" +msgstr "" + +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:36 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:59 msgid "editing_remarks_description" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:42 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:43 msgid "voting_identifier" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:43 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:44 msgid "submitter_invitation_key" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:44 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:45 msgid "external_discussion_url" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:45 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:46 msgid "status" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:46 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:47 #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:35 msgid "visibility" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:47 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:48 msgid "external_fields" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:69 -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:99 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:70 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:100 msgid "button_create_draft" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:117 +#: src/ekklesia_portal/concepts/proposition/proposition_contracts.py:119 #: src/ekklesia_portal/concepts/proposition/templates/proposition_actions.j2.jade:2 msgid "button_submit_draft" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_views.py:411 +#: src/ekklesia_portal/concepts/proposition/proposition_views.py:444 msgid "change" msgstr "" -#: src/ekklesia_portal/concepts/proposition/proposition_views.py:521 +#: src/ekklesia_portal/concepts/proposition/proposition_views.py:557 msgid "amendment_to" msgstr "" @@ -763,18 +763,26 @@ msgstr "" msgid "changes" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:4 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:5 msgid "button_retract_secret_voting" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:7 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:8 msgid "button_request_secret_voting" msgstr "" +#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:13 +msgid "abbr_secret_voters_count" +msgstr "" + +#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:13 +msgid "abbr_secret_voting_quorum" +msgstr "" + #: src/ekklesia_portal/concepts/proposition/templates/proposition_small.j2.jade:10 -#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:5 -#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_submitted.j2.jade:5 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:39 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:15 +#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:2 +#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_submitted.j2.jade:2 msgid "supporter" msgid_plural "supporters" msgstr[0] "" @@ -782,8 +790,10 @@ msgstr[1] "" #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_draft.j2.jade:4 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade:4 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:4 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:4 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_submitted.j2.jade:4 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade:4 #: src/ekklesia_portal/concepts/proposition/templates/proposition_small.j2.jade:12 msgid "created_on" msgstr "" @@ -801,18 +811,16 @@ msgstr "" msgid "title_notice" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:4 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:5 msgid "button_retract_support" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:7 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:8 msgid "button_support" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:9 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:36 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:43 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:47 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:10 +#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:19 msgid "supporters" msgstr "" @@ -842,6 +850,7 @@ msgstr "" #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:51 #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:61 #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:72 +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:80 msgid "remove_filter" msgstr "" @@ -874,26 +883,30 @@ msgid "propositions_without_tags" msgstr "" #: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:78 +msgid "only_supporting" +msgstr "" + +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:86 msgid "no_propositions_found" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:88 +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:96 msgid "all_pages" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:90 +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:98 msgid "per_page" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:91 +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:99 msgid "set_page_count" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:95 +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:103 msgid "export_proposition_to_file" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:95 +#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:103 msgid "export_as_csv" msgstr "" @@ -965,6 +978,10 @@ msgstr "" msgid "notice_login" msgstr "" +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_draft.j2.jade:20 +msgid "current_submitters" +msgstr "" + #: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_qualified.j2.jade:2 msgid "title_qualified_proposition" msgstr "" @@ -973,6 +990,12 @@ msgstr "" msgid "info_qualified_proposition" msgstr "" +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_qualified.j2.jade:4 +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_scheduled.j2.jade:4 +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:8 +msgid "submitters" +msgstr "" + #: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_scheduled.j2.jade:2 msgid "title_scheduled_proposition" msgstr "" @@ -989,7 +1012,7 @@ msgstr "" msgid "info_submitted_proposition" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:5 +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:4 msgid "current_user_is_submitter" msgstr "" @@ -997,18 +1020,20 @@ msgstr "" msgid "current_user_is_submitter_and_supporter" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:7 +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:6 msgid "current_user_is_supporter_not_submitter" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:8 +#: src/ekklesia_portal/concepts/proposition/templates/detail_top/proposition_detail_top_submitted.j2.jade:7 msgid "current_user_can_support" msgstr "" #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_draft.j2.jade:2 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade:2 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:2 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:2 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_submitted.j2.jade:2 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade:2 msgid "created_by" msgstr "" @@ -1017,8 +1042,10 @@ msgid "created_no_date" msgstr "" #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_finished.j2.jade:6 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:6 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:6 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_submitted.j2.jade:6 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade:6 msgid "submitted_on" msgstr "" @@ -1030,15 +1057,27 @@ msgstr "" msgid "finished_no_date" msgstr "" +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:8 #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:8 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade:8 msgid "qualified_on" msgstr "" +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_qualified.j2.jade:8 +msgid "qualified_no_date" +msgstr "" + #: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:10 +msgid "voting_starts_at" +msgstr "" + +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:12 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade:10 msgid "voting_ends_at" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:10 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_scheduled.j2.jade:14 +#: src/ekklesia_portal/concepts/proposition/templates/history/proposition_history_voting.j2.jade:10 msgid "voting_no_date" msgstr "" @@ -1066,13 +1105,6 @@ msgid_plural "arguments" msgstr[0] "" msgstr[1] "" -#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:3 -#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_submitted.j2.jade:3 -msgid "amendment" -msgid_plural "amendments" -msgstr[0] "" -msgstr[1] "" - #: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_associated.j2.jade:5 msgid "title_proposition_modifies" msgstr "" @@ -1097,26 +1129,6 @@ msgstr "" msgid "button_add_con_argument" msgstr "" -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:15 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:22 -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:26 -msgid "supporter_groups" -msgstr "" - -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:18 -msgid "supporter_group" -msgid_plural "supporter_groups" -msgstr[0] "" -msgstr[1] "" - -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:62 -msgid "abbr_secret_voters_count" -msgstr "" - -#: src/ekklesia_portal/concepts/proposition/templates/tab/proposition_tab_process.j2.jade:62 -msgid "abbr_secret_voting_quorum" -msgstr "" - #: src/ekklesia_portal/concepts/proposition_note/proposition_note_contracts.py:11 msgid "proposition_id" msgstr "" @@ -1210,15 +1222,31 @@ msgstr "" msgid "member_in_area_explanation" msgstr "" -#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:20 -msgid "button_member_in_area" +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:21 +msgid "member_in_area" +msgstr "" + +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:21 +msgid "supported_propositions" +msgstr "" + +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:21 +msgid "cant_leave_supporting_area" msgstr "" #: src/ekklesia_portal/concepts/user/templates/user.j2.jade:22 +msgid "button_member_in_area" +msgstr "" + +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:23 +msgid "not_member_in_area" +msgstr "" + +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:24 msgid "button_not_member_in_area" msgstr "" -#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:29 +#: src/ekklesia_portal/concepts/user/templates/user.j2.jade:30 msgid "label_groups" msgstr "" @@ -1242,7 +1270,7 @@ msgstr "" msgid "voting_phase_target_description" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:51 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:56 #: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:14 msgid "voting_status" msgstr "" @@ -1299,12 +1327,16 @@ msgstr "" msgid "voting_module_data" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/voting_phase_views.py:169 +#: src/ekklesia_portal/concepts/voting_phase/voting_phase_views.py:165 msgid "voting_created_msg" msgstr "" +#: src/ekklesia_portal/concepts/voting_phase/voting_phase_views.py:212 +msgid "voting_retrieved_msg" +msgstr "" + #: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:2 -#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:9 +#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:15 msgid "title_edit_voting_phase" msgstr "" @@ -1316,11 +1348,19 @@ msgstr "" msgid "create_voting_button" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:10 +#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:9 +msgid "title_retrieve_voting" +msgstr "" + +#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:12 +msgid "retrieve_voting_button" +msgstr "" + +#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:16 msgid "inherited_properties" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:11 +#: src/ekklesia_portal/concepts/voting_phase/templates/edit_voting_phase.j2.jade:17 msgid "voting_phase_inherited_properties_explanation" msgstr "" @@ -1333,47 +1373,47 @@ msgid "could_not_vote_currently" msgstr "" #: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:24 -msgid "registration_links_help_text" +msgid "voting_info_text" msgstr "" #: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:25 -msgid "register_now_with_voting_module" +msgid "registration_links_help_text" msgstr "" #: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:27 -msgid "voting_info_text" +msgid "register_now_with_voting_module" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:28 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:29 msgid "voting_links_help_text" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:29 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:31 msgid "vote_now_with_voting_module" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:31 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:34 msgid "result_links_help_text" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:32 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:36 msgid "show_results_with_voting_module" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:45 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:50 msgid "registration_from" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:47 -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:50 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:52 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:55 msgid "start_end_duration" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:48 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:53 msgid "voting_from" msgstr "" -#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:53 +#: src/ekklesia_portal/concepts/voting_phase/templates/voting_phase.j2.jade:58 msgid "target_date" msgstr "" @@ -1447,14 +1487,10 @@ msgid "button_add_amendment" msgstr "" #: src/ekklesia_portal/helper/missing_translations.py:19 -msgid "tab_process" -msgstr "" - -#: src/ekklesia_portal/helper/missing_translations.py:20 msgid "button_add_counter_proposition" msgstr "" -#: src/ekklesia_portal/helper/missing_translations.py:21 +#: src/ekklesia_portal/helper/missing_translations.py:20 msgid "button_goto_associated" msgstr "" @@ -1677,3 +1713,4 @@ msgstr "" #: src/ekklesia_portal/enums.py:86 msgid "vote_by_user_abstention" msgstr "" + From 7868f328b0bc9ab369fa5daf80dc223b207ca16b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 23:28:53 +0100 Subject: [PATCH 09/11] Fix formatting --- .../concepts/proposition/propositions.py | 7 ++++--- .../concepts/user/user_cells.py | 18 +++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ekklesia_portal/concepts/proposition/propositions.py b/src/ekklesia_portal/concepts/proposition/propositions.py index 46cc1549..84f0e956 100644 --- a/src/ekklesia_portal/concepts/proposition/propositions.py +++ b/src/ekklesia_portal/concepts/proposition/propositions.py @@ -283,9 +283,10 @@ def propositions(self, q, current_user, is_admin=False, count=False): propositions = propositions.filter(Proposition.modifies_id.is_(None)) if self.only_supporting: - propositions = (propositions.join(Supporter) - .filter(Supporter.member_id == current_user.id) - .filter(Supporter.status == SupporterStatus.ACTIVE)) + propositions = ( + propositions.join(Supporter).filter(Supporter.member_id == current_user.id + ).filter(Supporter.status == SupporterStatus.ACTIVE) + ) if count: propositions = propositions.count() diff --git a/src/ekklesia_portal/concepts/user/user_cells.py b/src/ekklesia_portal/concepts/user/user_cells.py index 28e36e7e..0f2a94d5 100644 --- a/src/ekklesia_portal/concepts/user/user_cells.py +++ b/src/ekklesia_portal/concepts/user/user_cells.py @@ -41,15 +41,19 @@ def member_area_action(self): return self.link(self._model, name='member_area') def supported_areas(self): - return [support.proposition.ballot.area for support in self._model.member_propositions - if support.status == SupporterStatus.ACTIVE and support.proposition.status == PropositionStatus.SUBMITTED] + return [ + support.proposition.ballot.area for support in self._model.member_propositions + if support.status == SupporterStatus.ACTIVE and support.proposition.status == PropositionStatus.SUBMITTED + ] def supported_link(self, subject_area: SubjectArea): - return self.class_link(Propositions, { - "department": subject_area.department.name, - "subject_area": subject_area.name, - "only_supporting": "yes" - }) + return self.class_link( + Propositions, { + "department": subject_area.department.name, + "subject_area": subject_area.name, + "only_supporting": "yes" + } + ) @App.cell('edit') From 9cc22b39fb052408df4c15d7c05eeea807d88cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Sun, 11 Feb 2024 23:42:18 +0100 Subject: [PATCH 10/11] Fix test --- tests/lib/vvvote/test_election_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/vvvote/test_election_config.py b/tests/lib/vvvote/test_election_config.py index 75760097..39e4e401 100644 --- a/tests/lib/vvvote/test_election_config.py +++ b/tests/lib/vvvote/test_election_config.py @@ -37,6 +37,6 @@ def test_voting_phase_to_vvvote_election_config(db_session, ballot_factory, prop assert len(config.questions[1].options) == 3 assert len(config.questions[2].options) == 5 assert config.authData.VotingStart == target - timedelta(days=4) - assert config.authData.VotingEnd == target + assert config.authData.VotingEnd == target - timedelta(seconds=1) assert config.authData.RegistrationStartDate == target - timedelta(days=8) - assert config.authData.RegistrationEndDate == target - timedelta(days=4) + assert config.authData.RegistrationEndDate == target - timedelta(days=4) - timedelta(seconds=1) From 0181f64df3b404a66c03b9daab0f0b12e475d9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Borgsm=C3=BCller?= Date: Wed, 14 Feb 2024 21:09:31 +0100 Subject: [PATCH 11/11] Fix exception on empty target date, invert tags condition --- src/ekklesia_portal/datamodel.py | 3 +++ src/ekklesia_portal/lib/discourse.py | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ekklesia_portal/datamodel.py b/src/ekklesia_portal/datamodel.py index 331045b1..035a2062 100644 --- a/src/ekklesia_portal/datamodel.py +++ b/src/ekklesia_portal/datamodel.py @@ -426,6 +426,9 @@ def voting_start(self): @property def voting_end(self): + if self.target is None: + return + return self.target - timedelta(seconds=1) diff --git a/src/ekklesia_portal/lib/discourse.py b/src/ekklesia_portal/lib/discourse.py index 8d12d5f7..ee815627 100644 --- a/src/ekklesia_portal/lib/discourse.py +++ b/src/ekklesia_portal/lib/discourse.py @@ -25,25 +25,25 @@ class DiscourseError(Exception): pass -def create_discourse_topic(config: DiscourseConfig, topic: DiscourseTopic, without_tags: bool = False): +def create_discourse_topic(config: DiscourseConfig, topic: DiscourseTopic, with_tags: bool = True): headers = {'accept': 'application/json', 'api-key': config.api_key, 'api-username': config.api_username} - if without_tags: - req = {'raw': topic.content, 'category': config.category, 'title': topic.title} - else: + if with_tags: req = {'raw': topic.content, 'category': config.category, 'title': topic.title, 'tags': topic.tags} + else: + req = {'raw': topic.content, 'category': config.category, 'title': topic.title} - with start_action(action_type="discourse_post", without_tags=without_tags) as action: + with start_action(action_type="discourse_post", with_tags=with_tags) as action: resp = requests.post(f"{config.base_url}/posts.json", json=req, headers=headers) action.add_success_fields(response=resp.json()) try: resp.raise_for_status() except HTTPError as e: - if e.response.status_code == 422 and not without_tags: + if e.response.status_code == 422 and with_tags: # Try again once without tags - return create_discourse_topic(config, topic, True) + return create_discourse_topic(config, topic, with_tags=False) else: raise DiscourseError(e)