From 37b38c51996c82e8c6d460da352c7897f4a4ed51 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 5 Apr 2024 19:55:11 +0200 Subject: [PATCH 1/9] Added citizen proposal status fields --- CHANGELOG.md | 3 ++ ..._display.node.citizen_proposal.default.yml | 53 +++++++++++++++++-- ....citizen_proposal.citizen_proposal_add.yml | 6 +++ ...zen_proposal.citizen_proposal_approval.yml | 6 +++ ..._display.node.citizen_proposal.default.yml | 27 ++++++++++ ...lay.node.citizen_proposal.list_display.yml | 6 +++ ...w_display.node.citizen_proposal.teaser.yml | 6 +++ ...oposal.field_city_council_meeting_date.yml | 21 ++++++++ ...izen_proposal.field_status_description.yml | 24 +++++++++ ...de.citizen_proposal.field_status_title.yml | 19 +++++++ ...e.node.field_city_council_meeting_date.yml | 20 +++++++ ...field.storage.node.field_content_state.yml | 9 ++++ ....storage.node.field_status_description.yml | 19 +++++++ .../field.storage.node.field_status_title.yml | 21 ++++++++ 14 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml create mode 100644 config/sync/field.field.node.citizen_proposal.field_status_description.yml create mode 100644 config/sync/field.field.node.citizen_proposal.field_status_title.yml create mode 100644 config/sync/field.storage.node.field_city_council_meeting_date.yml create mode 100644 config/sync/field.storage.node.field_status_description.yml create mode 100644 config/sync/field.storage.node.field_status_title.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index d831c7f53..59f07a5f0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +* [PR-400](https://github.com/itk-dev/hoeringsportal/pull/400) + Citizen proposal status + ## [4.2.2] - 2024-04-10 * [PR-392](https://github.com/itk-dev/hoeringsportal/pull/392) diff --git a/config/sync/core.entity_form_display.node.citizen_proposal.default.yml b/config/sync/core.entity_form_display.node.citizen_proposal.default.yml index b23e4b8c2..780a3e83a 100644 --- a/config/sync/core.entity_form_display.node.citizen_proposal.default.yml +++ b/config/sync/core.entity_form_display.node.citizen_proposal.default.yml @@ -9,16 +9,19 @@ dependencies: - field.field.node.citizen_proposal.field_author_name - field.field.node.citizen_proposal.field_author_phone - field.field.node.citizen_proposal.field_author_uuid + - field.field.node.citizen_proposal.field_city_council_meeting_date - field.field.node.citizen_proposal.field_content_state - field.field.node.citizen_proposal.field_getorganized_case_id - field.field.node.citizen_proposal.field_more_info - field.field.node.citizen_proposal.field_proposal - field.field.node.citizen_proposal.field_remarks + - field.field.node.citizen_proposal.field_status_description + - field.field.node.citizen_proposal.field_status_title - field.field.node.citizen_proposal.field_vote_end - field.field.node.citizen_proposal.field_vote_start - node.type.citizen_proposal module: - - allowed_formats + - datetime - field_group - text third_party_settings: @@ -29,7 +32,7 @@ third_party_settings: label: GetOrganized region: content parent_name: '' - weight: 20 + weight: 10 format_type: details format_settings: classes: '' @@ -38,6 +41,23 @@ third_party_settings: open: true description: '' required_fields: true + group_status: + children: + - field_content_state + - field_city_council_meeting_date + - field_status_title + - field_status_description + label: status + region: content + parent_name: '' + weight: 11 + format_type: fieldset + format_settings: + classes: '' + show_empty_fields: false + id: '' + description: Hep-hey! + required_fields: true id: node.citizen_proposal.default targetEntityType: node bundle: citizen_proposal @@ -81,6 +101,18 @@ content: size: 60 placeholder: '' third_party_settings: { } + field_city_council_meeting_date: + type: datetime_default + weight: 29 + region: content + settings: { } + third_party_settings: { } + field_content_state: + type: options_select + weight: 28 + region: content + settings: { } + third_party_settings: { } field_getorganized_case_id: type: string_textfield weight: 26 @@ -122,6 +154,22 @@ content: allowed_formats: hide_help: '1' hide_guidelines: '1' + field_status_description: + type: text_textarea + weight: 31 + region: content + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + field_status_title: + type: string_textfield + weight: 30 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } status: type: boolean_checkbox weight: 9 @@ -140,7 +188,6 @@ content: hidden: created: true field_author_uuid: true - field_content_state: true field_vote_end: true field_vote_start: true langcode: true diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_add.yml b/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_add.yml index 4926e4467..b4b21745a 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_add.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_add.yml @@ -10,11 +10,14 @@ dependencies: - field.field.node.citizen_proposal.field_author_name - field.field.node.citizen_proposal.field_author_phone - field.field.node.citizen_proposal.field_author_uuid + - field.field.node.citizen_proposal.field_city_council_meeting_date - field.field.node.citizen_proposal.field_content_state - field.field.node.citizen_proposal.field_getorganized_case_id - field.field.node.citizen_proposal.field_more_info - field.field.node.citizen_proposal.field_proposal - field.field.node.citizen_proposal.field_remarks + - field.field.node.citizen_proposal.field_status_description + - field.field.node.citizen_proposal.field_status_title - field.field.node.citizen_proposal.field_vote_end - field.field.node.citizen_proposal.field_vote_start - node.type.citizen_proposal @@ -127,9 +130,12 @@ hidden: field_author_email_display: true field_author_phone: true field_author_uuid: true + field_city_council_meeting_date: true field_content_state: true field_getorganized_case_id: true field_more_info: true + field_status_description: true + field_status_title: true langcode: true links: true published_at: true diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_approval.yml b/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_approval.yml index c2d187ac7..4ef65d910 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_approval.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.citizen_proposal_approval.yml @@ -10,11 +10,14 @@ dependencies: - field.field.node.citizen_proposal.field_author_name - field.field.node.citizen_proposal.field_author_phone - field.field.node.citizen_proposal.field_author_uuid + - field.field.node.citizen_proposal.field_city_council_meeting_date - field.field.node.citizen_proposal.field_content_state - field.field.node.citizen_proposal.field_getorganized_case_id - field.field.node.citizen_proposal.field_more_info - field.field.node.citizen_proposal.field_proposal - field.field.node.citizen_proposal.field_remarks + - field.field.node.citizen_proposal.field_status_description + - field.field.node.citizen_proposal.field_status_title - field.field.node.citizen_proposal.field_vote_end - field.field.node.citizen_proposal.field_vote_start - node.type.citizen_proposal @@ -60,9 +63,12 @@ hidden: field_author_email_display: true field_author_phone: true field_author_uuid: true + field_city_council_meeting_date: true field_content_state: true field_getorganized_case_id: true field_more_info: true + field_status_description: true + field_status_title: true field_vote_end: true field_vote_start: true langcode: true diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.default.yml b/config/sync/core.entity_view_display.node.citizen_proposal.default.yml index 511c0b2db..b88f9a657 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.default.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.default.yml @@ -9,11 +9,14 @@ dependencies: - field.field.node.citizen_proposal.field_author_name - field.field.node.citizen_proposal.field_author_phone - field.field.node.citizen_proposal.field_author_uuid + - field.field.node.citizen_proposal.field_city_council_meeting_date - field.field.node.citizen_proposal.field_content_state - field.field.node.citizen_proposal.field_getorganized_case_id - field.field.node.citizen_proposal.field_more_info - field.field.node.citizen_proposal.field_proposal - field.field.node.citizen_proposal.field_remarks + - field.field.node.citizen_proposal.field_status_description + - field.field.node.citizen_proposal.field_status_title - field.field.node.citizen_proposal.field_vote_end - field.field.node.citizen_proposal.field_vote_start - node.type.citizen_proposal @@ -92,6 +95,15 @@ content: third_party_settings: { } weight: 4 region: left + field_city_council_meeting_date: + type: datetime_default + label: above + settings: + timezone_override: '' + format_type: medium + third_party_settings: { } + weight: 11 + region: content field_more_info: type: text_default label: above @@ -113,6 +125,21 @@ content: third_party_settings: { } weight: 3 region: left + field_status_description: + type: text_default + label: above + settings: { } + third_party_settings: { } + weight: 12 + region: content + field_status_title: + type: string + label: above + settings: + link_to_entity: false + third_party_settings: { } + weight: 13 + region: content field_vote_end: type: datetime_default label: above diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml b/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml index 1c22e46a7..d5545284d 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml @@ -10,11 +10,14 @@ dependencies: - field.field.node.citizen_proposal.field_author_name - field.field.node.citizen_proposal.field_author_phone - field.field.node.citizen_proposal.field_author_uuid + - field.field.node.citizen_proposal.field_city_council_meeting_date - field.field.node.citizen_proposal.field_content_state - field.field.node.citizen_proposal.field_getorganized_case_id - field.field.node.citizen_proposal.field_more_info - field.field.node.citizen_proposal.field_proposal - field.field.node.citizen_proposal.field_remarks + - field.field.node.citizen_proposal.field_status_description + - field.field.node.citizen_proposal.field_status_title - field.field.node.citizen_proposal.field_vote_end - field.field.node.citizen_proposal.field_vote_start - node.type.citizen_proposal @@ -117,6 +120,9 @@ hidden: field_author_email_display: true field_author_phone: true field_author_uuid: true + field_city_council_meeting_date: true field_content_state: true field_getorganized_case_id: true field_more_info: true + field_status_description: true + field_status_title: true diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.teaser.yml b/config/sync/core.entity_view_display.node.citizen_proposal.teaser.yml index f081829a8..17d58c687 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.teaser.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.teaser.yml @@ -10,11 +10,14 @@ dependencies: - field.field.node.citizen_proposal.field_author_name - field.field.node.citizen_proposal.field_author_phone - field.field.node.citizen_proposal.field_author_uuid + - field.field.node.citizen_proposal.field_city_council_meeting_date - field.field.node.citizen_proposal.field_content_state - field.field.node.citizen_proposal.field_getorganized_case_id - field.field.node.citizen_proposal.field_more_info - field.field.node.citizen_proposal.field_proposal - field.field.node.citizen_proposal.field_remarks + - field.field.node.citizen_proposal.field_status_description + - field.field.node.citizen_proposal.field_status_title - field.field.node.citizen_proposal.field_vote_end - field.field.node.citizen_proposal.field_vote_start - node.type.citizen_proposal @@ -57,10 +60,13 @@ hidden: field_author_email_display: true field_author_phone: true field_author_uuid: true + field_city_council_meeting_date: true field_getorganized_case_id: true field_more_info: true field_proposal: true field_remarks: true + field_status_description: true + field_status_title: true field_vote_start: true langcode: true links: true diff --git a/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml b/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml new file mode 100644 index 000000000..e2216e976 --- /dev/null +++ b/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml @@ -0,0 +1,21 @@ +uuid: 57aa2690-2319-4322-a864-f02ed06e6bfc +langcode: da +status: true +dependencies: + config: + - field.storage.node.field_city_council_meeting_date + - node.type.citizen_proposal + module: + - datetime +id: node.citizen_proposal.field_city_council_meeting_date +field_name: field_city_council_meeting_date +entity_type: node +bundle: citizen_proposal +label: 'city ​​council meeting date' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: datetime diff --git a/config/sync/field.field.node.citizen_proposal.field_status_description.yml b/config/sync/field.field.node.citizen_proposal.field_status_description.yml new file mode 100644 index 000000000..a1ecae2cb --- /dev/null +++ b/config/sync/field.field.node.citizen_proposal.field_status_description.yml @@ -0,0 +1,24 @@ +uuid: 823d579c-92db-486e-ae30-5024c66eb415 +langcode: da +status: true +dependencies: + config: + - field.storage.node.field_status_description + - filter.format.citizen_proposal_content + - node.type.citizen_proposal + module: + - text +id: node.citizen_proposal.field_status_description +field_name: field_status_description +entity_type: node +bundle: citizen_proposal +label: 'status description' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + allowed_formats: + - citizen_proposal_content +field_type: text_long diff --git a/config/sync/field.field.node.citizen_proposal.field_status_title.yml b/config/sync/field.field.node.citizen_proposal.field_status_title.yml new file mode 100644 index 000000000..3d2c6d88f --- /dev/null +++ b/config/sync/field.field.node.citizen_proposal.field_status_title.yml @@ -0,0 +1,19 @@ +uuid: 88c3e89e-5bc7-4da6-bb13-e96d95eb6bc1 +langcode: da +status: true +dependencies: + config: + - field.storage.node.field_status_title + - node.type.citizen_proposal +id: node.citizen_proposal.field_status_title +field_name: field_status_title +entity_type: node +bundle: citizen_proposal +label: 'status title' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/config/sync/field.storage.node.field_city_council_meeting_date.yml b/config/sync/field.storage.node.field_city_council_meeting_date.yml new file mode 100644 index 000000000..1efadf8d6 --- /dev/null +++ b/config/sync/field.storage.node.field_city_council_meeting_date.yml @@ -0,0 +1,20 @@ +uuid: a301f964-14c6-47dc-9329-c7dc70c7e2fb +langcode: da +status: true +dependencies: + module: + - datetime + - node +id: node.field_city_council_meeting_date +field_name: field_city_council_meeting_date +entity_type: node +type: datetime +settings: + datetime_type: date +module: datetime +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/field.storage.node.field_content_state.yml b/config/sync/field.storage.node.field_content_state.yml index 87d1c1e71..95cbdd1f3 100644 --- a/config/sync/field.storage.node.field_content_state.yml +++ b/config/sync/field.storage.node.field_content_state.yml @@ -20,6 +20,15 @@ settings: - value: finished label: Afsluttet + - + value: processing + label: Behandles + - + value: approved + label: Vedtaget + - + value: rejected + label: Afvist allowed_values_function: '' module: options locked: false diff --git a/config/sync/field.storage.node.field_status_description.yml b/config/sync/field.storage.node.field_status_description.yml new file mode 100644 index 000000000..c88d8031d --- /dev/null +++ b/config/sync/field.storage.node.field_status_description.yml @@ -0,0 +1,19 @@ +uuid: 99a50d53-4423-4aeb-8a49-e33f87268d4a +langcode: da +status: true +dependencies: + module: + - node + - text +id: node.field_status_description +field_name: field_status_description +entity_type: node +type: text_long +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/field.storage.node.field_status_title.yml b/config/sync/field.storage.node.field_status_title.yml new file mode 100644 index 000000000..58b90a28f --- /dev/null +++ b/config/sync/field.storage.node.field_status_title.yml @@ -0,0 +1,21 @@ +uuid: 6132eb84-4290-493d-bde3-a264d69fa28e +langcode: da +status: true +dependencies: + module: + - node +id: node.field_status_title +field_name: field_status_title +entity_type: node +type: string +settings: + max_length: 255 + case_sensitive: false + is_ascii: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false From c51ebd5eeabd867c3a7dc06cad06beba1ba0aa3c Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Tue, 23 Apr 2024 15:10:50 +0200 Subject: [PATCH 2/9] Create fixtures for citizen proposal status --- .../src/Fixture/CitizenProposalFixture.php | 104 +++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php b/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php index e1f503651..76893305f 100644 --- a/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php +++ b/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php @@ -17,6 +17,7 @@ use Drupal\node\NodeInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Yaml\Yaml; +use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; /** * Page fixture. @@ -25,6 +26,10 @@ */ class CitizenProposalFixture extends AbstractFixture implements DependentFixtureInterface, FixtureGroupInterface { + const CONTENT_STATE_REJECTED = 'rejected'; + const CONTENT_STATE_APPROVED = 'approved'; + const CONTENT_STATE_PROCESSING = 'processing'; + /** * Constructor. */ @@ -114,7 +119,7 @@ public function load() { 'status' => NodeInterface::NOT_PUBLISHED, 'field_author_uuid' => '3333', 'field_author_name' => 'Hexia De Trick', - 'field_author_email' => 'givmiglykkemønten@itkdev.dk', + 'field_author_email' => 'hexia@itkdev.dk', 'field_content_state' => 'active', 'field_proposal' => [ 'value' => $this->baseFixtureHelper->getText('filteredHtmlLong.html'), @@ -128,6 +133,103 @@ public function load() { $entity->save(); $this->addReference('node:citizen_proposal:Proposal3', $entity); + // Rejected citizen proposal + $entity = Node::create([ + 'type' => 'citizen_proposal', + 'title' => 'Afvist borgerforslag', + 'status' => NodeInterface::PUBLISHED, + 'field_author_uuid' => '3333', + 'field_getorganized_case_id' => '0', + 'field_author_name' => 'Hexia De Trick', + 'field_author_email' => 'hexia@itkdev.dk', + 'field_status_title' => 'Dette er en status title', + 'field_city_council_meeting_date' => (new DrupalDateTime('tomorrow +2 months'))->format(DateTimeItemInterface::DATE_STORAGE_FORMAT), + 'field_status_description' => [ + 'value' => 'Dette er en status description test. Curabitur elit est, tincidunt ac tempor eget, mattis sit amet lectus. Nullam pharetra sollicitudin ex vel tincidunt.', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_proposal' => [ + 'value' => 'Her kommer teksten som en streng', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_remarks' => [ + 'value' => 'Her kommer teksten som en streng', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_more_info' => 'Dette kan du få af vide. Nullam placerat risus ac magna congue feugiat. Suspendisse sed arcu eget massa accumsan maximus ac feugiat nunc.', + ]); + $entity->save(); + $entity->field_content_state->setValue(self::CONTENT_STATE_REJECTED); + $entity->save(); + + // Add support (Do not set this to a too large a number!) + for ($i = 0; $i < 1; $i++) { + $this->helper->saveSupport(uniqid('', TRUE), $entity, ['user_name' => self::class]); + } + + // Approved citizen proposal + $entity = Node::create([ + 'type' => 'citizen_proposal', + 'title' => 'Godkendt borgerforslag', + 'status' => NodeInterface::PUBLISHED, + 'field_author_uuid' => '3333', + 'field_getorganized_case_id' => '0', + 'field_author_name' => 'Hexia De Trick', + 'field_author_email' => 'hexia@itkdev.dk', + 'field_status_title' => 'Dette er en status title', + 'field_city_council_meeting_date' => (new DrupalDateTime('tomorrow +2 months'))->format(DateTimeItemInterface::DATE_STORAGE_FORMAT), + 'field_status_description' => [ + 'value' => 'Dette er en status description test. Curabitur elit est, tincidunt ac tempor eget, mattis sit amet lectus. Nullam pharetra sollicitudin ex vel tincidunt.', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_proposal' => [ + 'value' => 'Her kommer teksten som en streng', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_remarks' => [ + 'value' => 'Her kommer teksten som en streng', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_more_info' => 'Dette kan du få af vide. Nullam placerat risus ac magna congue feugiat. Suspendisse sed arcu eget massa accumsan maximus ac feugiat nunc.', + ]); + $entity->save(); + $entity->field_content_state->setValue(self::CONTENT_STATE_APPROVED); + $entity->save(); + + // Add support (Do not set this to a too large a number!) + for ($i = 0; $i < 2; $i++) { + $this->helper->saveSupport(uniqid('', TRUE), $entity, ['user_name' => self::class]); + } + + // Processing citizen proposal + $entity = Node::create([ + 'type' => 'citizen_proposal', + 'title' => 'Borgerforslag behandles', + 'status' => NodeInterface::PUBLISHED, + 'field_author_uuid' => '3333', + 'field_getorganized_case_id' => '0', + 'field_author_name' => 'Hexia De Trick', + 'field_author_email' => 'hexia@itkdev.dk', + 'field_city_council_meeting_date' => (new DrupalDateTime('tomorrow +2 months'))->format(DateTimeItemInterface::DATE_STORAGE_FORMAT), + 'field_proposal' => [ + 'value' => 'Her kommer teksten som en streng', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_remarks' => [ + 'value' => 'Her kommer teksten som en streng', + 'format' => ProposalFormBase::CONTENT_TEXT_FORMAT, + ], + 'field_more_info' => 'Dette kan du få af vide. Nullam placerat risus ac magna congue feugiat. Suspendisse sed arcu eget massa accumsan maximus ac feugiat nunc.', + ]); + $entity->save(); + $entity->field_content_state->setValue(self::CONTENT_STATE_PROCESSING); + $entity->save(); + + // Add support (Do not set this to a too large a number!) + for ($i = 0; $i < 3; $i++) { + $this->helper->saveSupport(uniqid('', TRUE), $entity, ['user_name' => self::class]); + } + // Set admin values. $data = Yaml::parseFile(__DIR__ . '/CitizenProposalFixture/citizen_proposal_admin_form_values.yaml'); if (isset($data['citizen_proposal_admin_form_values'])) { From f910a50bda05b9c4445b2e9ef8e0b2fc7b2990fa Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Tue, 23 Apr 2024 15:11:26 +0200 Subject: [PATCH 3/9] Create template for showing status on details page. --- .../assets/css/module/_status-messages.scss | 38 ++++++++++++++++ .../custom/hoeringsportal/assets/js/icons.js | 8 +++- ...l-stacked--node-citizen-proposal.html.twig | 43 +++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss b/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss index 3776975a2..1cced5dd2 100755 --- a/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss +++ b/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss @@ -1,3 +1,41 @@ .status-messages .placeholder { background-color: transparent; } + +.alert { + &.alert-warning { + background-color: #FEFCE9; + color: #563310; + + svg { + color: #FACD34; + } + } + + &.alert-success { + background-color: #F0FDF4; + color: #1A5631; + + svg { + color: #15AC4E; + } + } + + &.alert-info { + background-color: #EFF6FF; + color: #244DC1; + + svg { + color: #2A81EC; + } + } + + &.alert-light { + background-color: #F5F5F5; + color: #333333; + + p:last-of-type { + margin-bottom: 0; + } + } +} diff --git a/web/themes/custom/hoeringsportal/assets/js/icons.js b/web/themes/custom/hoeringsportal/assets/js/icons.js index 4afa1a32e..648e1d990 100644 --- a/web/themes/custom/hoeringsportal/assets/js/icons.js +++ b/web/themes/custom/hoeringsportal/assets/js/icons.js @@ -14,7 +14,9 @@ import { faSearch, faTimes, faCopy, - faPrint + faPrint, + faTriangleExclamation, + faCircleCheck } from '@fortawesome/free-solid-svg-icons' // Import icons from the free brands package @@ -48,5 +50,7 @@ library.add( faReddit, faEvernote, faCopy, - faPrint + faPrint, + faTriangleExclamation, + faCircleCheck ) diff --git a/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig b/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig index e32a0d717..c838def4e 100755 --- a/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig +++ b/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig @@ -36,6 +36,49 @@
<{{ left_wrapper }}{{ left_attributes.addClass('content group-left col-md-8') }}>
+ + {# Status message rejected #} + {% if node.field_content_state.value == 'rejected' %} + + {% endif %} + + {# Status message approved #} + {% if node.field_content_state.value == 'approved' %} + + {% endif %} + + {# Status message processing #} + {% if node.field_content_state.value == 'processing' %} + + {% endif %} + + {# Status explanation #} + {% if node.field_status_title.value or node.field_status_description.value %} + + {% endif %} +
{{ left['dynamic_block_field:node-citizen_proposal_support_counter'] }}
From 8718f7b946280518071a4a74de720eb66a3ded48 Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Tue, 23 Apr 2024 15:26:16 +0200 Subject: [PATCH 4/9] Apply coding standards and update changelog --- CHANGELOG.md | 2 ++ .../src/Fixture/CitizenProposalFixture.php | 8 ++++---- .../ds/ds-2col-stacked--node-citizen-proposal.html.twig | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59f07a5f0..db4741fcc 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +* [PR-400](https://github.com/itk-dev/hoeringsportal/pull/401) + Citizen proposal status fixtures and template * [PR-400](https://github.com/itk-dev/hoeringsportal/pull/400) Citizen proposal status diff --git a/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php b/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php index 76893305f..2f4909f8c 100644 --- a/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php +++ b/web/modules/custom/hoeringsportal_citizen_proposal/modules/hoeringsportal_citizen_proposal_fixtures/src/Fixture/CitizenProposalFixture.php @@ -6,6 +6,7 @@ use Drupal\content_fixtures\Fixture\DependentFixtureInterface; use Drupal\content_fixtures\Fixture\FixtureGroupInterface; use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; use Drupal\hoeringsportal_base_fixtures\Fixture\MediaFixture; use Drupal\hoeringsportal_base_fixtures\Fixture\ParagraphFixture; use Drupal\hoeringsportal_base_fixtures\Helper\Helper as BaseFixtureHelper; @@ -17,7 +18,6 @@ use Drupal\node\NodeInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Yaml\Yaml; -use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; /** * Page fixture. @@ -133,7 +133,7 @@ public function load() { $entity->save(); $this->addReference('node:citizen_proposal:Proposal3', $entity); - // Rejected citizen proposal + // Rejected citizen proposal. $entity = Node::create([ 'type' => 'citizen_proposal', 'title' => 'Afvist borgerforslag', @@ -167,7 +167,7 @@ public function load() { $this->helper->saveSupport(uniqid('', TRUE), $entity, ['user_name' => self::class]); } - // Approved citizen proposal + // Approved citizen proposal. $entity = Node::create([ 'type' => 'citizen_proposal', 'title' => 'Godkendt borgerforslag', @@ -201,7 +201,7 @@ public function load() { $this->helper->saveSupport(uniqid('', TRUE), $entity, ['user_name' => self::class]); } - // Processing citizen proposal + // Processing citizen proposal. $entity = Node::create([ 'type' => 'citizen_proposal', 'title' => 'Borgerforslag behandles', diff --git a/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig b/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig index c838def4e..bcb950982 100755 --- a/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig +++ b/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig @@ -43,7 +43,7 @@

{{ 'Rejected by the council'|t }}

-

{{ 'The proposal was rejected at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value }) }}

+

{{ 'The proposal was rejected at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value}) }}

{% endif %} @@ -54,7 +54,7 @@

{{ 'Approved by the council'|t }}

-

{{ 'The proposal was approved at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value }) }}

+

{{ 'The proposal was approved at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value}) }}

{% endif %} @@ -65,7 +65,7 @@

{{ 'The proposal is beeing processed'|t }}

-

{{ 'The proposal will be proccessed at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value }) }}

+

{{ 'The proposal will be proccessed at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value}) }}

{% endif %} @@ -75,7 +75,7 @@ {% endif %} From ff14c87809230a194437db59ee7a5cba17f08235 Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Tue, 23 Apr 2024 15:33:31 +0200 Subject: [PATCH 5/9] Config export --- ..._display.node.citizen_proposal.default.yml | 4 +-- ..._display.node.citizen_proposal.default.yml | 35 ++++++++++--------- config/sync/core.extension.yml | 4 +++ ...oposal.field_city_council_meeting_date.yml | 4 +-- ...izen_proposal.field_status_description.yml | 4 +-- ...de.citizen_proposal.field_status_title.yml | 4 +-- 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/config/sync/core.entity_form_display.node.citizen_proposal.default.yml b/config/sync/core.entity_form_display.node.citizen_proposal.default.yml index 780a3e83a..c5f33453d 100644 --- a/config/sync/core.entity_form_display.node.citizen_proposal.default.yml +++ b/config/sync/core.entity_form_display.node.citizen_proposal.default.yml @@ -47,7 +47,7 @@ third_party_settings: - field_city_council_meeting_date - field_status_title - field_status_description - label: status + label: Status region: content parent_name: '' weight: 11 @@ -56,7 +56,7 @@ third_party_settings: classes: '' show_empty_fields: false id: '' - description: Hep-hey! + description: 'Used to set a status for the proposal.' required_fields: true id: node.citizen_proposal.default targetEntityType: node diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.default.yml b/config/sync/core.entity_view_display.node.citizen_proposal.default.yml index b88f9a657..a83969f6f 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.default.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.default.yml @@ -49,6 +49,9 @@ third_party_settings: header: - node_title left: + - field_city_council_meeting_date + - field_status_description + - field_status_title - 'dynamic_block_field:node-citizen_proposal_support_counter' - field_proposal - field_remarks @@ -62,7 +65,7 @@ third_party_settings: fields: 'dynamic_block_field:node-citizen_proposal_support_counter': plugin_id: 'dynamic_block_field:node-citizen_proposal_support_counter' - weight: 1 + weight: 4 label: hidden formatter: default node_title: @@ -85,7 +88,7 @@ content: label: above settings: { } third_party_settings: { } - weight: 5 + weight: 8 region: left field_author_name: type: string @@ -93,7 +96,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 4 + weight: 7 region: left field_city_council_meeting_date: type: datetime_default @@ -102,44 +105,44 @@ content: timezone_override: '' format_type: medium third_party_settings: { } - weight: 11 - region: content + weight: 1 + region: left field_more_info: type: text_default label: above settings: { } third_party_settings: { } - weight: 10 + weight: 12 region: right field_proposal: type: text_default label: above settings: { } third_party_settings: { } - weight: 2 + weight: 5 region: left field_remarks: type: text_default label: above settings: { } third_party_settings: { } - weight: 3 + weight: 6 region: left field_status_description: type: text_default - label: above + label: hidden settings: { } third_party_settings: { } - weight: 12 - region: content + weight: 2 + region: left field_status_title: type: string label: above settings: link_to_entity: false third_party_settings: { } - weight: 13 - region: content + weight: 3 + region: left field_vote_end: type: datetime_default label: above @@ -147,7 +150,7 @@ content: timezone_override: '' format_type: hoeringsportal_date third_party_settings: { } - weight: 8 + weight: 10 region: right field_vote_start: type: datetime_default @@ -156,12 +159,12 @@ content: timezone_override: '' format_type: hoeringsportal_date third_party_settings: { } - weight: 7 + weight: 9 region: right sharing_buttons: settings: { } third_party_settings: { } - weight: 9 + weight: 11 region: right hidden: field_author_allow_email: true diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 56d652a2e..c0ae5fec3 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -16,6 +16,7 @@ module: config: 0 config_ignore: 0 config_import_locale: 0 + content_fixtures: 0 crop: 0 csv_serialization: 0 ctools: 0 @@ -38,8 +39,10 @@ module: field_ui: 0 file: 0 filter: 0 + hoeringsportal_base_fixtures: 0 hoeringsportal_citizen_proposal: 0 hoeringsportal_citizen_proposal_archiving: 0 + hoeringsportal_citizen_proposal_fixtures: 0 hoeringsportal_config_settings: 0 hoeringsportal_content_access: 0 hoeringsportal_content_blocks: 0 @@ -47,6 +50,7 @@ module: hoeringsportal_deskpro: 0 hoeringsportal_forms: 0 hoeringsportal_hearing: 0 + hoeringsportal_hearing_fixtures: 0 hoeringsportal_openid_connect: 0 hoeringsportal_project_timeline: 0 hoeringsportal_public_meeting: 0 diff --git a/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml b/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml index e2216e976..5c3be4861 100644 --- a/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml +++ b/config/sync/field.field.node.citizen_proposal.field_city_council_meeting_date.yml @@ -11,8 +11,8 @@ id: node.citizen_proposal.field_city_council_meeting_date field_name: field_city_council_meeting_date entity_type: node bundle: citizen_proposal -label: 'city ​​council meeting date' -description: '' +label: 'City ​​council meeting date' +description: 'Used to set the date for the when the council will process the proposal on a city council meeting.' required: false translatable: false default_value: { } diff --git a/config/sync/field.field.node.citizen_proposal.field_status_description.yml b/config/sync/field.field.node.citizen_proposal.field_status_description.yml index a1ecae2cb..f0b1fb281 100644 --- a/config/sync/field.field.node.citizen_proposal.field_status_description.yml +++ b/config/sync/field.field.node.citizen_proposal.field_status_description.yml @@ -12,8 +12,8 @@ id: node.citizen_proposal.field_status_description field_name: field_status_description entity_type: node bundle: citizen_proposal -label: 'status description' -description: '' +label: 'Status description' +description: 'Used to show a description for the explanation of the status.' required: false translatable: false default_value: { } diff --git a/config/sync/field.field.node.citizen_proposal.field_status_title.yml b/config/sync/field.field.node.citizen_proposal.field_status_title.yml index 3d2c6d88f..4b9e6b859 100644 --- a/config/sync/field.field.node.citizen_proposal.field_status_title.yml +++ b/config/sync/field.field.node.citizen_proposal.field_status_title.yml @@ -9,8 +9,8 @@ id: node.citizen_proposal.field_status_title field_name: field_status_title entity_type: node bundle: citizen_proposal -label: 'status title' -description: '' +label: 'Status title' +description: 'Used to show a title for the explanation of the status.' required: false translatable: false default_value: { } From 3227a615d6964aa2b3811c80d924032b96db74d5 Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Tue, 23 Apr 2024 16:08:04 +0200 Subject: [PATCH 6/9] Add status badge to list view --- ...lay.node.citizen_proposal.list_display.yml | 27 ++++++++++++------- .../assets/css/module/_status-messages.scss | 3 ++- .../custom/hoeringsportal/assets/js/icons.js | 6 +++-- .../node--citizen-proposal--teaser.html.twig | 16 ++++++++++- ...l-stacked--node-citizen-proposal.html.twig | 2 +- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml b/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml index d5545284d..280712b26 100644 --- a/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml +++ b/config/sync/core.entity_view_display.node.citizen_proposal.list_display.yml @@ -23,6 +23,7 @@ dependencies: - node.type.citizen_proposal module: - datetime + - options - text - user id: node.citizen_proposal.list_display @@ -35,7 +36,7 @@ content: label: above settings: { } third_party_settings: { } - weight: 103 + weight: 6 region: content field_author_name: type: string @@ -43,21 +44,28 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 104 + weight: 7 + region: content + field_content_state: + type: list_default + label: hidden + settings: { } + third_party_settings: { } + weight: 10 region: content field_proposal: type: text_default label: above settings: { } third_party_settings: { } - weight: 105 + weight: 8 region: content field_remarks: type: text_default label: above settings: { } third_party_settings: { } - weight: 106 + weight: 9 region: content field_vote_end: type: datetime_default @@ -66,7 +74,7 @@ content: timezone_override: '' format_type: medium third_party_settings: { } - weight: 102 + weight: 5 region: content field_vote_start: type: datetime_default @@ -75,7 +83,7 @@ content: timezone_override: '' format_type: medium third_party_settings: { } - weight: 101 + weight: 4 region: content langcode: type: language @@ -89,7 +97,7 @@ content: links: settings: { } third_party_settings: { } - weight: 100 + weight: 3 region: content published_at: type: timestamp @@ -108,12 +116,12 @@ content: granularity: 2 refresh: 60 third_party_settings: { } - weight: 0 + weight: 1 region: content sharing_buttons: settings: { } third_party_settings: { } - weight: 100 + weight: 2 region: content hidden: field_author_allow_email: true @@ -121,7 +129,6 @@ hidden: field_author_phone: true field_author_uuid: true field_city_council_meeting_date: true - field_content_state: true field_getorganized_case_id: true field_more_info: true field_status_description: true diff --git a/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss b/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss index 1cced5dd2..00c25d27f 100755 --- a/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss +++ b/web/themes/custom/hoeringsportal/assets/css/module/_status-messages.scss @@ -2,7 +2,8 @@ background-color: transparent; } -.alert { +.alert, +.badge { &.alert-warning { background-color: #FEFCE9; color: #563310; diff --git a/web/themes/custom/hoeringsportal/assets/js/icons.js b/web/themes/custom/hoeringsportal/assets/js/icons.js index 648e1d990..1bfbdeb67 100644 --- a/web/themes/custom/hoeringsportal/assets/js/icons.js +++ b/web/themes/custom/hoeringsportal/assets/js/icons.js @@ -16,7 +16,8 @@ import { faCopy, faPrint, faTriangleExclamation, - faCircleCheck + faCircleCheck, + faCircleInfo } from '@fortawesome/free-solid-svg-icons' // Import icons from the free brands package @@ -52,5 +53,6 @@ library.add( faCopy, faPrint, faTriangleExclamation, - faCircleCheck + faCircleCheck, + faCircleInfo ) diff --git a/web/themes/custom/hoeringsportal/templates/content/node--citizen-proposal--teaser.html.twig b/web/themes/custom/hoeringsportal/templates/content/node--citizen-proposal--teaser.html.twig index 26cc68224..e643be1a3 100755 --- a/web/themes/custom/hoeringsportal/templates/content/node--citizen-proposal--teaser.html.twig +++ b/web/themes/custom/hoeringsportal/templates/content/node--citizen-proposal--teaser.html.twig @@ -79,7 +79,21 @@

{{ label[0]['#context'].value|length > 40 ? label[0]['#context'].value|slice(0, 40) ~ '...' : label }}

-
{{ 'End date'|t }}:{{ voteEnd|date('d M. Y') }}
+ {% if node.field_content_state.value == 'rejected' %} + + {{ 'Rejected'|t }} + + {% elseif node.field_content_state.value == 'approved' %} + + {{ 'Approved'|t }} + + {% elseif node.field_content_state.value == 'processing' %} + + {{ 'Processing'|t }} + + {% else %} +
{{ 'End date'|t }}:{{ voteEnd|date('d M. Y') }}
+ {% endif %}
{% include 'citizen-proposal-support-counter.html.twig' with {data: { diff --git a/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig b/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig index bcb950982..becc2e729 100755 --- a/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig +++ b/web/themes/custom/hoeringsportal/templates/ds/ds-2col-stacked--node-citizen-proposal.html.twig @@ -62,7 +62,7 @@ {# Status message processing #} {% if node.field_content_state.value == 'processing' %} {% endif %} @@ -65,7 +65,7 @@

{{ 'The proposal is beeing processed'|t }}

-

{{ 'The proposal will be proccessed at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value}) }}

+

{{ 'The proposal will be proccessed at the citycouncil meeting @meeting_date'|t({'@meeting_date': node.field_city_council_meeting_date.value|date('U')|format_date('hoeringsportal_date')}) }}

{% endif %} @@ -73,7 +73,7 @@ {# Status explanation #} {% if node.field_status_title.value or node.field_status_description.value %}