decidim-enhanced_textwork 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +64 -0
- data/Rakefile +3 -0
- data/app/cells/decidim/enhanced_textwork/amendment/show.erb +14 -0
- data/app/cells/decidim/enhanced_textwork/amendment_cell.rb +39 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_draft_cell.rb +49 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_draft_link_to_paragraph/show.erb +13 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_draft_link_to_paragraph_cell.rb +57 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_draft_m/footer.erb +6 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_draft_m/tags.erb +1 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_draft_m_cell.rb +44 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_drafts/reported_content/show.erb +3 -0
- data/app/cells/decidim/enhanced_textwork/collaborative_drafts/reported_content_cell.rb +15 -0
- data/app/cells/decidim/enhanced_textwork/comments/show.erb +33 -0
- data/app/cells/decidim/enhanced_textwork/comments_cell.rb +8 -0
- data/app/cells/decidim/enhanced_textwork/content_blocks/highlighted_paragraphs/elements.erb +5 -0
- data/app/cells/decidim/enhanced_textwork/content_blocks/highlighted_paragraphs/heading.erb +1 -0
- data/app/cells/decidim/enhanced_textwork/content_blocks/highlighted_paragraphs_cell.rb +19 -0
- data/app/cells/decidim/enhanced_textwork/cost_report/show.erb +35 -0
- data/app/cells/decidim/enhanced_textwork/cost_report_cell.rb +42 -0
- data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs/show.erb +3 -0
- data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs_cell.rb +25 -0
- data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs_for_component/show.erb +19 -0
- data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs_for_component_cell.rb +41 -0
- data/app/cells/decidim/enhanced_textwork/irreversible_action_modal/show.erb +27 -0
- data/app/cells/decidim/enhanced_textwork/irreversible_action_modal_cell.rb +80 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_activity_cell.rb +35 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_cell.rb +53 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_link_to_collaborative_draft_cell.rb +26 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_link_to_rejected_emendation/show.erb +9 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_link_to_rejected_emendation_cell.rb +34 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_linked_resources/show.erb +9 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_linked_resources_cell.rb +14 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_m/footer.erb +26 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_m/tags.erb +1 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_m_cell.rb +152 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_tags/show.erb +33 -0
- data/app/cells/decidim/enhanced_textwork/paragraph_tags_cell.rb +35 -0
- data/app/cells/decidim/enhanced_textwork/paragraphs_picker/paragraphs.erb +12 -0
- data/app/cells/decidim/enhanced_textwork/paragraphs_picker/show.erb +14 -0
- data/app/cells/decidim/enhanced_textwork/paragraphs_picker_cell.rb +72 -0
- data/app/cells/decidim/enhanced_textwork/participatory_text_paragraph/buttons.erb +33 -0
- data/app/cells/decidim/enhanced_textwork/participatory_text_paragraph/show.erb +38 -0
- data/app/cells/decidim/enhanced_textwork/participatory_text_paragraph_cell.rb +104 -0
- data/app/cells/decidim/enhanced_textwork/reported_content/show.erb +4 -0
- data/app/cells/decidim/enhanced_textwork/reported_content_cell.rb +13 -0
- data/app/commands/decidim/enhanced_textwork/accept_access_to_collaborative_draft.rb +70 -0
- data/app/commands/decidim/enhanced_textwork/admin/answer_paragraph.rb +74 -0
- data/app/commands/decidim/enhanced_textwork/admin/assign_paragraphs_to_valuator.rb +61 -0
- data/app/commands/decidim/enhanced_textwork/admin/create_paragraph.rb +97 -0
- data/app/commands/decidim/enhanced_textwork/admin/create_paragraph_note.rb +67 -0
- data/app/commands/decidim/enhanced_textwork/admin/destroy_paragraph.rb +32 -0
- data/app/commands/decidim/enhanced_textwork/admin/discard_participatory_text.rb +40 -0
- data/app/commands/decidim/enhanced_textwork/admin/import_from_editor_participatory_text.rb +53 -0
- data/app/commands/decidim/enhanced_textwork/admin/import_paragraphs.rb +101 -0
- data/app/commands/decidim/enhanced_textwork/admin/import_participatory_text.rb +55 -0
- data/app/commands/decidim/enhanced_textwork/admin/merge_paragraphs.rb +69 -0
- data/app/commands/decidim/enhanced_textwork/admin/notify_paragraph_answer.rb +85 -0
- data/app/commands/decidim/enhanced_textwork/admin/publish_answers.rb +67 -0
- data/app/commands/decidim/enhanced_textwork/admin/publish_participatory_text.rb +81 -0
- data/app/commands/decidim/enhanced_textwork/admin/split_paragraphs.rb +67 -0
- data/app/commands/decidim/enhanced_textwork/admin/unassign_paragraphs_from_valuator.rb +62 -0
- data/app/commands/decidim/enhanced_textwork/admin/update_paragraph.rb +86 -0
- data/app/commands/decidim/enhanced_textwork/admin/update_paragraph_category.rb +68 -0
- data/app/commands/decidim/enhanced_textwork/admin/update_paragraph_scope.rb +75 -0
- data/app/commands/decidim/enhanced_textwork/admin/update_participatory_text.rb +68 -0
- data/app/commands/decidim/enhanced_textwork/create_collaborative_draft.rb +81 -0
- data/app/commands/decidim/enhanced_textwork/create_paragraph.rb +106 -0
- data/app/commands/decidim/enhanced_textwork/destroy_paragraph.rb +33 -0
- data/app/commands/decidim/enhanced_textwork/gallery_methods.rb +18 -0
- data/app/commands/decidim/enhanced_textwork/hashtags_methods.rb +36 -0
- data/app/commands/decidim/enhanced_textwork/publish_collaborative_draft.rb +93 -0
- data/app/commands/decidim/enhanced_textwork/publish_paragraph.rb +105 -0
- data/app/commands/decidim/enhanced_textwork/reject_access_to_collaborative_draft.rb +62 -0
- data/app/commands/decidim/enhanced_textwork/request_access_to_collaborative_draft.rb +49 -0
- data/app/commands/decidim/enhanced_textwork/unvote_paragraph.rb +65 -0
- data/app/commands/decidim/enhanced_textwork/update_collaborative_draft.rb +63 -0
- data/app/commands/decidim/enhanced_textwork/update_paragraph.rb +135 -0
- data/app/commands/decidim/enhanced_textwork/vote_paragraph.rb +77 -0
- data/app/commands/decidim/enhanced_textwork/withdraw_collaborative_draft.rb +65 -0
- data/app/commands/decidim/enhanced_textwork/withdraw_paragraph.rb +50 -0
- data/app/controllers/concerns/decidim/enhanced_textwork/admin/filterable.rb +82 -0
- data/app/controllers/concerns/decidim/enhanced_textwork/admin/picker.rb +21 -0
- data/app/controllers/concerns/decidim/enhanced_textwork/collaborative_orderable.rb +42 -0
- data/app/controllers/concerns/decidim/enhanced_textwork/orderable.rb +78 -0
- data/app/controllers/decidim/enhanced_textwork/admin/application_controller.rb +16 -0
- data/app/controllers/decidim/enhanced_textwork/admin/paragraph_answers_controller.rb +50 -0
- data/app/controllers/decidim/enhanced_textwork/admin/paragraph_notes_controller.rb +39 -0
- data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_controller.rb +237 -0
- data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_imports_controller.rb +33 -0
- data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_merges_controller.rb +30 -0
- data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_splits_controller.rb +30 -0
- data/app/controllers/decidim/enhanced_textwork/admin/participatory_texts_controller.rb +128 -0
- data/app/controllers/decidim/enhanced_textwork/admin/valuation_assignments_controller.rb +58 -0
- data/app/controllers/decidim/enhanced_textwork/application_controller.rb +31 -0
- data/app/controllers/decidim/enhanced_textwork/collaborative_draft_collaborator_requests_controller.rb +53 -0
- data/app/controllers/decidim/enhanced_textwork/collaborative_drafts_controller.rb +161 -0
- data/app/controllers/decidim/enhanced_textwork/paragraph_votes_controller.rb +65 -0
- data/app/controllers/decidim/enhanced_textwork/paragraphs_controller.rb +316 -0
- data/app/controllers/decidim/enhanced_textwork/versions_controller.rb +21 -0
- data/app/controllers/decidim/enhanced_textwork/widgets_controller.rb +19 -0
- data/app/events/decidim/enhanced_textwork/accepted_paragraph_event.rb +17 -0
- data/app/events/decidim/enhanced_textwork/admin/paragraph_note_created_event.rb +27 -0
- data/app/events/decidim/enhanced_textwork/admin/update_paragraph_category_event.rb +11 -0
- data/app/events/decidim/enhanced_textwork/admin/update_paragraph_scope_event.rb +11 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_access_accepted_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_access_rejected_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_access_request_event.rb +27 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_access_requested_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_access_requester_accepted_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_access_requester_rejected_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/collaborative_draft_withdrawn_event.rb +29 -0
- data/app/events/decidim/enhanced_textwork/creation_enabled_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/endorsing_enabled_event.rb +8 -0
- data/app/events/decidim/enhanced_textwork/evaluating_paragraph_event.rb +11 -0
- data/app/events/decidim/enhanced_textwork/paragraph_endorsed_event.rb +33 -0
- data/app/events/decidim/enhanced_textwork/paragraph_mentioned_event.rb +21 -0
- data/app/events/decidim/enhanced_textwork/publish_paragraph_event.rb +25 -0
- data/app/events/decidim/enhanced_textwork/rejected_paragraph_event.rb +17 -0
- data/app/events/decidim/enhanced_textwork/voting_enabled_event.rb +8 -0
- data/app/forms/decidim/enhanced_textwork/accept_access_to_collaborative_draft_form.rb +10 -0
- data/app/forms/decidim/enhanced_textwork/access_to_collaborative_draft_form.rb +33 -0
- data/app/forms/decidim/enhanced_textwork/admin/import_editor_participatory_text_form.rb +35 -0
- data/app/forms/decidim/enhanced_textwork/admin/import_participatory_text_form.rb +68 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraph_answer_form.rb +44 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraph_base_form.rb +137 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraph_form.rb +32 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraph_note_form.rb +16 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraphs_fork_form.rb +63 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraphs_import_form.rb +67 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraphs_merge_form.rb +13 -0
- data/app/forms/decidim/enhanced_textwork/admin/paragraphs_split_form.rb +12 -0
- data/app/forms/decidim/enhanced_textwork/admin/participatory_text_paragraph_form.rb +20 -0
- data/app/forms/decidim/enhanced_textwork/admin/preview_participatory_text_form.rb +21 -0
- data/app/forms/decidim/enhanced_textwork/admin/valuation_assignment_form.rb +37 -0
- data/app/forms/decidim/enhanced_textwork/collaborative_draft_form.rb +20 -0
- data/app/forms/decidim/enhanced_textwork/paragraph_form.rb +126 -0
- data/app/forms/decidim/enhanced_textwork/paragraph_wizard_create_step_form.rb +41 -0
- data/app/forms/decidim/enhanced_textwork/reject_access_to_collaborative_draft_form.rb +9 -0
- data/app/forms/decidim/enhanced_textwork/request_access_to_collaborative_draft_form.rb +20 -0
- data/app/helpers/decidim/enhanced_textwork/admin/filterable_helper.rb +17 -0
- data/app/helpers/decidim/enhanced_textwork/admin/paragraph_bulk_actions_helper.rb +35 -0
- data/app/helpers/decidim/enhanced_textwork/admin/paragraph_rankings_helper.rb +63 -0
- data/app/helpers/decidim/enhanced_textwork/admin/paragraphs_helper.rb +144 -0
- data/app/helpers/decidim/enhanced_textwork/admin/paragraphs_picker_helper.rb +30 -0
- data/app/helpers/decidim/enhanced_textwork/application_helper.rb +191 -0
- data/app/helpers/decidim/enhanced_textwork/collaborative_draft_cells_helper.rb +48 -0
- data/app/helpers/decidim/enhanced_textwork/collaborative_draft_helper.rb +29 -0
- data/app/helpers/decidim/enhanced_textwork/control_version_helper.rb +12 -0
- data/app/helpers/decidim/enhanced_textwork/map_helper.rb +48 -0
- data/app/helpers/decidim/enhanced_textwork/paragraph_cells_helper.rb +75 -0
- data/app/helpers/decidim/enhanced_textwork/paragraph_votes_helper.rb +103 -0
- data/app/helpers/decidim/enhanced_textwork/paragraph_wizard_helper.rb +140 -0
- data/app/helpers/decidim/enhanced_textwork/paragraphs_helper.rb +63 -0
- data/app/helpers/decidim/enhanced_textwork/participatory_texts_helper.rb +49 -0
- data/app/jobs/decidim/enhanced_textwork/notify_paragraphs_mentioned_job.rb +27 -0
- data/app/jobs/decidim/enhanced_textwork/settings_change_job.rb +50 -0
- data/app/models/decidim/enhanced_textwork/application_record.rb +10 -0
- data/app/models/decidim/enhanced_textwork/collaborative_draft.rb +73 -0
- data/app/models/decidim/enhanced_textwork/collaborative_draft_collaborator_request.rb +13 -0
- data/app/models/decidim/enhanced_textwork/paragraph.rb +411 -0
- data/app/models/decidim/enhanced_textwork/paragraph_note.rb +20 -0
- data/app/models/decidim/enhanced_textwork/paragraph_vote.rb +50 -0
- data/app/models/decidim/enhanced_textwork/participatory_text.rb +16 -0
- data/app/models/decidim/enhanced_textwork/valuation_assignment.rb +24 -0
- data/app/packs/documents/decidim/enhanced_textwork/participatory_texts/participatory_text.md +52 -0
- data/app/packs/documents/decidim/enhanced_textwork/participatory_texts/participatory_text.odt +0 -0
- data/app/packs/entrypoints/decidim_enhanced_textwork.js +17 -0
- data/app/packs/entrypoints/decidim_enhanced_textwork_admin.js +3 -0
- data/app/packs/images/decidim/enhanced_textwork/decidim_paragraphs.svg +1 -0
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_accepted_paragraphs.svg +1 -0
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_paragraph_votes.svg +1 -0
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_paragraphs.svg +1 -0
- data/app/packs/src/decidim/enhanced_textwork/add_paragraph.js +49 -0
- data/app/packs/src/decidim/enhanced_textwork/admin/paragraphs.js +143 -0
- data/app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js +29 -0
- data/app/packs/src/decidim/enhanced_textwork/admin/paragraphs_picker.js +35 -0
- data/app/packs/src/decidim/enhanced_textwork/toggle_element.js +21 -0
- data/app/packs/src/decidim/enhanced_textwork/utils.js +11 -0
- data/app/packs/stylesheets/decidim/enhanced_textwork/_paragraphs.scss +208 -0
- data/app/packs/stylesheets/decidim/enhanced_textwork/paragraphs/_preview.scss +3 -0
- data/app/permissions/decidim/enhanced_textwork/admin/permissions.rb +147 -0
- data/app/permissions/decidim/enhanced_textwork/permissions.rb +163 -0
- data/app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb +39 -0
- data/app/presenters/decidim/enhanced_textwork/admin_log/paragraph_presenter.rb +51 -0
- data/app/presenters/decidim/enhanced_textwork/admin_log/valuation_assignment_presenter.rb +51 -0
- data/app/presenters/decidim/enhanced_textwork/admin_log/value_types/paragraph_state_presenter.rb +17 -0
- data/app/presenters/decidim/enhanced_textwork/admin_log/value_types/paragraph_title_body_presenter.rb +23 -0
- data/app/presenters/decidim/enhanced_textwork/admin_log/value_types/valuator_role_user_presenter.rb +19 -0
- data/app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb +25 -0
- data/app/presenters/decidim/enhanced_textwork/log/resource_presenter.rb +22 -0
- data/app/presenters/decidim/enhanced_textwork/log/valuation_assignment_presenter.rb +22 -0
- data/app/presenters/decidim/enhanced_textwork/official_author_presenter.rb +14 -0
- data/app/presenters/decidim/enhanced_textwork/paragraph_presenter.rb +146 -0
- data/app/queries/decidim/enhanced_textwork/filtered_paragraphs.rb +37 -0
- data/app/queries/decidim/enhanced_textwork/metrics/accepted_paragraphs_metric_manage.rb +32 -0
- data/app/queries/decidim/enhanced_textwork/metrics/endorsements_metric_manage.rb +58 -0
- data/app/queries/decidim/enhanced_textwork/metrics/paragraph_followers_metric_measure.rb +58 -0
- data/app/queries/decidim/enhanced_textwork/metrics/paragraph_participants_metric_measure.rb +74 -0
- data/app/queries/decidim/enhanced_textwork/metrics/paragraphs_metric_manage.rb +48 -0
- data/app/queries/decidim/enhanced_textwork/metrics/votes_metric_manage.rb +52 -0
- data/app/queries/decidim/enhanced_textwork/similar_paragraphs.rb +67 -0
- data/app/services/decidim/enhanced_textwork/collaborative_draft_search.rb +59 -0
- data/app/services/decidim/enhanced_textwork/diff_renderer.rb +74 -0
- data/app/services/decidim/enhanced_textwork/paragraph_builder.rb +132 -0
- data/app/services/decidim/enhanced_textwork/paragraph_search.rb +85 -0
- data/app/validators/paragraph_length_validator.rb +40 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraph_answers/_form.html.erb +35 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraph_notes/_form.html.erb +8 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraph_notes/_paragraph_notes.html.erb +45 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/_bulk-actions.html.erb +33 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/_form.html.erb +101 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/_js-callout.html.erb +6 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/_paragraph-tr.html.erb +76 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_assign_to_valuator.html.erb +15 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_dropdown.html.erb +56 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_merge.html.erb +15 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_publish_answers.html.erb +14 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_recategorize.html.erb +15 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_scope-change.html.erb +25 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_split.html.erb +15 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_unassign_from_valuator.html.erb +15 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/edit.html.erb +7 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/index.html.erb +84 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/new.html.erb +7 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/publish_answers.js.erb +12 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/show.html.erb +186 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/update_category.js.erb +26 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs/update_scope.js.erb +27 -0
- data/app/views/decidim/enhanced_textwork/admin/paragraphs_imports/new.html.erb +37 -0
- data/app/views/decidim/enhanced_textwork/admin/participatory_texts/_article-preview.html.erb +16 -0
- data/app/views/decidim/enhanced_textwork/admin/participatory_texts/_bulk-actions.html.erb +3 -0
- data/app/views/decidim/enhanced_textwork/admin/participatory_texts/index.html.erb +55 -0
- data/app/views/decidim/enhanced_textwork/admin/participatory_texts/new_editor.html.erb +39 -0
- data/app/views/decidim/enhanced_textwork/admin/participatory_texts/new_import.html.erb +39 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_accept_request_access_form.html.erb +8 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_collaborative_drafts.html.erb +16 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_collaborator_requests.html.erb +20 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_count.html.erb +1 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_edit_form_fields.html.erb +83 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_filters.html.erb +32 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_filters_small_view.html.erb +18 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_new_collaborative_draft_button.html.erb +11 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_reject_request_access_form.html.erb +10 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_request_access_form.html.erb +7 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_wizard_aside.html.erb +13 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/_wizard_header.html.erb +14 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/edit.html.erb +31 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/index.html.erb +23 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/index.js.erb +10 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/new.html.erb +24 -0
- data/app/views/decidim/enhanced_textwork/collaborative_drafts/show.html.erb +128 -0
- data/app/views/decidim/enhanced_textwork/paragraph_votes/update_buttons_and_counters.js.erb +41 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_count.html.erb +1 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_dynamic_map_instructions.html.erb +4 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_edit_form_fields.html.erb +115 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_endorsements_card_row.html.erb +0 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_filters.html.erb +48 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_filters_small_view.html.erb +18 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_linked_paragraphs.html.erb +34 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_paragraph.html.erb +1 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_paragraph_badge.html.erb +3 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_paragraph_similar.html.erb +22 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_paragraphs.html.erb +46 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_remaining_votes_count.html.erb +3 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_vote_button.html.erb +61 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_votes_count.html.erb +18 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_voting_rules.html.erb +50 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_wizard_aside.html.erb +20 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/_wizard_header.html.erb +42 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/compare.html.erb +23 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/complete.html.erb +24 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/edit.html.erb +31 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/edit_draft.html.erb +26 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/index.html.erb +56 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/index.js.erb +10 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/new.html.erb +38 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_index.html.erb +20 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_overview.html.erb +35 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_paragraph_vote_button.html.erb +53 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_paragraph_vote_button_chevron.html.erb +72 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_paragraph_votes_count.html.erb +41 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_view_index.html.erb +10 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/participatory_text.html.erb +29 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/preview.html.erb +41 -0
- data/app/views/decidim/enhanced_textwork/paragraphs/show.html.erb +143 -0
- data/app/views/decidim/enhanced_textwork/versions/index.html.erb +16 -0
- data/app/views/decidim/enhanced_textwork/versions/show.html.erb +18 -0
- data/config/assets.rb +10 -0
- data/config/locales/de.yml +927 -0
- data/config/locales/en.yml +967 -0
- data/config/locales/todo/am-ET.yml +1 -0
- data/config/locales/todo/ar-SA.yml +801 -0
- data/config/locales/todo/ar.yml +791 -0
- data/config/locales/todo/bg-BG.yml +237 -0
- data/config/locales/todo/bg.yml +238 -0
- data/config/locales/todo/ca.yml +908 -0
- data/config/locales/todo/cs-CZ.yml +787 -0
- data/config/locales/todo/cs.yml +969 -0
- data/config/locales/todo/da-DK.yml +1 -0
- data/config/locales/todo/da.yml +1 -0
- data/config/locales/todo/el-GR.yml +1 -0
- data/config/locales/todo/el.yml +848 -0
- data/config/locales/todo/eo-UY.yml +1 -0
- data/config/locales/todo/eo.yml +1 -0
- data/config/locales/todo/es-MX.yml +908 -0
- data/config/locales/todo/es-PY.yml +908 -0
- data/config/locales/todo/es.yml +908 -0
- data/config/locales/todo/et-EE.yml +1 -0
- data/config/locales/todo/et.yml +1 -0
- data/config/locales/todo/eu.yml +717 -0
- data/config/locales/todo/fi-pl.yml +763 -0
- data/config/locales/todo/fi-plain.yml +920 -0
- data/config/locales/todo/fi.yml +920 -0
- data/config/locales/todo/fr-CA.yml +936 -0
- data/config/locales/todo/fr-LU.yml +903 -0
- data/config/locales/todo/fr.yml +936 -0
- data/config/locales/todo/ga-IE.yml +275 -0
- data/config/locales/todo/gl.yml +808 -0
- data/config/locales/todo/hr-HR.yml +1 -0
- data/config/locales/todo/hr.yml +1 -0
- data/config/locales/todo/hu.yml +847 -0
- data/config/locales/todo/id-ID.yml +704 -0
- data/config/locales/todo/is-IS.yml +269 -0
- data/config/locales/todo/is.yml +274 -0
- data/config/locales/todo/it.yml +908 -0
- data/config/locales/todo/ja.yml +922 -0
- data/config/locales/todo/ko-KR.yml +1 -0
- data/config/locales/todo/ko.yml +1 -0
- data/config/locales/todo/lb-LU.yml +1 -0
- data/config/locales/todo/lb.yml +40 -0
- data/config/locales/todo/lt-LT.yml +1 -0
- data/config/locales/todo/lt.yml +1 -0
- data/config/locales/todo/lv.yml +838 -0
- data/config/locales/todo/mt-MT.yml +1 -0
- data/config/locales/todo/mt.yml +1 -0
- data/config/locales/todo/nl.yml +882 -0
- data/config/locales/todo/no.yml +770 -0
- data/config/locales/todo/om-ET.yml +1 -0
- data/config/locales/todo/pl.yml +927 -0
- data/config/locales/todo/pt-BR.yml +908 -0
- data/config/locales/todo/pt.yml +945 -0
- data/config/locales/todo/ro-RO.yml +886 -0
- data/config/locales/todo/ru.yml +379 -0
- data/config/locales/todo/si-LK.yml +1 -0
- data/config/locales/todo/sk-SK.yml +896 -0
- data/config/locales/todo/sk.yml +851 -0
- data/config/locales/todo/sl.yml +26 -0
- data/config/locales/todo/so-SO.yml +1 -0
- data/config/locales/todo/sr-CS.yml +125 -0
- data/config/locales/todo/sv.yml +908 -0
- data/config/locales/todo/sw-KE.yml +1 -0
- data/config/locales/todo/ti-ER.yml +1 -0
- data/config/locales/todo/tr-TR.yml +890 -0
- data/config/locales/todo/uk.yml +379 -0
- data/config/locales/todo/vi-VN.yml +1 -0
- data/config/locales/todo/vi.yml +1 -0
- data/config/locales/todo/zh-CN.yml +857 -0
- data/config/locales/todo/zh-TW.yml +1 -0
- data/db/migrate/20161212110850_create_decidim_paragraphs.rb +16 -0
- data/db/migrate/20170112115253_create_paragraph_votes.rb +14 -0
- data/db/migrate/20170113114245_add_enhanced_textwork_text_search_indexes.rb +8 -0
- data/db/migrate/20170118120151_add_counter_cache_votes_to_paragraphs.rb +7 -0
- data/db/migrate/20170120151202_add_user_group_id_to_paragraphs.rb +7 -0
- data/db/migrate/20170131092413_add_answers_to_paragraphs.rb +9 -0
- data/db/migrate/20170205082832_add_index_to_decidim_enhanced_textwork_paragraphs_paragraph_votes_count.rb +9 -0
- data/db/migrate/20170215113152_create_paragraph_reports.rb +16 -0
- data/db/migrate/20170215131720_add_report_count_to_paragraphs.rb +7 -0
- data/db/migrate/20170215132030_add_reference_to_paragraphs.rb +13 -0
- data/db/migrate/20170220152416_add_hidden_at_to_paragraphs.rb +7 -0
- data/db/migrate/20170228105156_add_geolocalization_fields_to_paragraphs.rb +9 -0
- data/db/migrate/20170307085300_migrate_paragraph_reports_data_to_reports.rb +24 -0
- data/db/migrate/20170410073742_remove_not_null_reference_paragraphs.rb +7 -0
- data/db/migrate/20170612101809_migrate_paragraphs_category.rb +15 -0
- data/db/migrate/20171201115434_create_paragraph_endorsements.rb +16 -0
- data/db/migrate/20171201122623_add_counter_cache_endorsements_to_paragraphs.rb +8 -0
- data/db/migrate/20171212102250_enable_pg_trgm_extension_for_paragraphs.rb +18 -0
- data/db/migrate/20171220084719_add_published_at_to_paragraphs.rb +14 -0
- data/db/migrate/20180111110204_create_decidim_paragraph_notes.rb +15 -0
- data/db/migrate/20180115155220_add_index_created_at_paragraph_notes.rb +7 -0
- data/db/migrate/20180305133811_rename_features_to_components_at_paragraphs.rb +11 -0
- data/db/migrate/20180326091532_create_decidim_enhanced_textwork_collaborative_drafts.rb +29 -0
- data/db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb +18 -0
- data/db/migrate/20180529101323_add_counter_cache_coauthorships_to_paragraphs.rb +8 -0
- data/db/migrate/20180529110230_move_enhanced_textwork_authorships_to_coauthorships.rb +28 -0
- data/db/migrate/20180529110830_remove_authorships_from_paragraphs.rb +8 -0
- data/db/migrate/20180613151121_create_enhanced_textwork_collaborative_draft_collaborator_requests.rb +12 -0
- data/db/migrate/20180711074134_add_enhanced_textwork_counter_cache_coauthorships_to_collaborative_drafts.rb +7 -0
- data/db/migrate/20180711075004_remove_index_counter_cache_coauthorships_to_paragraphs.rb +7 -0
- data/db/migrate/20180927111721_create_enhanced_textwork_participatory_texts.rb +13 -0
- data/db/migrate/20180930125321_add_participatory_text_level_to_paragraphs.rb +7 -0
- data/db/migrate/20180930125321_add_position_to_paragraphs.rb +7 -0
- data/db/migrate/20181003074440_fix_user_groups_ids_in_paragraphs_endorsements.rb +20 -0
- data/db/migrate/20181010114622_add_enhanced_textwork_temporary_votes.rb +9 -0
- data/db/migrate/20181016132225_add_enhanced_textwork_organization_as_author.rb +13 -0
- data/db/migrate/20181017084221_make_author_polymorhpic_for_paragraph_endorsements.rb +31 -0
- data/db/migrate/20181026073215_add_enhanced_textwork_created_in_meeting.rb +7 -0
- data/db/migrate/20190215113158_use_enhanced_textwork_md5_indexes.rb +17 -0
- data/db/migrate/20191206154128_add_endorsements_counter_cache_to_paragraphs.rb +7 -0
- data/db/migrate/20200120215928_move_paragraph_endorsements_to_core_endorsements.rb +54 -0
- data/db/migrate/20200120230130_drop_paragraph_endorsements.rb +8 -0
- data/db/migrate/20200203111239_add_paragraph_valuation_assignments.rb +12 -0
- data/db/migrate/20200210135152_add_costs_to_paragraphs.rb +9 -0
- data/db/migrate/20200212120110_sync_paragraphs_state_with_amendments_state.rb +28 -0
- data/db/migrate/20200227175922_add_state_published_at_to_paragraphs.rb +7 -0
- data/db/migrate/20200306123652_publish_existing_paragraphs_state.rb +15 -0
- data/db/migrate/20200708091228_move_paragraphs_fields_to_i18n.rb +86 -0
- data/db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb +20 -0
- data/db/migrate/20200827154156_add_commentable_counter_cache_to_paragraphs.rb +12 -0
- data/db/migrate/20201002085508_fix_paragraphs_data.rb +36 -0
- data/db/migrate/20210127115628_fix_answered_paragraphs_after_copy.rb +14 -0
- data/db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb +16 -0
- data/db/migrate/20210310120812_add_enhanced_textwork_followable_counter_cache_to_collaborative_drafts.rb +16 -0
- data/db/migrate/20210318082934_fix_counters_for_copied_paragraphs.rb +19 -0
- data/lib/decidim/api/paragraph_input_filter.rb +29 -0
- data/lib/decidim/api/paragraph_input_sort.rb +20 -0
- data/lib/decidim/api/paragraph_type.rb +56 -0
- data/lib/decidim/api/paragraphs_type.rb +43 -0
- data/lib/decidim/content_parsers/paragraph_parser.rb +101 -0
- data/lib/decidim/content_renderers/paragraph_renderer.rb +33 -0
- data/lib/decidim/enhanced_textwork/admin.rb +10 -0
- data/lib/decidim/enhanced_textwork/admin_engine.rb +52 -0
- data/lib/decidim/enhanced_textwork/api.rb +10 -0
- data/lib/decidim/enhanced_textwork/commentable_collaborative_draft.rb +38 -0
- data/lib/decidim/enhanced_textwork/commentable_paragraph.rb +36 -0
- data/lib/decidim/enhanced_textwork/component.rb +448 -0
- data/lib/decidim/enhanced_textwork/doc_to_markdown.rb +50 -0
- data/lib/decidim/enhanced_textwork/engine.rb +204 -0
- data/lib/decidim/enhanced_textwork/html_to_markdown.rb +22 -0
- data/lib/decidim/enhanced_textwork/markdown_to_paragraphs.rb +153 -0
- data/lib/decidim/enhanced_textwork/odt_to_markdown.rb +46 -0
- data/lib/decidim/enhanced_textwork/paragraph_creator.rb +98 -0
- data/lib/decidim/enhanced_textwork/paragraph_serializer.rb +95 -0
- data/lib/decidim/enhanced_textwork/participatory_text_section.rb +21 -0
- data/lib/decidim/enhanced_textwork/test/capybara_paragraphs_picker.rb +59 -0
- data/lib/decidim/enhanced_textwork/test/factories.rb +492 -0
- data/lib/decidim/enhanced_textwork/valuatable.rb +21 -0
- data/lib/decidim/enhanced_textwork/version.rb +14 -0
- data/lib/decidim/enhanced_textwork.rb +58 -0
- data/lib/decidim/exporters/word.rb +309 -0
- metadata +704 -0
@@ -0,0 +1,492 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/core/test/factories"
|
4
|
+
require "decidim/participatory_processes/test/factories"
|
5
|
+
require "decidim/meetings/test/factories"
|
6
|
+
|
7
|
+
FactoryBot.define do
|
8
|
+
factory :paragraph_component, parent: :component do
|
9
|
+
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :paragraphs).i18n_name }
|
10
|
+
manifest_name { :paragraphs }
|
11
|
+
participatory_space { create(:participatory_process, :with_steps, organization: organization) }
|
12
|
+
|
13
|
+
trait :with_endorsements_enabled do
|
14
|
+
step_settings do
|
15
|
+
{
|
16
|
+
participatory_space.active_step.id => { endorsements_enabled: true }
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
trait :with_endorsements_disabled do
|
22
|
+
step_settings do
|
23
|
+
{
|
24
|
+
participatory_space.active_step.id => { endorsements_enabled: false }
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
trait :with_votes_enabled do
|
30
|
+
step_settings do
|
31
|
+
{
|
32
|
+
participatory_space.active_step.id => { votes_enabled: true }
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
trait :with_votes_disabled do
|
38
|
+
step_settings do
|
39
|
+
{
|
40
|
+
participatory_space.active_step.id => { votes_enabled: false }
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
trait :with_votes_hidden do
|
46
|
+
step_settings do
|
47
|
+
{
|
48
|
+
participatory_space.active_step.id => { votes_hidden: true }
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
trait :with_vote_limit do
|
54
|
+
transient do
|
55
|
+
vote_limit { 10 }
|
56
|
+
end
|
57
|
+
|
58
|
+
settings do
|
59
|
+
{
|
60
|
+
vote_limit: vote_limit
|
61
|
+
}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
trait :with_paragraph_limit do
|
66
|
+
transient do
|
67
|
+
paragraph_limit { 1 }
|
68
|
+
end
|
69
|
+
|
70
|
+
settings do
|
71
|
+
{
|
72
|
+
paragraph_limit: paragraph_limit
|
73
|
+
}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
trait :with_paragraph_length do
|
78
|
+
transient do
|
79
|
+
paragraph_length { 500 }
|
80
|
+
end
|
81
|
+
|
82
|
+
settings do
|
83
|
+
{
|
84
|
+
paragraph_length: paragraph_length
|
85
|
+
}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
trait :with_endorsements_blocked do
|
90
|
+
step_settings do
|
91
|
+
{
|
92
|
+
participatory_space.active_step.id => {
|
93
|
+
endorsements_enabled: true,
|
94
|
+
endorsements_blocked: true
|
95
|
+
}
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
trait :with_votes_blocked do
|
101
|
+
step_settings do
|
102
|
+
{
|
103
|
+
participatory_space.active_step.id => {
|
104
|
+
votes_enabled: true,
|
105
|
+
votes_blocked: true
|
106
|
+
}
|
107
|
+
}
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
trait :with_creation_enabled do
|
112
|
+
step_settings do
|
113
|
+
{
|
114
|
+
participatory_space.active_step.id => { creation_enabled: true }
|
115
|
+
}
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
trait :with_geocoding_enabled do
|
120
|
+
settings do
|
121
|
+
{
|
122
|
+
geocoding_enabled: true
|
123
|
+
}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
trait :with_attachments_allowed do
|
128
|
+
settings do
|
129
|
+
{
|
130
|
+
attachments_allowed: true
|
131
|
+
}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
trait :with_threshold_per_paragraph do
|
136
|
+
transient do
|
137
|
+
threshold_per_paragraph { 1 }
|
138
|
+
end
|
139
|
+
|
140
|
+
settings do
|
141
|
+
{
|
142
|
+
threshold_per_paragraph: threshold_per_paragraph
|
143
|
+
}
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
trait :with_can_accumulate_supports_beyond_threshold do
|
148
|
+
settings do
|
149
|
+
{
|
150
|
+
can_accumulate_supports_beyond_threshold: true
|
151
|
+
}
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
trait :with_collaborative_drafts_enabled do
|
156
|
+
settings do
|
157
|
+
{
|
158
|
+
collaborative_drafts_enabled: true
|
159
|
+
}
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
trait :with_attachments_allowed_and_collaborative_drafts_enabled do
|
164
|
+
settings do
|
165
|
+
{
|
166
|
+
attachments_allowed: true,
|
167
|
+
collaborative_drafts_enabled: true
|
168
|
+
}
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
trait :with_minimum_votes_per_user do
|
173
|
+
transient do
|
174
|
+
minimum_votes_per_user { 3 }
|
175
|
+
end
|
176
|
+
|
177
|
+
settings do
|
178
|
+
{
|
179
|
+
minimum_votes_per_user: minimum_votes_per_user
|
180
|
+
}
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
trait :with_participatory_texts_enabled do
|
185
|
+
settings do
|
186
|
+
{
|
187
|
+
participatory_texts_enabled: true
|
188
|
+
}
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
trait :with_amendments_enabled do
|
193
|
+
settings do
|
194
|
+
{
|
195
|
+
amendments_enabled: true
|
196
|
+
}
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
trait :with_amendments_and_participatory_texts_enabled do
|
201
|
+
settings do
|
202
|
+
{
|
203
|
+
participatory_texts_enabled: true,
|
204
|
+
amendments_enabled: true
|
205
|
+
}
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
trait :with_comments_disabled do
|
210
|
+
settings do
|
211
|
+
{
|
212
|
+
comments_enabled: false
|
213
|
+
}
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
trait :with_extra_hashtags do
|
218
|
+
transient do
|
219
|
+
automatic_hashtags { "AutoHashtag AnotherAutoHashtag" }
|
220
|
+
suggested_hashtags { "SuggestedHashtag AnotherSuggestedHashtag" }
|
221
|
+
end
|
222
|
+
|
223
|
+
step_settings do
|
224
|
+
{
|
225
|
+
participatory_space.active_step.id => {
|
226
|
+
automatic_hashtags: automatic_hashtags,
|
227
|
+
suggested_hashtags: suggested_hashtags,
|
228
|
+
creation_enabled: true
|
229
|
+
}
|
230
|
+
}
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
trait :without_publish_answers_immediately do
|
235
|
+
step_settings do
|
236
|
+
{
|
237
|
+
participatory_space.active_step.id => {
|
238
|
+
publish_answers_immediately: false
|
239
|
+
}
|
240
|
+
}
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
factory :paragraph, class: "Decidim::EnhancedTextwork::Paragraph" do
|
246
|
+
transient do
|
247
|
+
users { nil }
|
248
|
+
# user_groups correspondence to users is by sorting order
|
249
|
+
user_groups { [] }
|
250
|
+
skip_injection { false }
|
251
|
+
end
|
252
|
+
|
253
|
+
title do
|
254
|
+
if skip_injection
|
255
|
+
Decidim::Faker::Localized.localized { generate(:title) }
|
256
|
+
else
|
257
|
+
Decidim::Faker::Localized.localized { "<script>alert(\"TITLE\");</script> #{generate(:title)}" }
|
258
|
+
end
|
259
|
+
end
|
260
|
+
body do
|
261
|
+
if skip_injection
|
262
|
+
Decidim::Faker::Localized.localized { Faker::Lorem.sentences(number: 3).join("\n") }
|
263
|
+
else
|
264
|
+
Decidim::Faker::Localized.localized { "<script>alert(\"TITLE\");</script> #{Faker::Lorem.sentences(number: 3).join("\n")}" }
|
265
|
+
end
|
266
|
+
end
|
267
|
+
component { create(:paragraph_component) }
|
268
|
+
published_at { Time.current }
|
269
|
+
address { "#{Faker::Address.street_name}, #{Faker::Address.city}" }
|
270
|
+
latitude { Faker::Address.latitude }
|
271
|
+
longitude { Faker::Address.longitude }
|
272
|
+
cost { 20_000 }
|
273
|
+
cost_report { { en: "My cost report" } }
|
274
|
+
execution_period { { en: "My execution period" } }
|
275
|
+
|
276
|
+
after(:build) do |paragraph, evaluator|
|
277
|
+
paragraph.title = if evaluator.title.is_a?(String)
|
278
|
+
{ paragraph.try(:organization).try(:default_locale) || "en" => evaluator.title }
|
279
|
+
else
|
280
|
+
evaluator.title
|
281
|
+
end
|
282
|
+
paragraph.body = if evaluator.body.is_a?(String)
|
283
|
+
{ paragraph.try(:organization).try(:default_locale) || "en" => evaluator.body }
|
284
|
+
else
|
285
|
+
evaluator.body
|
286
|
+
end
|
287
|
+
|
288
|
+
paragraph.title = Decidim::ContentProcessor.parse_with_processor(:hashtag, paragraph.title, current_organization: paragraph.organization).rewrite
|
289
|
+
paragraph.body = Decidim::ContentProcessor.parse_with_processor(:hashtag, paragraph.body, current_organization: paragraph.organization).rewrite
|
290
|
+
|
291
|
+
if paragraph.component
|
292
|
+
users = evaluator.users || [create(:user, :confirmed, organization: paragraph.component.participatory_space.organization)]
|
293
|
+
users.each_with_index do |user, idx|
|
294
|
+
user_group = evaluator.user_groups[idx]
|
295
|
+
paragraph.coauthorships.build(author: user, user_group: user_group)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
trait :published do
|
301
|
+
published_at { Time.current }
|
302
|
+
end
|
303
|
+
|
304
|
+
trait :unpublished do
|
305
|
+
published_at { nil }
|
306
|
+
end
|
307
|
+
|
308
|
+
trait :citizen_author do
|
309
|
+
after :build do |paragraph|
|
310
|
+
paragraph.coauthorships.clear
|
311
|
+
user = build(:user, organization: paragraph.component.participatory_space.organization)
|
312
|
+
paragraph.coauthorships.build(author: user)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
trait :user_group_author do
|
317
|
+
after :build do |paragraph|
|
318
|
+
paragraph.coauthorships.clear
|
319
|
+
user = create(:user, organization: paragraph.component.participatory_space.organization)
|
320
|
+
user_group = create(:user_group, :verified, organization: user.organization, users: [user])
|
321
|
+
paragraph.coauthorships.build(author: user, user_group: user_group)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
trait :official do
|
326
|
+
after :build do |paragraph|
|
327
|
+
paragraph.coauthorships.clear
|
328
|
+
paragraph.coauthorships.build(author: paragraph.organization)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
trait :official_meeting do
|
333
|
+
after :build do |paragraph|
|
334
|
+
paragraph.coauthorships.clear
|
335
|
+
component = build(:meeting_component, participatory_space: paragraph.component.participatory_space)
|
336
|
+
paragraph.coauthorships.build(author: build(:meeting, component: component))
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
trait :evaluating do
|
341
|
+
state { "evaluating" }
|
342
|
+
answered_at { Time.current }
|
343
|
+
state_published_at { Time.current }
|
344
|
+
end
|
345
|
+
|
346
|
+
trait :accepted do
|
347
|
+
state { "accepted" }
|
348
|
+
answered_at { Time.current }
|
349
|
+
state_published_at { Time.current }
|
350
|
+
end
|
351
|
+
|
352
|
+
trait :rejected do
|
353
|
+
state { "rejected" }
|
354
|
+
answered_at { Time.current }
|
355
|
+
state_published_at { Time.current }
|
356
|
+
end
|
357
|
+
|
358
|
+
trait :withdrawn do
|
359
|
+
state { "withdrawn" }
|
360
|
+
end
|
361
|
+
|
362
|
+
trait :accepted_not_published do
|
363
|
+
state { "accepted" }
|
364
|
+
answered_at { Time.current }
|
365
|
+
state_published_at { nil }
|
366
|
+
answer { generate_localized_title }
|
367
|
+
end
|
368
|
+
|
369
|
+
trait :with_answer do
|
370
|
+
state { "accepted" }
|
371
|
+
answer { generate_localized_title }
|
372
|
+
answered_at { Time.current }
|
373
|
+
state_published_at { Time.current }
|
374
|
+
end
|
375
|
+
|
376
|
+
trait :not_answered do
|
377
|
+
state { nil }
|
378
|
+
end
|
379
|
+
|
380
|
+
trait :draft do
|
381
|
+
published_at { nil }
|
382
|
+
end
|
383
|
+
|
384
|
+
trait :hidden do
|
385
|
+
after :create do |paragraph|
|
386
|
+
create(:moderation, hidden_at: Time.current, reportable: paragraph)
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
trait :with_votes do
|
391
|
+
after :create do |paragraph|
|
392
|
+
create_list(:paragraph_vote, 5, paragraph: paragraph)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
trait :with_endorsements do
|
397
|
+
after :create do |paragraph|
|
398
|
+
5.times.collect do
|
399
|
+
create(:endorsement, resource: paragraph, author: build(:user, organization: paragraph.participatory_space.organization))
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
trait :with_amendments do
|
405
|
+
after :create do |paragraph|
|
406
|
+
create_list(:paragraph_amendment, 5, amendable: paragraph)
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
trait :with_photo do
|
411
|
+
after :create do |paragraph|
|
412
|
+
paragraph.attachments << create(:attachment, :with_image, attached_to: paragraph)
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
trait :with_document do
|
417
|
+
after :create do |paragraph|
|
418
|
+
paragraph.attachments << create(:attachment, :with_pdf, attached_to: paragraph)
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
factory :paragraph_vote, class: "Decidim::EnhancedTextwork::ParagraphVote" do
|
424
|
+
paragraph { build(:paragraph) }
|
425
|
+
author { build(:user, organization: paragraph.organization) }
|
426
|
+
end
|
427
|
+
|
428
|
+
factory :paragraph_amendment, class: "Decidim::Amendment" do
|
429
|
+
amendable { build(:paragraph) }
|
430
|
+
emendation { build(:paragraph, component: amendable.component) }
|
431
|
+
amender { build(:user, organization: amendable.component.participatory_space.organization) }
|
432
|
+
state { Decidim::Amendment::STATES.sample }
|
433
|
+
end
|
434
|
+
|
435
|
+
factory :paragraph_note, class: "Decidim::EnhancedTextwork::ParagraphNote" do
|
436
|
+
body { Faker::Lorem.sentences(number: 3).join("\n") }
|
437
|
+
paragraph { build(:paragraph) }
|
438
|
+
author { build(:user, organization: paragraph.organization) }
|
439
|
+
end
|
440
|
+
|
441
|
+
factory :collaborative_draft, class: "Decidim::EnhancedTextwork::CollaborativeDraft" do
|
442
|
+
transient do
|
443
|
+
users { nil }
|
444
|
+
# user_groups correspondence to users is by sorting order
|
445
|
+
user_groups { [] }
|
446
|
+
end
|
447
|
+
|
448
|
+
title { "<script>alert(\"TITLE\");</script> #{generate(:title)}" }
|
449
|
+
body { "<script>alert(\"BODY\");</script>\n#{Faker::Lorem.sentences(number: 3).join("\n")}" }
|
450
|
+
component { create(:paragraph_component) }
|
451
|
+
address { "#{Faker::Address.street_name}, #{Faker::Address.city}" }
|
452
|
+
state { "open" }
|
453
|
+
|
454
|
+
after(:build) do |collaborative_draft, evaluator|
|
455
|
+
if collaborative_draft.component
|
456
|
+
users = evaluator.users || [create(:user, organization: collaborative_draft.component.participatory_space.organization)]
|
457
|
+
users.each_with_index do |user, idx|
|
458
|
+
user_group = evaluator.user_groups[idx]
|
459
|
+
collaborative_draft.coauthorships.build(author: user, user_group: user_group)
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
trait :published do
|
465
|
+
state { "published" }
|
466
|
+
published_at { Time.current }
|
467
|
+
end
|
468
|
+
|
469
|
+
trait :open do
|
470
|
+
state { "open" }
|
471
|
+
end
|
472
|
+
|
473
|
+
trait :withdrawn do
|
474
|
+
state { "withdrawn" }
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
factory :participatory_text, class: "Decidim::EnhancedTextwork::ParticipatoryText" do
|
479
|
+
title { { en: "<script>alert(\"TITLE\");</script> #{generate(:title)}" } }
|
480
|
+
description { { en: "<script>alert(\"DESCRIPTION\");</script>\n#{Faker::Lorem.sentences(number: 3).join("\n")}" } }
|
481
|
+
component { create(:paragraph_component) }
|
482
|
+
end
|
483
|
+
|
484
|
+
factory :valuation_assignment, class: "Decidim::EnhancedTextwork::ValuationAssignment" do
|
485
|
+
paragraph
|
486
|
+
valuator_role do
|
487
|
+
space = paragraph.component.participatory_space
|
488
|
+
organization = space.organization
|
489
|
+
build :participatory_process_user_role, role: :valuator, user: build(:user, organization: organization)
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module EnhancedTextwork
|
5
|
+
# A set of methods and features related to paragraph valuations.
|
6
|
+
module Valuatable
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
include Decidim::Comments::Commentable
|
9
|
+
|
10
|
+
included do
|
11
|
+
has_many :valuation_assignments, foreign_key: "decidim_paragraph_id", dependent: :destroy
|
12
|
+
|
13
|
+
def valuators
|
14
|
+
valuator_role_ids = valuation_assignments.where(paragraph: self).pluck(:valuator_role_id)
|
15
|
+
user_ids = participatory_space.user_roles(:valuator).where(id: valuator_role_ids).pluck(:decidim_user_id)
|
16
|
+
participatory_space.organization.users.where(id: user_ids)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/enhanced_textwork/admin"
|
4
|
+
require "decidim/enhanced_textwork/api"
|
5
|
+
require "decidim/enhanced_textwork/engine"
|
6
|
+
require "decidim/enhanced_textwork/admin_engine"
|
7
|
+
require "decidim/enhanced_textwork/component"
|
8
|
+
|
9
|
+
module Decidim
|
10
|
+
# This namespace holds the logic of the `Paragraphs` component. This component
|
11
|
+
# allows users to create paragraphs in a participatory process.
|
12
|
+
module EnhancedTextwork
|
13
|
+
autoload :ParagraphSerializer, "decidim/enhanced_textwork/paragraph_serializer"
|
14
|
+
autoload :ParagraphCreator, "decidim/enhanced_textwork/paragraph_creator"
|
15
|
+
autoload :CommentableParagraph, "decidim/enhanced_textwork/commentable_paragraph"
|
16
|
+
autoload :CommentableCollaborativeDraft, "decidim/enhanced_textwork/commentable_collaborative_draft"
|
17
|
+
autoload :MarkdownToParagraphs, "decidim/enhanced_textwork/markdown_to_paragraphs"
|
18
|
+
autoload :ParticipatoryTextSection, "decidim/enhanced_textwork/participatory_text_section"
|
19
|
+
autoload :DocToMarkdown, "decidim/enhanced_textwork/doc_to_markdown"
|
20
|
+
autoload :OdtToMarkdown, "decidim/enhanced_textwork/odt_to_markdown"
|
21
|
+
autoload :HtmlToMarkdown, "decidim/enhanced_textwork/html_to_markdown"
|
22
|
+
autoload :Valuatable, "decidim/enhanced_textwork/valuatable"
|
23
|
+
|
24
|
+
include ActiveSupport::Configurable
|
25
|
+
|
26
|
+
# Public Setting that defines the similarity minimum value to consider two
|
27
|
+
# paragraphs similar. Defaults to 0.25.
|
28
|
+
config_accessor :similarity_threshold do
|
29
|
+
0.25
|
30
|
+
end
|
31
|
+
|
32
|
+
# Public Setting that defines how many similar paragraphs will be shown.
|
33
|
+
# Defaults to 10.
|
34
|
+
config_accessor :similarity_limit do
|
35
|
+
10
|
36
|
+
end
|
37
|
+
|
38
|
+
# Public Setting that defines how many paragraphs will be shown in the
|
39
|
+
# participatory_space_highlighted_elements view hook
|
40
|
+
config_accessor :participatory_space_highlighted_paragraphs_limit do
|
41
|
+
4
|
42
|
+
end
|
43
|
+
|
44
|
+
# Public Setting that defines how many paragraphs will be shown in the
|
45
|
+
# process_group_highlighted_elements view hook
|
46
|
+
config_accessor :process_group_highlighted_paragraphs_limit do
|
47
|
+
3
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
module ContentParsers
|
52
|
+
autoload :ParagraphParser, "decidim/content_parsers/paragraph_parser"
|
53
|
+
end
|
54
|
+
|
55
|
+
module ContentRenderers
|
56
|
+
autoload :ParagraphRenderer, "decidim/content_renderers/paragraph_renderer"
|
57
|
+
end
|
58
|
+
end
|