decidim-participatory_documents 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.erb-lint.yml +30 -0
- data/.eslintignore +3 -0
- data/.eslintrc.json +3 -0
- data/.github/workflows/lint.yml +43 -0
- data/.github/workflows/test.yml +60 -0
- data/.gitignore +27 -0
- data/.rspec +3 -0
- data/.rubocop-disabled.yml +11 -0
- data/.rubocop.yml +4 -0
- data/.rubocop_rails.yml +91 -0
- data/.rubocop_ruby.yml +1768 -0
- data/.ruby-version +1 -0
- data/.simplecov +13 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +39 -0
- data/Gemfile.lock +817 -0
- data/LICENSE-AGPLv3.txt +661 -0
- data/README.md +166 -0
- data/Rakefile +44 -0
- data/app/cells/decidim/participatory_documents/edit_suggestion_note_modal/show.erb +20 -0
- data/app/cells/decidim/participatory_documents/edit_suggestion_note_modal_cell.rb +35 -0
- data/app/cells/decidim/participatory_documents/suggestion/admin_answer.erb +7 -0
- data/app/cells/decidim/participatory_documents/suggestion/show.erb +11 -0
- data/app/cells/decidim/participatory_documents/suggestion_author/avatar.erb +3 -0
- data/app/cells/decidim/participatory_documents/suggestion_author/date.erb +1 -0
- data/app/cells/decidim/participatory_documents/suggestion_author/name.erb +3 -0
- data/app/cells/decidim/participatory_documents/suggestion_author/show.erb +9 -0
- data/app/cells/decidim/participatory_documents/suggestion_author_cell.rb +50 -0
- data/app/cells/decidim/participatory_documents/suggestion_cell.rb +41 -0
- data/app/commands/decidim/participatory_documents/admin/answer_suggestion.rb +62 -0
- data/app/commands/decidim/participatory_documents/admin/assign_suggestions_to_valuator.rb +59 -0
- data/app/commands/decidim/participatory_documents/admin/create_document.rb +55 -0
- data/app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb +49 -0
- data/app/commands/decidim/participatory_documents/admin/destroy_annotation.rb +67 -0
- data/app/commands/decidim/participatory_documents/admin/notify_suggestion_answer.rb +52 -0
- data/app/commands/decidim/participatory_documents/admin/publish_answers.rb +59 -0
- data/app/commands/decidim/participatory_documents/admin/publish_document.rb +26 -0
- data/app/commands/decidim/participatory_documents/admin/unassign_suggestions_from_valuator.rb +60 -0
- data/app/commands/decidim/participatory_documents/admin/update_document.rb +85 -0
- data/app/commands/decidim/participatory_documents/admin/update_or_create_annotation.rb +98 -0
- data/app/commands/decidim/participatory_documents/admin/update_section.rb +52 -0
- data/app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb +36 -0
- data/app/commands/decidim/participatory_documents/create_suggestion.rb +65 -0
- data/app/controllers/concerns/decidim/participatory_documents/admin/needs_admin_snippets.rb +25 -0
- data/app/controllers/concerns/decidim/participatory_documents/needs_pdf_document.rb +105 -0
- data/app/controllers/decidim/participatory_documents/admin/annotations_controller.rb +51 -0
- data/app/controllers/decidim/participatory_documents/admin/application_controller.rb +18 -0
- data/app/controllers/decidim/participatory_documents/admin/documents_controller.rb +104 -0
- data/app/controllers/decidim/participatory_documents/admin/sections_controller.rb +39 -0
- data/app/controllers/decidim/participatory_documents/admin/suggestion_notes_controller.rb +59 -0
- data/app/controllers/decidim/participatory_documents/admin/suggestions_controller.rb +160 -0
- data/app/controllers/decidim/participatory_documents/admin/valuation_assignments_controller.rb +58 -0
- data/app/controllers/decidim/participatory_documents/application_controller.rb +14 -0
- data/app/controllers/decidim/participatory_documents/document_suggestions_controller.rb +40 -0
- data/app/controllers/decidim/participatory_documents/documents_controller.rb +18 -0
- data/app/controllers/decidim/participatory_documents/section_suggestions_controller.rb +40 -0
- data/app/events/decidim/participatory_documents/suggestion_answer_event.rb +43 -0
- data/app/forms/decidim/participatory_documents/admin/annotation_form.rb +26 -0
- data/app/forms/decidim/participatory_documents/admin/answer_suggestion_form.rb +21 -0
- data/app/forms/decidim/participatory_documents/admin/document_form.rb +29 -0
- data/app/forms/decidim/participatory_documents/admin/section_form.rb +17 -0
- data/app/forms/decidim/participatory_documents/admin/suggestion_note_form.rb +15 -0
- data/app/forms/decidim/participatory_documents/admin/valuation_assignment_form.rb +38 -0
- data/app/forms/decidim/participatory_documents/suggestion_form.rb +39 -0
- data/app/helpers/decidim/participatory_documents/admin/button_helper.rb +17 -0
- data/app/helpers/decidim/participatory_documents/admin/documents_helper.rb +71 -0
- data/app/helpers/decidim/participatory_documents/admin/suggestion_helper.rb +54 -0
- data/app/helpers/decidim/participatory_documents/documents_helper.rb +41 -0
- data/app/models/concerns/decidim/participatory_documents/participatory_space_user_role_override.rb +19 -0
- data/app/models/concerns/decidim/participatory_documents/valuator_override.rb +18 -0
- data/app/models/decidim/participatory_documents/annotation.rb +28 -0
- data/app/models/decidim/participatory_documents/application_record.rb +10 -0
- data/app/models/decidim/participatory_documents/document.rb +67 -0
- data/app/models/decidim/participatory_documents/section.rb +44 -0
- data/app/models/decidim/participatory_documents/suggestion.rb +167 -0
- data/app/models/decidim/participatory_documents/suggestion_note.rb +18 -0
- data/app/models/decidim/participatory_documents/valuation_assignment.rb +21 -0
- data/app/packs/entrypoints/decidim_participatory_documents.js +6 -0
- data/app/packs/entrypoints/decidim_participatory_documents.scss +18 -0
- data/app/packs/entrypoints/decidim_participatory_documents_admin.js +7 -0
- data/app/packs/entrypoints/decidim_participatory_documents_admin.scss +69 -0
- data/app/packs/entrypoints/decidim_participatory_documents_editor.js +12 -0
- data/app/packs/entrypoints/decidim_participatory_documents_editor.scss +33 -0
- data/app/packs/entrypoints/decidim_participatory_documents_viewer.js +6 -0
- data/app/packs/entrypoints/decidim_participatory_documents_viewer.scss +11 -0
- data/app/packs/images/.keep +0 -0
- data/app/packs/images/badge.svg +6 -0
- data/app/packs/images/fullscreen.svg +6 -0
- data/app/packs/images/fullscreen_exit.svg +14 -0
- data/app/packs/images/group.svg +1 -0
- data/app/packs/images/move.svg +49 -0
- data/app/packs/images/participatory_documents.svg +14 -0
- data/app/packs/src/decidim/participatory_documents/admin/manage_bulk_suggestions.js +133 -0
- data/app/packs/src/decidim/participatory_documents/admin/preview_box_color.js +14 -0
- data/app/packs/src/decidim/participatory_documents/global.js +22 -0
- data/app/packs/src/decidim/participatory_documents/pdf/box.js +234 -0
- data/app/packs/src/decidim/participatory_documents/pdf/box_control_group.js +80 -0
- data/app/packs/src/decidim/participatory_documents/pdf/box_control_move.js +55 -0
- data/app/packs/src/decidim/participatory_documents/pdf/box_controls.js +18 -0
- data/app/packs/src/decidim/participatory_documents/pdf/pdf_modal_manager.js +129 -0
- data/app/packs/src/decidim/participatory_documents/pdf/pdf_state_manager.js +141 -0
- data/app/packs/src/decidim/participatory_documents/pdf/polygon_editor.js +99 -0
- data/app/packs/src/decidim/participatory_documents/pdf/polygon_viewer.js +55 -0
- data/app/packs/src/decidim/participatory_documents/pdf/suggestion_form.js +142 -0
- data/app/packs/src/decidim/participatory_documents/pdf.js +37 -0
- data/app/packs/src/decidim/participatory_documents/pdf_admin.js +60 -0
- data/app/packs/src/decidim/participatory_documents/pdf_notifications.js +20 -0
- data/app/packs/src/decidim/participatory_documents/skip_cookie_warning.js +10 -0
- data/app/packs/stylesheets/decidim/participatory_documents/decidim_admin_classes.scss +13 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/admin_modals.scss +41 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/admin_polygons.scss +131 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/admin_tweaks.scss +44 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/defaults.scss +7 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/document.scss +7 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/modals.scss +152 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/notifications.scss +31 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/polygons.scss +80 -0
- data/app/packs/stylesheets/decidim/participatory_documents/pdf/tweaks.scss +147 -0
- data/app/permissions/decidim/participatory_documents/admin/permissions.rb +118 -0
- data/app/permissions/decidim/participatory_documents/permissions.rb +16 -0
- data/app/presenters/decidim/participatory_documents/admin_log/annotation_presenter.rb +25 -0
- data/app/presenters/decidim/participatory_documents/admin_log/document_presenter.rb +13 -0
- data/app/presenters/decidim/participatory_documents/admin_log/section_presenter.rb +25 -0
- data/app/presenters/decidim/participatory_documents/admin_log/suggestion_note_presenter.rb +49 -0
- data/app/serializers/decidim/participatory_documents/suggestion_serializer.rb +67 -0
- data/app/uploaders/decidim/participatory_documents/pdf_document_uploader.rb +11 -0
- data/app/views/decidim/admin/exports/_dropdown.html.erb +16 -0
- data/app/views/decidim/participatory_documents/admin/documents/_editor_modal.html.erb +3 -0
- data/app/views/decidim/participatory_documents/admin/documents/_form.html.erb +39 -0
- data/app/views/decidim/participatory_documents/admin/documents/_title.html.erb +7 -0
- data/app/views/decidim/participatory_documents/admin/documents/edit.html.erb +18 -0
- data/app/views/decidim/participatory_documents/admin/documents/edit_pdf.html.erb +15 -0
- data/app/views/decidim/participatory_documents/admin/documents/index.html.erb +11 -0
- data/app/views/decidim/participatory_documents/admin/documents/new.html.erb +17 -0
- data/app/views/decidim/participatory_documents/admin/documents/pdf_viewer.html.erb +105 -0
- data/app/views/decidim/participatory_documents/admin/sections/_form.html.erb +24 -0
- data/app/views/decidim/participatory_documents/admin/suggestion_notes/_editing_suggestion_note.html.erb +18 -0
- data/app/views/decidim/participatory_documents/admin/suggestion_notes/_form.html.erb +8 -0
- data/app/views/decidim/participatory_documents/admin/suggestion_notes/_suggestion_notes.html.erb +46 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/_add_valuators.html.erb +17 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/_bulk-actions.html.erb +7 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/_form.html.erb +30 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/_js-callout.html.erb +6 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/_suggestion.html.erb +33 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/_valuators.html.erb +43 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/bulk_actions/_assign_to_valuator.html.erb +15 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/bulk_actions/_dropdown.html.erb +36 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/bulk_actions/_publish_answers.html.erb +14 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/bulk_actions/_unassign_from_valuator.html.erb +15 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/index.html.erb +45 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/publish_answers.js.erb +17 -0
- data/app/views/decidim/participatory_documents/admin/suggestions/show.html.erb +55 -0
- data/app/views/decidim/participatory_documents/document_suggestions/_form.html.erb +29 -0
- data/app/views/decidim/participatory_documents/document_suggestions/index.html.erb +14 -0
- data/app/views/decidim/participatory_documents/documents/_pdfjs_base.html.erb +428 -0
- data/app/views/decidim/participatory_documents/documents/index.html.erb +27 -0
- data/app/views/decidim/participatory_documents/documents/pdf_viewer.html.erb +63 -0
- data/app/views/decidim/participatory_documents/section_suggestions/_form.html.erb +8 -0
- data/app/views/decidim/participatory_documents/section_suggestions/index.html.erb +14 -0
- data/babel.config.json +25 -0
- data/bin/bundle +62 -0
- data/bin/rails +6 -0
- data/bin/webpack-dev-server +6 -0
- data/codecov.yml +11 -0
- data/config/assets.rb +11 -0
- data/config/i18n-tasks.yml +12 -0
- data/config/locales/en.yml +266 -0
- data/crowdin.yml +45 -0
- data/db/migrate/20221018112720_create_decidim_participatory_documents_document.rb +17 -0
- data/db/migrate/20221115233021_create_decidim_participatory_documents_participation_sections.rb +12 -0
- data/db/migrate/20221115233022_create_decidim_participatory_documents_annotations.rb +13 -0
- data/db/migrate/20221115233023_create_decidim_participatory_documents_suggestions.rb +17 -0
- data/db/migrate/20221115233024_create_decidim_participatory_documents_suggestion_notes.rb +15 -0
- data/db/migrate/20221115233024_create_decidim_participatory_documents_valuation_assignments.rb +12 -0
- data/db/migrate/20230616100340_add_published_at_to_decidim_participatory_documents_documents.rb +8 -0
- data/db/migrate/20230622081831_add_decidim_participatory_documents_box_positions.rb +37 -0
- data/decidim-participatory_documents.gemspec +30 -0
- data/lib/decidim/participatory_documents/admin.rb +8 -0
- data/lib/decidim/participatory_documents/admin_engine.rb +45 -0
- data/lib/decidim/participatory_documents/component.rb +202 -0
- data/lib/decidim/participatory_documents/engine.rb +46 -0
- data/lib/decidim/participatory_documents/seeds/Exampledocument.pdf +0 -0
- data/lib/decidim/participatory_documents/test/factories.rb +144 -0
- data/lib/decidim/participatory_documents/version.rb +9 -0
- data/lib/decidim/participatory_documents.rb +29 -0
- data/lib/tasks/decidim_participatory_documents.rake +27 -0
- data/package-lock.json +12687 -0
- data/package.json +52 -0
- data/pdfjs/LICENSE +177 -0
- data/pdfjs/README.md +12 -0
- data/pdfjs/build/pdf.js +15629 -0
- data/pdfjs/build/pdf.js.map +1 -0
- data/pdfjs/build/pdf.sandbox.js +280 -0
- data/pdfjs/build/pdf.sandbox.js.map +1 -0
- data/pdfjs/build/pdf.worker.js +64496 -0
- data/pdfjs/build/pdf.worker.js.map +1 -0
- data/pdfjs/web/cmaps/78-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/78-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/78-H.bcmap +0 -0
- data/pdfjs/web/cmaps/78-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/78-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/78-V.bcmap +0 -0
- data/pdfjs/web/cmaps/78ms-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/78ms-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/83pv-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/90ms-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/90ms-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/90msp-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/90msp-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/90pv-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/90pv-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Add-H.bcmap +0 -0
- data/pdfjs/web/cmaps/Add-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/Add-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Add-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-0.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-1.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-3.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-4.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-5.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-6.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-0.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-1.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-3.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-4.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-5.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-0.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-1.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-3.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-4.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-5.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-6.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Korea1-0.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Korea1-1.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Korea1-2.bcmap +0 -0
- data/pdfjs/web/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- data/pdfjs/web/cmaps/B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/B5pc-H.bcmap +0 -0
- data/pdfjs/web/cmaps/B5pc-V.bcmap +0 -0
- data/pdfjs/web/cmaps/CNS-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/CNS-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/CNS1-H.bcmap +0 -0
- data/pdfjs/web/cmaps/CNS1-V.bcmap +0 -0
- data/pdfjs/web/cmaps/CNS2-H.bcmap +0 -0
- data/pdfjs/web/cmaps/CNS2-V.bcmap +3 -0
- data/pdfjs/web/cmaps/ETHK-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/ETHK-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/ETen-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/ETen-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/ETenms-B5-H.bcmap +3 -0
- data/pdfjs/web/cmaps/ETenms-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Ext-H.bcmap +0 -0
- data/pdfjs/web/cmaps/Ext-RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/Ext-RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Ext-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GB-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GB-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GB-H.bcmap +4 -0
- data/pdfjs/web/cmaps/GB-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBK-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBK-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBK2K-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBK2K-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBKp-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBKp-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBT-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBT-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBT-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBT-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBTpc-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBTpc-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/GBpc-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/GBpc-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKdla-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKdla-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/HKdlb-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKdlb-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/HKgccs-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKgccs-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/HKm314-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKm314-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/HKm471-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKm471-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/HKscs-B5-H.bcmap +0 -0
- data/pdfjs/web/cmaps/HKscs-B5-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Hankaku.bcmap +0 -0
- data/pdfjs/web/cmaps/Hiragana.bcmap +0 -0
- data/pdfjs/web/cmaps/KSC-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/KSC-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/KSC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/KSC-Johab-H.bcmap +0 -0
- data/pdfjs/web/cmaps/KSC-Johab-V.bcmap +0 -0
- data/pdfjs/web/cmaps/KSC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/KSCms-UHC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- data/pdfjs/web/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- data/pdfjs/web/cmaps/KSCms-UHC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/KSCpc-EUC-H.bcmap +0 -0
- data/pdfjs/web/cmaps/KSCpc-EUC-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Katakana.bcmap +0 -0
- data/pdfjs/web/cmaps/LICENSE +36 -0
- data/pdfjs/web/cmaps/NWP-H.bcmap +0 -0
- data/pdfjs/web/cmaps/NWP-V.bcmap +0 -0
- data/pdfjs/web/cmaps/RKSJ-H.bcmap +0 -0
- data/pdfjs/web/cmaps/RKSJ-V.bcmap +0 -0
- data/pdfjs/web/cmaps/Roman.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UCS2-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UCS2-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UTF16-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UTF16-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UTF8-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniGB-UTF8-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UCS2-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UCS2-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UTF16-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UTF16-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UTF32-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UTF32-V.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UTF8-H.bcmap +0 -0
- data/pdfjs/web/cmaps/UniKS-UTF8-V.bcmap +0 -0
- data/pdfjs/web/cmaps/V.bcmap +0 -0
- data/pdfjs/web/cmaps/WP-Symbol.bcmap +0 -0
- data/pdfjs/web/compressed.tracemonkey-pldi-09.pdf +0 -0
- data/pdfjs/web/debugger.css +113 -0
- data/pdfjs/web/debugger.js +612 -0
- data/pdfjs/web/images/annotation-check.svg +11 -0
- data/pdfjs/web/images/annotation-comment.svg +16 -0
- data/pdfjs/web/images/annotation-help.svg +26 -0
- data/pdfjs/web/images/annotation-insert.svg +10 -0
- data/pdfjs/web/images/annotation-key.svg +11 -0
- data/pdfjs/web/images/annotation-newparagraph.svg +11 -0
- data/pdfjs/web/images/annotation-noicon.svg +7 -0
- data/pdfjs/web/images/annotation-note.svg +42 -0
- data/pdfjs/web/images/annotation-paperclip.svg +6 -0
- data/pdfjs/web/images/annotation-paragraph.svg +16 -0
- data/pdfjs/web/images/annotation-pushpin.svg +7 -0
- data/pdfjs/web/images/cursor-editorFreeText.svg +3 -0
- data/pdfjs/web/images/cursor-editorInk.svg +4 -0
- data/pdfjs/web/images/findbarButton-next.svg +3 -0
- data/pdfjs/web/images/findbarButton-previous.svg +3 -0
- data/pdfjs/web/images/loading-dark.svg +24 -0
- data/pdfjs/web/images/loading-icon.gif +0 -0
- data/pdfjs/web/images/loading.svg +1 -0
- data/pdfjs/web/images/secondaryToolbarButton-documentProperties.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-firstPage.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-handTool.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-lastPage.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-rotateCcw.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-rotateCw.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-scrollPage.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-scrollVertical.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-selectTool.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-spreadEven.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-spreadNone.svg +3 -0
- data/pdfjs/web/images/secondaryToolbarButton-spreadOdd.svg +3 -0
- data/pdfjs/web/images/shadow.png +0 -0
- data/pdfjs/web/images/toolbarButton-bookmark.svg +3 -0
- data/pdfjs/web/images/toolbarButton-currentOutlineItem.svg +3 -0
- data/pdfjs/web/images/toolbarButton-download.svg +4 -0
- data/pdfjs/web/images/toolbarButton-editorFreeText.svg +3 -0
- data/pdfjs/web/images/toolbarButton-editorInk.svg +4 -0
- data/pdfjs/web/images/toolbarButton-menuArrow.svg +3 -0
- data/pdfjs/web/images/toolbarButton-openFile.svg +3 -0
- data/pdfjs/web/images/toolbarButton-pageDown.svg +3 -0
- data/pdfjs/web/images/toolbarButton-pageUp.svg +3 -0
- data/pdfjs/web/images/toolbarButton-presentationMode.svg +3 -0
- data/pdfjs/web/images/toolbarButton-print.svg +3 -0
- data/pdfjs/web/images/toolbarButton-search.svg +3 -0
- data/pdfjs/web/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
- data/pdfjs/web/images/toolbarButton-sidebarToggle.svg +3 -0
- data/pdfjs/web/images/toolbarButton-viewAttachments.svg +3 -0
- data/pdfjs/web/images/toolbarButton-viewLayers.svg +3 -0
- data/pdfjs/web/images/toolbarButton-viewOutline.svg +3 -0
- data/pdfjs/web/images/toolbarButton-viewThumbnail.svg +3 -0
- data/pdfjs/web/images/toolbarButton-zoomIn.svg +3 -0
- data/pdfjs/web/images/toolbarButton-zoomOut.svg +3 -0
- data/pdfjs/web/images/treeitem-collapsed.svg +1 -0
- data/pdfjs/web/images/treeitem-expanded.svg +1 -0
- data/pdfjs/web/locale/ach/viewer.properties +200 -0
- data/pdfjs/web/locale/af/viewer.properties +177 -0
- data/pdfjs/web/locale/an/viewer.properties +243 -0
- data/pdfjs/web/locale/ar/viewer.properties +247 -0
- data/pdfjs/web/locale/ast/viewer.properties +207 -0
- data/pdfjs/web/locale/az/viewer.properties +243 -0
- data/pdfjs/web/locale/be/viewer.properties +274 -0
- data/pdfjs/web/locale/bg/viewer.properties +235 -0
- data/pdfjs/web/locale/bn/viewer.properties +239 -0
- data/pdfjs/web/locale/bo/viewer.properties +238 -0
- data/pdfjs/web/locale/br/viewer.properties +247 -0
- data/pdfjs/web/locale/brx/viewer.properties +205 -0
- data/pdfjs/web/locale/bs/viewer.properties +194 -0
- data/pdfjs/web/locale/ca/viewer.properties +251 -0
- data/pdfjs/web/locale/cak/viewer.properties +249 -0
- data/pdfjs/web/locale/ckb/viewer.properties +234 -0
- data/pdfjs/web/locale/cs/viewer.properties +274 -0
- data/pdfjs/web/locale/cy/viewer.properties +274 -0
- data/pdfjs/web/locale/da/viewer.properties +274 -0
- data/pdfjs/web/locale/de/viewer.properties +274 -0
- data/pdfjs/web/locale/dsb/viewer.properties +274 -0
- data/pdfjs/web/locale/el/viewer.properties +274 -0
- data/pdfjs/web/locale/en-CA/viewer.properties +274 -0
- data/pdfjs/web/locale/en-GB/viewer.properties +274 -0
- data/pdfjs/web/locale/en-US/viewer.properties +253 -0
- data/pdfjs/web/locale/eo/viewer.properties +274 -0
- data/pdfjs/web/locale/es-AR/viewer.properties +274 -0
- data/pdfjs/web/locale/es-CL/viewer.properties +274 -0
- data/pdfjs/web/locale/es-ES/viewer.properties +274 -0
- data/pdfjs/web/locale/es-MX/viewer.properties +274 -0
- data/pdfjs/web/locale/et/viewer.properties +262 -0
- data/pdfjs/web/locale/eu/viewer.properties +272 -0
- data/pdfjs/web/locale/fa/viewer.properties +216 -0
- data/pdfjs/web/locale/ff/viewer.properties +235 -0
- data/pdfjs/web/locale/fi/viewer.properties +274 -0
- data/pdfjs/web/locale/fr/viewer.properties +274 -0
- data/pdfjs/web/locale/fy-NL/viewer.properties +274 -0
- data/pdfjs/web/locale/ga-IE/viewer.properties +202 -0
- data/pdfjs/web/locale/gd/viewer.properties +249 -0
- data/pdfjs/web/locale/gl/viewer.properties +249 -0
- data/pdfjs/web/locale/gn/viewer.properties +274 -0
- data/pdfjs/web/locale/gu-IN/viewer.properties +235 -0
- data/pdfjs/web/locale/he/viewer.properties +274 -0
- data/pdfjs/web/locale/hi-IN/viewer.properties +235 -0
- data/pdfjs/web/locale/hr/viewer.properties +249 -0
- data/pdfjs/web/locale/hsb/viewer.properties +274 -0
- data/pdfjs/web/locale/hu/viewer.properties +274 -0
- data/pdfjs/web/locale/hy-AM/viewer.properties +239 -0
- data/pdfjs/web/locale/hye/viewer.properties +252 -0
- data/pdfjs/web/locale/ia/viewer.properties +274 -0
- data/pdfjs/web/locale/id/viewer.properties +274 -0
- data/pdfjs/web/locale/is/viewer.properties +274 -0
- data/pdfjs/web/locale/it/viewer.properties +215 -0
- data/pdfjs/web/locale/ja/viewer.properties +274 -0
- data/pdfjs/web/locale/ka/viewer.properties +274 -0
- data/pdfjs/web/locale/kab/viewer.properties +274 -0
- data/pdfjs/web/locale/kk/viewer.properties +274 -0
- data/pdfjs/web/locale/km/viewer.properties +210 -0
- data/pdfjs/web/locale/kn/viewer.properties +187 -0
- data/pdfjs/web/locale/ko/viewer.properties +274 -0
- data/pdfjs/web/locale/lij/viewer.properties +235 -0
- data/pdfjs/web/locale/lo/viewer.properties +145 -0
- data/pdfjs/web/locale/locale.properties +327 -0
- data/pdfjs/web/locale/lt/viewer.properties +260 -0
- data/pdfjs/web/locale/ltg/viewer.properties +213 -0
- data/pdfjs/web/locale/lv/viewer.properties +235 -0
- data/pdfjs/web/locale/meh/viewer.properties +111 -0
- data/pdfjs/web/locale/mk/viewer.properties +139 -0
- data/pdfjs/web/locale/mr/viewer.properties +231 -0
- data/pdfjs/web/locale/ms/viewer.properties +235 -0
- data/pdfjs/web/locale/my/viewer.properties +191 -0
- data/pdfjs/web/locale/nb-NO/viewer.properties +274 -0
- data/pdfjs/web/locale/ne-NP/viewer.properties +218 -0
- data/pdfjs/web/locale/nl/viewer.properties +274 -0
- data/pdfjs/web/locale/nn-NO/viewer.properties +274 -0
- data/pdfjs/web/locale/oc/viewer.properties +274 -0
- data/pdfjs/web/locale/pa-IN/viewer.properties +285 -0
- data/pdfjs/web/locale/pl/viewer.properties +274 -0
- data/pdfjs/web/locale/pt-BR/viewer.properties +274 -0
- data/pdfjs/web/locale/pt-PT/viewer.properties +274 -0
- data/pdfjs/web/locale/rm/viewer.properties +274 -0
- data/pdfjs/web/locale/ro/viewer.properties +241 -0
- data/pdfjs/web/locale/ru/viewer.properties +274 -0
- data/pdfjs/web/locale/sat/viewer.properties +198 -0
- data/pdfjs/web/locale/sc/viewer.properties +240 -0
- data/pdfjs/web/locale/scn/viewer.properties +101 -0
- data/pdfjs/web/locale/sco/viewer.properties +249 -0
- data/pdfjs/web/locale/si/viewer.properties +237 -0
- data/pdfjs/web/locale/sk/viewer.properties +274 -0
- data/pdfjs/web/locale/sl/viewer.properties +274 -0
- data/pdfjs/web/locale/son/viewer.properties +173 -0
- data/pdfjs/web/locale/sq/viewer.properties +267 -0
- data/pdfjs/web/locale/sr/viewer.properties +253 -0
- data/pdfjs/web/locale/sv-SE/viewer.properties +274 -0
- data/pdfjs/web/locale/szl/viewer.properties +245 -0
- data/pdfjs/web/locale/ta/viewer.properties +194 -0
- data/pdfjs/web/locale/te/viewer.properties +237 -0
- data/pdfjs/web/locale/tg/viewer.properties +274 -0
- data/pdfjs/web/locale/th/viewer.properties +274 -0
- data/pdfjs/web/locale/tl/viewer.properties +243 -0
- data/pdfjs/web/locale/tr/viewer.properties +274 -0
- data/pdfjs/web/locale/trs/viewer.properties +206 -0
- data/pdfjs/web/locale/uk/viewer.properties +274 -0
- data/pdfjs/web/locale/ur/viewer.properties +239 -0
- data/pdfjs/web/locale/uz/viewer.properties +163 -0
- data/pdfjs/web/locale/vi/viewer.properties +274 -0
- data/pdfjs/web/locale/wo/viewer.properties +123 -0
- data/pdfjs/web/locale/xh/viewer.properties +177 -0
- data/pdfjs/web/locale/zh-CN/viewer.properties +274 -0
- data/pdfjs/web/locale/zh-TW/viewer.properties +274 -0
- data/pdfjs/web/standard_fonts/FoxitDingbats.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitFixed.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitFixedBold.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitFixedItalic.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSans.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSansBold.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSansBoldItalic.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSansItalic.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSerif.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSerifBold.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSerifItalic.pfb +0 -0
- data/pdfjs/web/standard_fonts/FoxitSymbol.pfb +0 -0
- data/pdfjs/web/standard_fonts/LICENSE_FOXIT +27 -0
- data/pdfjs/web/standard_fonts/LICENSE_LIBERATION +102 -0
- data/pdfjs/web/standard_fonts/LiberationSans-Bold.ttf +0 -0
- data/pdfjs/web/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- data/pdfjs/web/standard_fonts/LiberationSans-Italic.ttf +0 -0
- data/pdfjs/web/standard_fonts/LiberationSans-Regular.ttf +0 -0
- data/pdfjs/web/viewer.css +3029 -0
- data/pdfjs/web/viewer.html +433 -0
- data/pdfjs/web/viewer.js +13566 -0
- data/pdfjs/web/viewer.js.map +1 -0
- metadata +643 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class DestroyAnnotation < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# form - A form object with the params.
|
10
|
+
def initialize(form, document)
|
11
|
+
@form = form
|
12
|
+
@document = document
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
return broadcast(:invalid) if form.invalid?
|
17
|
+
|
18
|
+
begin
|
19
|
+
@old_section = annotation.section
|
20
|
+
transaction do
|
21
|
+
destroy_annotation!
|
22
|
+
end
|
23
|
+
|
24
|
+
destroy_old_section!
|
25
|
+
document.update_positions!
|
26
|
+
|
27
|
+
broadcast(:ok)
|
28
|
+
rescue ActiveRecord::RecordInvalid
|
29
|
+
broadcast(:invalid)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :form, :document
|
36
|
+
|
37
|
+
def destroy_annotation!
|
38
|
+
Decidim.traceability.perform_action!(
|
39
|
+
:delete,
|
40
|
+
annotation,
|
41
|
+
form.current_user
|
42
|
+
) do
|
43
|
+
annotation.destroy!
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Destroys the old section if has no more annotations
|
48
|
+
def destroy_old_section!
|
49
|
+
return unless @old_section
|
50
|
+
return if @old_section.annotations.reload.any?
|
51
|
+
|
52
|
+
Decidim.traceability.perform_action!(
|
53
|
+
:delete,
|
54
|
+
@old_section,
|
55
|
+
form.current_user
|
56
|
+
) do
|
57
|
+
@old_section.destroy!
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def annotation
|
62
|
+
@annotation ||= document.annotations.find(form.id)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class NotifySuggestionAnswer < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# suggestion - The suggestion to write the answer for.
|
10
|
+
# initial_state - The suggestion state before the current process.
|
11
|
+
def initialize(suggestion, initial_state)
|
12
|
+
@suggestion = suggestion
|
13
|
+
@initial_state = initial_state.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
# Executes the command. Broadcasts these events:
|
17
|
+
#
|
18
|
+
# - :noop when the answer is not published or the state didn't changed.
|
19
|
+
# - :ok when everything is valid.
|
20
|
+
#
|
21
|
+
# Returns nothing.
|
22
|
+
def call
|
23
|
+
broadcast(:invalid) unless suggestion.has_answer? && suggestion.answered? && suggestion.answer_is_published?
|
24
|
+
|
25
|
+
notify_followers
|
26
|
+
|
27
|
+
broadcast(:ok)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :suggestion, :initial_state
|
33
|
+
|
34
|
+
def notify_followers
|
35
|
+
publish_event(
|
36
|
+
"decidim.events.participatory_documents.suggestion_answered",
|
37
|
+
Decidim::ParticipatoryDocuments::SuggestionAnswerEvent
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def publish_event(event, event_class)
|
42
|
+
Decidim::EventsManager.publish(
|
43
|
+
event: event,
|
44
|
+
event_class: event_class,
|
45
|
+
resource: suggestion,
|
46
|
+
affected_users: [suggestion.author]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class PublishAnswers < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# component - The component that contains the answers.
|
10
|
+
# user - the Decidim::User that is publishing the answers.
|
11
|
+
# proposal_ids - the identifiers of the suggestions with the answers to be published.
|
12
|
+
def initialize(component, user, suggestion_ids)
|
13
|
+
@component = component
|
14
|
+
@user = user
|
15
|
+
@suggestion_ids = suggestion_ids
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if there are not proposals to publish.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) unless suggestions.any?
|
26
|
+
|
27
|
+
suggestions.each do |suggestion|
|
28
|
+
suggestion.assign_attributes(answered_at: Time.current, answer_is_published: true)
|
29
|
+
|
30
|
+
if suggestion.answer_is_published_changed?
|
31
|
+
Decidim.traceability.perform_action!("publish_answer", suggestion, user) { suggestion.save! }
|
32
|
+
notify_user(suggestion)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
broadcast(:ok)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def notify_user(suggestion)
|
42
|
+
suggestion.reload
|
43
|
+
return unless suggestion.has_answer?
|
44
|
+
|
45
|
+
NotifySuggestionAnswer.call(suggestion, nil)
|
46
|
+
end
|
47
|
+
|
48
|
+
attr_reader :component, :user, :suggestion_ids
|
49
|
+
|
50
|
+
def suggestions
|
51
|
+
@suggestions || Decidim::ParticipatoryDocuments::Suggestion
|
52
|
+
# .not_published
|
53
|
+
# .having_text_answer
|
54
|
+
.where(id: suggestion_ids)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class PublishDocument < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# document - The document to publish.
|
10
|
+
def initialize(document)
|
11
|
+
@document = document
|
12
|
+
end
|
13
|
+
|
14
|
+
# Executes the command. Broadcasts these events:
|
15
|
+
#
|
16
|
+
# - :ok when everything is valid.
|
17
|
+
# Returns nothing.
|
18
|
+
def call
|
19
|
+
@document.publish!
|
20
|
+
|
21
|
+
broadcast(:ok)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class UnassignSuggestionsFromValuator < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# form - A form object with the params.
|
10
|
+
def initialize(form)
|
11
|
+
@form = form
|
12
|
+
end
|
13
|
+
|
14
|
+
# Executes the command. Broadcasts these events:
|
15
|
+
#
|
16
|
+
# - :ok when everything is valid.
|
17
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
18
|
+
#
|
19
|
+
# Returns nothing.
|
20
|
+
def call
|
21
|
+
return broadcast(:invalid) unless form.valid?
|
22
|
+
|
23
|
+
unassign_suggestions
|
24
|
+
broadcast(:ok)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :form
|
30
|
+
|
31
|
+
def unassign_suggestions
|
32
|
+
transaction do
|
33
|
+
form.suggestions.flat_map do |suggestion|
|
34
|
+
assignment = find_assignment(suggestion)
|
35
|
+
unassign(assignment) if assignment
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_assignment(suggestion)
|
41
|
+
Decidim::ParticipatoryDocuments::ValuationAssignment.find_by(
|
42
|
+
suggestion: suggestion,
|
43
|
+
valuator_role: form.valuator_role
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def unassign(assignment)
|
48
|
+
Decidim.traceability.perform_action!(
|
49
|
+
:delete,
|
50
|
+
assignment,
|
51
|
+
form.current_user,
|
52
|
+
suggestion: assignment.suggestion.id
|
53
|
+
) do
|
54
|
+
assignment.destroy!
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class UpdateDocument < Decidim::Command
|
7
|
+
include ::Decidim::AttachmentAttributesMethods
|
8
|
+
|
9
|
+
def initialize(form, document)
|
10
|
+
@form = form
|
11
|
+
@document = document
|
12
|
+
@attached_to = document
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
return broadcast(:invalid) if form.invalid?
|
17
|
+
|
18
|
+
begin
|
19
|
+
transaction do
|
20
|
+
destroy_sections!
|
21
|
+
update_document
|
22
|
+
end
|
23
|
+
broadcast(:ok, document)
|
24
|
+
rescue ActiveRecord::RecordNotDestroyed => e
|
25
|
+
# if sections contains annotations, can be deleted
|
26
|
+
# if sections contains suggestions, cannot be deleted
|
27
|
+
broadcast(:error, e.message)
|
28
|
+
rescue ActiveRecord::RecordInvalid
|
29
|
+
form.errors.add(:file, document.errors[:file]) if document.errors.include? :file
|
30
|
+
broadcast(:invalid)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :form, :document
|
37
|
+
|
38
|
+
def attributes
|
39
|
+
{
|
40
|
+
title: form.title,
|
41
|
+
description: form.description,
|
42
|
+
box_color: form.box_color,
|
43
|
+
box_opacity: form.box_opacity
|
44
|
+
}.merge(attachment_attributes(:file))
|
45
|
+
end
|
46
|
+
|
47
|
+
def update_document
|
48
|
+
Decidim.traceability.update!(
|
49
|
+
document,
|
50
|
+
form.current_user,
|
51
|
+
**attributes
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def destroy_sections!
|
56
|
+
return if form.file.blank?
|
57
|
+
|
58
|
+
raise ActiveRecord::RecordNotDestroyed, I18n.t("activemodel.errors.models.document.has_suggestions") if document.has_suggestions?
|
59
|
+
|
60
|
+
return unless document.sections.any?
|
61
|
+
|
62
|
+
document.annotations.each do |annotation|
|
63
|
+
Decidim.traceability.perform_action!(
|
64
|
+
"delete",
|
65
|
+
annotation,
|
66
|
+
current_user
|
67
|
+
) do
|
68
|
+
annotation.destroy!
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
document.sections.each do |section|
|
73
|
+
Decidim.traceability.perform_action!(
|
74
|
+
"delete",
|
75
|
+
section,
|
76
|
+
current_user
|
77
|
+
) do
|
78
|
+
section.destroy!
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class UpdateOrCreateAnnotation < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# form - A form object with the params.
|
10
|
+
def initialize(form, document)
|
11
|
+
@form = form
|
12
|
+
@document = document
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
return broadcast(:invalid) if form.invalid?
|
17
|
+
return broadcast(:invalid) if document.nil?
|
18
|
+
|
19
|
+
begin
|
20
|
+
@old_section = annotation.present? ? annotation.section : nil
|
21
|
+
|
22
|
+
transaction do
|
23
|
+
create_section! if section.blank?
|
24
|
+
create_annotation! if annotation.blank?
|
25
|
+
annotation.assign_attributes(**attributes)
|
26
|
+
update_annotation! if annotation.changed?
|
27
|
+
end
|
28
|
+
|
29
|
+
destroy_old_section!
|
30
|
+
document.update_positions!
|
31
|
+
|
32
|
+
broadcast(:ok, annotation)
|
33
|
+
rescue ActiveRecord::RecordInvalid
|
34
|
+
broadcast(:invalid)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_reader :form, :document
|
41
|
+
|
42
|
+
def update_annotation!
|
43
|
+
@annotation = Decidim.traceability.update!(
|
44
|
+
annotation,
|
45
|
+
form.current_user,
|
46
|
+
**attributes
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_annotation!
|
51
|
+
@annotation = Decidim.traceability.create!(
|
52
|
+
Decidim::ParticipatoryDocuments::Annotation,
|
53
|
+
form.current_user,
|
54
|
+
**attributes
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_section!
|
59
|
+
@section = Decidim.traceability.create!(
|
60
|
+
Decidim::ParticipatoryDocuments::Section,
|
61
|
+
form.current_user,
|
62
|
+
document: document
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Destroys the old section if has no more annotations
|
67
|
+
def destroy_old_section!
|
68
|
+
return unless @old_section
|
69
|
+
return if @old_section.annotations.reload.any?
|
70
|
+
|
71
|
+
Decidim.traceability.perform_action!(
|
72
|
+
:delete,
|
73
|
+
@old_section,
|
74
|
+
form.current_user
|
75
|
+
) do
|
76
|
+
@old_section.destroy!
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def attributes
|
81
|
+
{
|
82
|
+
page_number: form.page_number,
|
83
|
+
rect: form.rect,
|
84
|
+
section: section
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
def section
|
89
|
+
@section ||= document.sections.find_by(id: form.section)
|
90
|
+
end
|
91
|
+
|
92
|
+
def annotation
|
93
|
+
@annotation ||= document.annotations.find_by(id: form.id)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
class UpdateSection < Decidim::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# form - A form object with the params.
|
10
|
+
def initialize(form, document)
|
11
|
+
@form = form
|
12
|
+
@document = document
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
return broadcast(:invalid) if form.invalid?
|
17
|
+
|
18
|
+
begin
|
19
|
+
transaction do
|
20
|
+
update_section
|
21
|
+
end
|
22
|
+
broadcast(:ok, section)
|
23
|
+
rescue ActiveRecord::RecordInvalid
|
24
|
+
broadcast(:invalid)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
attr_reader :form, :document
|
31
|
+
|
32
|
+
def update_section
|
33
|
+
@zone = Decidim.traceability.update!(
|
34
|
+
section,
|
35
|
+
form.current_user,
|
36
|
+
**attributes
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
def attributes
|
41
|
+
{
|
42
|
+
title: form.title
|
43
|
+
}.merge(document: document)
|
44
|
+
end
|
45
|
+
|
46
|
+
def section
|
47
|
+
@section ||= document.sections.find(form.id)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic when a user updates a suggestion note.
|
7
|
+
class UpdateSuggestionNote < Decidim::Command
|
8
|
+
# Public: Initializes the command.
|
9
|
+
#
|
10
|
+
# form - A form object with the params.
|
11
|
+
# note - the suggestion note to update.
|
12
|
+
def initialize(notes_form, note)
|
13
|
+
@notes_form = notes_form
|
14
|
+
@note = note
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
return broadcast(:invalid) if notes_form.invalid?
|
19
|
+
|
20
|
+
update_suggestion_note
|
21
|
+
|
22
|
+
broadcast(:ok, note)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :notes_form, :note, :suggestion
|
28
|
+
|
29
|
+
def update_suggestion_note
|
30
|
+
note.body = notes_form.body
|
31
|
+
note.save!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
class CreateSuggestion < Decidim::Command
|
6
|
+
include ::Decidim::AttachmentMethods
|
7
|
+
|
8
|
+
def initialize(form, suggestable)
|
9
|
+
@form = form
|
10
|
+
@suggestable = suggestable
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
return broadcast(:invalid) if form.invalid?
|
15
|
+
|
16
|
+
begin
|
17
|
+
transaction do
|
18
|
+
create_suggestion
|
19
|
+
end
|
20
|
+
broadcast(:ok, suggestion)
|
21
|
+
rescue ActiveRecord::RecordInvalid => e
|
22
|
+
Rails.logger.info e.message
|
23
|
+
broadcast(:invalid, e.message)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :form, :suggestion, :suggestable
|
30
|
+
|
31
|
+
def create_suggestion
|
32
|
+
@suggestion = Decidim.traceability.create!(
|
33
|
+
Decidim::ParticipatoryDocuments::Suggestion,
|
34
|
+
form.current_user,
|
35
|
+
{ body: { I18n.locale => form.body },
|
36
|
+
suggestable: suggestable,
|
37
|
+
author: form.current_user },
|
38
|
+
visibility: "public-only"
|
39
|
+
)
|
40
|
+
|
41
|
+
create_suggestion_attachment if form.file.present?
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_suggestion_attachment
|
45
|
+
file = form.file
|
46
|
+
file_blob = ActiveStorage::Blob.create_after_upload!(
|
47
|
+
io: file.open,
|
48
|
+
filename: file.original_filename,
|
49
|
+
content_type: file.content_type
|
50
|
+
)
|
51
|
+
|
52
|
+
attachment = Decidim::Attachment.create!(
|
53
|
+
file: file_blob,
|
54
|
+
attached_to: suggestion,
|
55
|
+
content_type: file.content_type,
|
56
|
+
title: { I18n.locale => file.original_filename }
|
57
|
+
)
|
58
|
+
|
59
|
+
suggestion.file.attach(attachment.file.blob)
|
60
|
+
|
61
|
+
suggestion.save!
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryDocuments
|
5
|
+
module Admin
|
6
|
+
# This module adds custom javascript and css for the admin controllers related to participatory documents
|
7
|
+
module NeedsAdminSnippets
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
before_action :add_snippets
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def add_snippets
|
16
|
+
return unless respond_to?(:snippets)
|
17
|
+
|
18
|
+
snippets.add(:head, helpers.stylesheet_pack_tag("decidim_participatory_documents_admin"))
|
19
|
+
snippets.add(:foot, helpers.javascript_pack_tag("decidim_participatory_documents_admin"))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|