decidim 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.eslintrc.json +2 -1
- data/Gemfile.lock +121 -112
- data/README.md +28 -10
- data/Rakefile +1 -1
- data/decidim-admin/README.md +1 -1
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_sidebar.scss +30 -1
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_tables.scss +3 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/application.scss +3 -0
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process.rb +4 -1
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +26 -7
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_group.rb +54 -0
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_step.rb +0 -1
- data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +3 -1
- data/decidim-admin/app/commands/decidim/admin/hide_resource.rb +37 -0
- data/decidim-admin/app/commands/decidim/admin/reorder_participatory_process_steps.rb +1 -0
- data/decidim-admin/app/commands/decidim/admin/unreport_resource.rb +33 -0
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +4 -2
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process_group.rb +57 -0
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process_step.rb +1 -2
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +4 -0
- data/decidim-admin/app/controllers/decidim/admin/categories_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -2
- data/decidim-admin/{lib → app/controllers}/decidim/admin/features/base_controller.rb +0 -0
- data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +64 -0
- data/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_groups_controller.rb +86 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_steps_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +3 -3
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +3 -2
- data/decidim-admin/app/forms/decidim/admin/organization_form.rb +1 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +12 -1
- data/decidim-admin/app/forms/decidim/admin/participatory_process_group_form.rb +23 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_step_form.rb +0 -1
- data/decidim-admin/app/forms/decidim/admin/participatory_process_user_role_form.rb +5 -1
- data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +1 -0
- data/decidim-admin/app/helpers/decidim/admin/process_groups_for_select_helper.rb +20 -0
- data/decidim-admin/app/helpers/decidim/admin/processes_for_select_helper.rb +22 -0
- data/decidim-admin/app/models/decidim/admin/abilities/admin_user.rb +2 -0
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_admin.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb +1 -1
- data/decidim-admin/app/queries/decidim/admin/process_admins.rb +43 -0
- data/decidim-admin/app/views/decidim/admin/moderations/index.html.erb +65 -0
- data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +4 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/_form.html.erb +17 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/edit.html.erb +13 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/index.html.erb +38 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/new.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/show.html.erb +23 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/_form.html.erb +0 -4
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/show.html.erb +4 -5
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +27 -24
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +10 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/show.html.erb +15 -1
- data/decidim-admin/app/views/layouts/decidim/admin/_header.html.erb +1 -0
- data/decidim-admin/app/views/layouts/decidim/admin/_language_chooser.html.erb +14 -0
- data/decidim-admin/app/views/layouts/decidim/admin/_sidebar.html.erb +2 -0
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +5 -0
- data/decidim-admin/config/i18n-tasks.yml +3 -1
- data/decidim-admin/config/locales/ca.yml +83 -3
- data/decidim-admin/config/locales/en.yml +81 -1
- data/decidim-admin/config/locales/es.yml +81 -1
- data/decidim-admin/config/locales/eu.yml +340 -1
- data/decidim-admin/config/locales/fi.yml +464 -0
- data/decidim-admin/config/routes.rb +8 -0
- data/decidim-admin/db/seeds.rb +1 -1
- data/decidim-admin/lib/decidim/admin/engine.rb +1 -0
- data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +10 -4
- data/decidim-admin/spec/commands/create_participatory_process_spec.rb +6 -1
- data/decidim-admin/spec/commands/hide_resource_spec.rb +41 -0
- data/decidim-admin/spec/commands/unreport_resource_spec.rb +42 -0
- data/decidim-admin/spec/commands/update_organization_spec.rb +1 -0
- data/decidim-admin/spec/features/admin_invite_spec.rb +1 -0
- data/decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_organization_admins_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_participatory_process_groups_spec.rb +107 -0
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +5 -0
- data/decidim-admin/spec/features/admin_manages_user_groups_spec.rb +11 -4
- data/decidim-admin/spec/forms/organization_form_spec.rb +2 -0
- data/decidim-admin/spec/forms/participatory_process_group_form_spec.rb +86 -0
- data/decidim-admin/spec/forms/participatory_process_step_form_spec.rb +0 -10
- data/decidim-admin/spec/forms/participatory_process_user_role_form_spec.rb +4 -0
- data/decidim-admin/spec/models/abilities/admin_user_spec.rb +3 -2
- data/decidim-admin/spec/models/abilities/participatory_process_admin_spec.rb +7 -0
- data/decidim-admin/spec/queries/process_admins_spec.rb +23 -0
- data/decidim-admin/spec/shared/manage_process_admins_examples.rb +2 -0
- data/decidim-admin/spec/shared/manage_process_steps_examples.rb +0 -10
- data/decidim-api/decidim-api.gemspec +1 -1
- data/decidim-budgets/app/commands/decidim/budgets/add_line_item.rb +9 -1
- data/decidim-budgets/app/controllers/decidim/budgets/admin/projects_controller.rb +13 -1
- data/decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb +5 -1
- data/decidim-budgets/app/models/decidim/budgets/order.rb +3 -0
- data/decidim-budgets/app/models/decidim/budgets/project.rb +9 -1
- data/decidim-budgets/app/services/decidim/budgets/project_search.rb +0 -5
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/_form.html.erb +5 -3
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/index.html.erb +9 -0
- data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +1 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_filters.html.erb +2 -2
- data/decidim-budgets/app/views/decidim/budgets/projects/_filters_small_view.html.erb +18 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +17 -2
- data/decidim-budgets/app/views/decidim/budgets/projects/_project_budget_button.html.erb +2 -2
- data/decidim-budgets/app/views/decidim/budgets/projects/_tags.html.erb +1 -1
- data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +2 -1
- data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +7 -1
- data/decidim-budgets/config/i18n-tasks.yml +1 -0
- data/decidim-budgets/config/locales/ca.yml +18 -3
- data/decidim-budgets/config/locales/en.yml +15 -0
- data/decidim-budgets/config/locales/es.yml +17 -2
- data/decidim-budgets/config/locales/eu.yml +97 -1
- data/decidim-budgets/config/locales/fi.yml +123 -0
- data/decidim-budgets/db/migrate/20170215132708_add_reference_to_projects.rb +7 -0
- data/decidim-budgets/lib/decidim/budgets/feature.rb +4 -2
- data/decidim-budgets/lib/decidim/budgets/seeds/Exampledocument.pdf +0 -0
- data/decidim-budgets/lib/decidim/budgets/seeds/city.jpeg +0 -0
- data/decidim-budgets/lib/decidim/budgets/test/factories.rb +21 -1
- data/decidim-budgets/spec/commands/add_line_item_spec.rb +10 -1
- data/decidim-budgets/spec/features/comments_spec.rb +10 -0
- data/decidim-budgets/spec/features/orders_spec.rb +47 -3
- data/decidim-budgets/spec/models/project_spec.rb +16 -1
- data/decidim-budgets/spec/services/project_search_spec.rb +9 -0
- data/decidim-budgets/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-budgets/spec/shared/manage_projects_examples.rb +22 -0
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/commands/decidim/comments/create_comment.rb +9 -1
- data/decidim-comments/app/frontend/application/icon.component.jsx +1 -1
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +11 -10
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +5 -5
- data/decidim-comments/app/frontend/comments/comment.component.jsx +91 -1
- data/decidim-comments/app/frontend/comments/comment.component.test.jsx +18 -0
- data/decidim-comments/app/frontend/comments/comment_data.fragment.graphql +2 -0
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +4 -5
- data/decidim-comments/app/frontend/comments/comments.query.graphql +1 -0
- data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +8 -0
- data/decidim-comments/app/models/decidim/comments/abilities/admin_user.rb +25 -0
- data/decidim-comments/app/models/decidim/comments/abilities/process_admin_user.rb +33 -0
- data/decidim-comments/app/models/decidim/comments/comment.rb +7 -1
- data/decidim-comments/app/models/decidim/comments/comment_vote.rb +3 -1
- data/decidim-comments/app/queries/decidim/comments/sorted_comments.rb +1 -0
- data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +1 -1
- data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +1 -1
- data/decidim-comments/config/locales/ca.yml +11 -0
- data/decidim-comments/config/locales/en.yml +12 -2
- data/decidim-comments/config/locales/es.yml +11 -0
- data/decidim-comments/config/locales/eu.yml +38 -1
- data/decidim-comments/config/locales/fi.yml +66 -0
- data/decidim-comments/lib/decidim/comments.rb +2 -0
- data/decidim-comments/lib/decidim/comments/admin.rb +9 -0
- data/decidim-comments/lib/decidim/comments/admin_engine.rb +22 -0
- data/decidim-comments/lib/decidim/comments/api/comment_type.rb +12 -0
- data/decidim-comments/lib/decidim/comments/commentable.rb +0 -2
- data/decidim-comments/lib/decidim/comments/engine.rb +1 -0
- data/decidim-comments/lib/decidim/comments/test/factories.rb +3 -0
- data/decidim-comments/spec/commands/create_comment_spec.rb +11 -0
- data/decidim-comments/spec/features/admin_manages_comments_spec.rb +23 -0
- data/decidim-comments/spec/features/comments_spec.rb +5 -173
- data/decidim-comments/spec/features/process_admin_manages_comments_spec.rb +24 -0
- data/decidim-comments/spec/features/report_comment_spec.rb +20 -0
- data/decidim-comments/spec/models/abilities/admin_user_spec.rb +20 -0
- data/decidim-comments/spec/models/abilities/process_admin_user_spec.rb +21 -0
- data/decidim-comments/spec/models/comment_spec.rb +1 -0
- data/decidim-comments/spec/queries/sorted_comments_spec.rb +11 -0
- data/decidim-comments/spec/shared/admin_shared_context.rb +11 -0
- data/decidim-comments/spec/types/comment_type_spec.rb +19 -0
- data/decidim-dev/config/locales/ca.yml +1 -1
- data/decidim-dev/config/locales/en.yml +1 -1
- data/decidim-dev/config/locales/es.yml +1 -1
- data/decidim-dev/config/locales/eu.yml +1 -1
- data/decidim-dev/config/locales/fi.yml +5 -0
- data/decidim-dev/decidim-dev.gemspec +3 -1
- data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +1 -28
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +11 -0
- data/{decidim-meetings/spec/support → decidim-dev/lib/decidim/dev/test/rspec_support}/geocoder.rb +5 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/html_matchers.rb +6 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +3 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/webmock.rb +2 -0
- data/decidim-dev/lib/decidim/dev/test/spec_helper.rb +37 -0
- data/decidim-dev/lib/generators/decidim/dummy_generator.rb +5 -0
- data/decidim-dev/lib/generators/decidim/templates/autoprefixer.yml +8 -0
- data/decidim-dev/lib/generators/decidim/templates/autoprefixer_initializer.rb +16 -0
- data/decidim-meetings/app/commands/decidim/meetings/admin/create_meeting.rb +6 -17
- data/decidim-meetings/app/commands/decidim/meetings/admin/update_meeting.rb +6 -7
- data/decidim-meetings/app/controllers/decidim/meetings/application_controller.rb +1 -0
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +14 -9
- data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +12 -1
- data/decidim-meetings/app/helpers/decidim/meetings/admin/application_helper.rb +1 -1
- data/decidim-meetings/app/helpers/decidim/meetings/application_helper.rb +2 -1
- data/decidim-meetings/app/helpers/decidim/meetings/map_helper.rb +10 -32
- data/decidim-meetings/app/models/decidim/meetings/meeting.rb +2 -1
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +0 -5
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/_form.html.erb +5 -3
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +5 -3
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters_small_view.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +11 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_tags.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +27 -32
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.js.erb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +2 -15
- data/decidim-meetings/config/i18n-tasks.yml +1 -1
- data/decidim-meetings/config/locales/ca.yml +18 -3
- data/decidim-meetings/config/locales/en.yml +20 -3
- data/decidim-meetings/config/locales/es.yml +18 -3
- data/decidim-meetings/config/locales/eu.yml +75 -1
- data/decidim-meetings/config/locales/fi.yml +98 -0
- data/decidim-meetings/db/migrate/20170215132546_add_reference_to_meetings.rb +7 -0
- data/decidim-meetings/decidim-meetings.gemspec +0 -2
- data/decidim-meetings/lib/decidim/meetings/admin_engine.rb +0 -26
- data/decidim-meetings/lib/decidim/meetings/list_engine.rb +1 -9
- data/decidim-meetings/spec/commands/create_meeting_spec.rb +6 -14
- data/decidim-meetings/spec/commands/update_meeting_spec.rb +10 -29
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +37 -13
- data/decidim-meetings/spec/forms/meeting_form_spec.rb +15 -1
- data/decidim-meetings/spec/models/meeting_spec.rb +1 -0
- data/decidim-meetings/spec/services/meeting_search_spec.rb +9 -0
- data/decidim-meetings/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-meetings/spec/shared/manage_meetings_examples.rb +97 -1
- data/decidim-meetings/spec/spec_helper.rb +0 -5
- data/decidim-pages/app/commands/decidim/pages/admin/update_page.rb +1 -4
- data/decidim-pages/app/commands/decidim/pages/create_page.rb +1 -4
- data/decidim-pages/app/forms/decidim/pages/admin/page_form.rb +0 -3
- data/decidim-pages/app/models/decidim/pages/page.rb +8 -12
- data/decidim-pages/app/views/decidim/pages/admin/pages/_form.html.erb +0 -1
- data/decidim-pages/app/views/decidim/pages/application/show.html.erb +0 -1
- data/decidim-pages/config/locales/ca.yml +0 -1
- data/decidim-pages/config/locales/en.yml +0 -1
- data/decidim-pages/config/locales/es.yml +0 -1
- data/decidim-pages/config/locales/eu.yml +14 -1
- data/decidim-pages/config/locales/fi.yml +22 -0
- data/decidim-pages/db/migrate/20170220091402_remove_page_feature_titles.rb +5 -0
- data/decidim-pages/lib/decidim/pages/engine.rb +1 -0
- data/decidim-pages/lib/decidim/pages/feature.rb +4 -1
- data/decidim-pages/spec/commands/create_page_spec.rb +1 -2
- data/decidim-pages/spec/commands/update_page_spec.rb +0 -1
- data/decidim-pages/spec/factories.rb +6 -1
- data/decidim-pages/spec/features/admin_spec.rb +1 -17
- data/decidim-pages/spec/features/comments_spec.rb +10 -0
- data/decidim-pages/spec/features/page_show_spec.rb +1 -10
- data/decidim-pages/spec/forms/page_form_spec.rb +0 -21
- data/decidim-pages/spec/models/page_spec.rb +2 -4
- data/decidim-proposals/app/commands/decidim/proposals/admin/create_proposal.rb +4 -1
- data/decidim-proposals/app/commands/decidim/proposals/create_proposal.rb +4 -1
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +4 -0
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +12 -6
- data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_form.rb +13 -2
- data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +13 -2
- data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +3 -0
- data/decidim-proposals/app/helpers/decidim/proposals/map_helper.rb +19 -0
- data/decidim-proposals/app/helpers/decidim/proposals/proposal_order_helper.rb +16 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/admin_user.rb +2 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/current_user.rb +3 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/process_admin_user.rb +2 -1
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +12 -3
- data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +0 -5
- data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/_form.html.erb +8 -2
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +12 -14
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +2 -2
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +27 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +8 -2
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +18 -1
- data/decidim-proposals/config/i18n-tasks.yml +3 -1
- data/decidim-proposals/config/locales/ca.yml +11 -8
- data/decidim-proposals/config/locales/en.yml +9 -6
- data/decidim-proposals/config/locales/es.yml +14 -11
- data/decidim-proposals/config/locales/eu.yml +119 -1
- data/decidim-proposals/config/locales/fi.yml +143 -0
- data/decidim-proposals/db/migrate/20170215113152_create_proposal_reports.rb +14 -0
- data/decidim-proposals/db/migrate/20170215131720_add_report_count_to_proposals.rb +5 -0
- data/decidim-proposals/db/migrate/20170215132030_add_reference_to_proposals.rb +7 -0
- data/decidim-proposals/db/migrate/20170220152416_add_hidden_at_to_proposals.rb +5 -0
- data/decidim-proposals/db/migrate/20170228105156_add_geolocalization_fields_to_proposals.rb +7 -0
- data/decidim-proposals/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +26 -0
- data/decidim-proposals/decidim-proposals.gemspec +1 -1
- data/decidim-proposals/lib/decidim/proposals/feature.rb +4 -3
- data/decidim-proposals/lib/decidim/proposals/test/factories.rb +8 -0
- data/decidim-proposals/spec/features/admin_manages_proposals_spec.rb +3 -0
- data/decidim-proposals/spec/features/comments_spec.rb +11 -0
- data/decidim-proposals/spec/features/process_admin_manages_proposals_spec.rb +3 -0
- data/decidim-proposals/spec/features/proposals_spec.rb +98 -15
- data/decidim-proposals/spec/features/report_proposal_spec.rb +19 -0
- data/decidim-proposals/spec/helpers/proposal_order_helper_spec.rb +30 -0
- data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +2 -0
- data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +9 -0
- data/decidim-proposals/spec/shared/create_proposal_examples.rb +29 -2
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +95 -26
- data/decidim-proposals/spec/shared/proposal_form_examples.rb +29 -1
- data/decidim-results/app/forms/decidim/results/admin/result_form.rb +9 -1
- data/decidim-results/app/models/decidim/results/result.rb +2 -1
- data/decidim-results/app/services/decidim/results/result_search.rb +0 -5
- data/decidim-results/app/views/decidim/results/admin/results/_form.html.erb +5 -3
- data/decidim-results/app/views/decidim/results/results/_filters.html.erb +2 -2
- data/decidim-results/app/views/decidim/results/results/_filters_small_view.html.erb +18 -0
- data/decidim-results/app/views/decidim/results/results/_tags.html.erb +1 -1
- data/decidim-results/app/views/decidim/results/results/index.html.erb +1 -0
- data/decidim-results/app/views/decidim/results/results/show.html.erb +1 -0
- data/decidim-results/config/i18n-tasks.yml +2 -0
- data/decidim-results/config/locales/ca.yml +15 -2
- data/decidim-results/config/locales/en.yml +15 -2
- data/decidim-results/config/locales/es.yml +15 -2
- data/decidim-results/config/locales/eu.yml +57 -1
- data/decidim-results/config/locales/fi.yml +77 -0
- data/decidim-results/db/migrate/20170215132624_add_reference_to_results.rb +7 -0
- data/decidim-results/lib/decidim/results/test/factories.rb +6 -0
- data/decidim-results/spec/features/comments_spec.rb +10 -0
- data/decidim-results/spec/features/explore_results_spec.rb +27 -0
- data/decidim-results/spec/models/result_spec.rb +1 -0
- data/decidim-results/spec/services/result_search_spec.rb +9 -0
- data/decidim-results/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-system/README.md +45 -8
- data/decidim-system/app/commands/decidim/system/register_organization.rb +3 -0
- data/decidim-system/app/commands/decidim/system/update_organization.rb +2 -0
- data/decidim-system/app/controllers/decidim/system/application_controller.rb +2 -0
- data/decidim-system/app/forms/decidim/system/register_organization_form.rb +1 -0
- data/decidim-system/app/forms/decidim/system/update_organization_form.rb +18 -0
- data/decidim-system/app/views/decidim/system/organizations/edit.html.erb +10 -0
- data/decidim-system/app/views/decidim/system/organizations/new.html.erb +33 -19
- data/decidim-system/config/locales/ca.yml +3 -0
- data/decidim-system/config/locales/en.yml +3 -0
- data/decidim-system/config/locales/es.yml +3 -0
- data/decidim-system/config/locales/eu.yml +3 -0
- data/decidim-system/config/locales/fi.yml +68 -0
- data/decidim-system/db/seeds.rb +1 -1
- data/decidim-system/decidim-system.gemspec +1 -1
- data/decidim-system/lib/decidim/system/engine.rb +1 -0
- data/decidim-system/spec/commands/decidim/system/register_organization_spec.rb +3 -0
- data/decidim-system/spec/commands/decidim/system/update_organization_spec.rb +53 -0
- data/decidim-system/spec/features/organizations_spec.rb +5 -0
- data/docs/analytics.md +23 -0
- data/docs/how_to_create_a_plugin.md +3 -1
- data/lib/generators/decidim/app_generator.rb +4 -0
- data/lib/generators/decidim/demo_generator.rb +1 -1
- data/lib/generators/decidim/install_generator.rb +8 -1
- data/lib/generators/decidim/review_app_generator.rb +53 -0
- data/lib/generators/decidim/templates/Gemfile.erb +1 -5
- data/lib/generators/decidim/templates/app.json.erb +1 -1
- data/lib/generators/decidim/templates/carrierwave.rb +2 -2
- data/lib/generators/decidim/templates/decidim_controller.rb.erb +5 -0
- data/lib/generators/decidim/templates/initializer.rb +4 -0
- data/package.json +4 -4
- data/yarn.lock +106 -165
- metadata +100 -54
- data/decidim-meetings/app/assets/config/decidim_meetings_manifest.js +0 -2
- data/decidim-meetings/app/assets/javascripts/decidim/meetings/map.js.es6.erb +0 -97
- data/decidim-meetings/app/assets/stylesheets/decidim/meetings/map.css +0 -3
- data/decidim-meetings/app/services/decidim/meetings/static_map_generator.rb +0 -50
- data/decidim-meetings/app/views/decidim/meetings/meetings/_address_details.html.erb +0 -5
- data/decidim-meetings/spec/controllers/meetings_controller_spec.rb +0 -41
- data/decidim-meetings/spec/services/static_map_generator_spec.rb +0 -33
- data/decidim-meetings/vendor/assets/javascripts/leaflet-svg-icon.js +0 -179
- data/decidim-meetings/vendor/assets/javascripts/leaflet-tilelayer-here.js +0 -166
- data/decidim-meetings/vendor/assets/javascripts/leaflet.js +0 -9
- data/decidim-meetings/vendor/assets/javascripts/leaflet.markercluster.js +0 -7
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.Default.css +0 -60
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.css +0 -14
- data/decidim-meetings/vendor/assets/stylesheets/leaflet.css +0 -624
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Decidim [![Gem](https://img.shields.io/gem/v/decidim.svg)](https://rubygems.org/gems/decidim) [![Gem](https://img.shields.io/gem/dt/decidim.svg)](https://rubygems.org/gems/decidim) [![GitHub contributors](https://img.shields.io/github/contributors/AjuntamentdeBarcelona/decidim.svg)](https://github.com/AjuntamentdeBarcelona/decidim/graphs/contributors) [![License: AGPL v3](https://img.shields.io/github/license/AjuntamentdeBarcelona/decidim.svg)](https://github.com/AjuntamentdeBarcelona/decidim/blob/master/LICENSE-AGPLv3.txt)
|
2
2
|
|
3
|
-
[![Demo](https://img.shields.io/badge/demo-staging-orange.svg?style=flat)](http://staging.decidim.codegram.com)
|
4
|
-
[
|
5
|
-
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)]()
|
3
|
+
[![Demo](https://img.shields.io/badge/demo-staging-orange.svg?style=flat)](http://staging.decidim.codegram.com)
|
4
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/AjuntamentdeBarcelona/decidim/master)
|
5
|
+
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/AjuntamentdeBarcelona/decidim)
|
6
6
|
|
7
7
|
|
8
8
|
### Code quality
|
@@ -12,16 +12,20 @@
|
|
12
12
|
[![Dependency Status](https://img.shields.io/gemnasium/AjuntamentdeBarcelona/decidim.svg)](https://gemnasium.com/github.com/AjuntamentdeBarcelona/decidim)
|
13
13
|
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/decidim/localized.svg)](https://crowdin.com/project/decidim/invite)
|
14
14
|
[![Inline docs](http://inch-ci.org/github/AjuntamentdeBarcelona/decidim.svg?branch=master)](http://inch-ci.org/github/AjuntamentdeBarcelona/decidim)
|
15
|
+
[![Accessibility issues](https://rocketvalidator.com/badges/a11y_issues.svg?url=http://staging.decidim.codegram.com/)](https://rocketvalidator.com/badges/link?url=http://staging.decidim.codegram.com/&report=a11y)
|
16
|
+
[![HTML issues](https://rocketvalidator.com/badges/html_issues.svg?url=http://staging.decidim.codegram.com/)](https://rocketvalidator.com/badges/link?url=http://staging.decidim.codegram.com/&report=html)
|
15
17
|
|
16
18
|
### Project management [[See on Waffle.io]](https://waffle.io/AjuntamentdeBarcelona/decidim)
|
17
19
|
[![Stories in Discussion](https://img.shields.io/waffle/label/AjuntamentdeBarcelona/decidim/discussion.svg)](https://github.com/AjuntamentdeBarcelona/decidim/issues?q=is%3Aopen+is%3Aissue+label%3Adiscussion)
|
18
|
-
[![Stories in
|
20
|
+
[![Stories in Planned](https://img.shields.io/waffle/label/AjuntamentdeBarcelona/decidim/planned.svg)](https://github.com/AjuntamentdeBarcelona/decidim/issues?q=is%3Aopen+is%3Aissue+label%3Aplanned)
|
19
21
|
[![Bugs](https://img.shields.io/waffle/label/AjuntamentdeBarcelona/decidim/bug.svg)](https://github.com/AjuntamentdeBarcelona/decidim/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
|
20
22
|
[![In Progress](https://img.shields.io/waffle/label/AjuntamentdeBarcelona/decidim/in-progress.svg)](https://github.com/AjuntamentdeBarcelona/decidim/issues?q=is%3Aopen+is%3Aissue+label%3Ain-progress)
|
21
23
|
[![In Review](https://img.shields.io/waffle/label/AjuntamentdeBarcelona/decidim/in-review.svg)](https://github.com/AjuntamentdeBarcelona/decidim/issues?q=is%3Aopen+is%3Aissue+label%3Ain-review)
|
22
24
|
|
23
25
|
---
|
24
26
|
|
27
|
+
Decidim is a participatory democracy framework written on Ruby on Rails originally developed for the Barcelona City government online and offline participation website. Installing this libraries you'll get a generator and gems to help you develop web applications like the ones found on [example applications](#example-applications).
|
28
|
+
|
25
29
|
## What do you need to do?
|
26
30
|
|
27
31
|
- [Contribute to the project](#how-to-contribute)
|
@@ -60,14 +64,14 @@ $ rails db:setup
|
|
60
64
|
|
61
65
|
This will also create some default data so you can start testing the app:
|
62
66
|
|
63
|
-
* A `Decidim::System::Admin` with email `system@
|
67
|
+
* A `Decidim::System::Admin` with email `system@example.org` and password
|
64
68
|
`decidim123456`, to log in at `/system`.
|
65
69
|
* A `Decidim::Organization` named `Decidim Staging`. You probably want to
|
66
70
|
change its name and hostname to match your needs.
|
67
71
|
* A `Decidim::User` acting as an admin for the organization, with email
|
68
|
-
`admin@
|
72
|
+
`admin@example.org` and password `decidim123456`.
|
69
73
|
* A `Decidim::User` that also belongs to the organization but it's a regular
|
70
|
-
user, with email `user@
|
74
|
+
user, with email `user@example.org` and password `decidim123456`.
|
71
75
|
|
72
76
|
This data won't be created in production environments, if you still want to do it, run:
|
73
77
|
|
@@ -142,7 +146,7 @@ After you create a development app (`bundle exec rake development_app`):
|
|
142
146
|
- `bundle exec rails s`
|
143
147
|
- Go to 'http://localhost:3000'
|
144
148
|
|
145
|
-
Optionally, you can log in as: user@
|
149
|
+
Optionally, you can log in as: user@example.org | decidim123456
|
146
150
|
|
147
151
|
Also, if you want to verify yourself against the default authorization handler use a document number ended with "X".
|
148
152
|
|
@@ -153,7 +157,7 @@ After you create a development app (`bundle exec rake development_app`):
|
|
153
157
|
- `cd development_app`
|
154
158
|
- `bundle exec rails s`
|
155
159
|
- Go to 'http://localhost:3000/admin'
|
156
|
-
- Login data: admin@
|
160
|
+
- Login data: admin@example.org | decidim123456
|
157
161
|
|
158
162
|
|
159
163
|
## Components
|
@@ -174,9 +178,14 @@ After you create a development app (`bundle exec rake development_app`):
|
|
174
178
|
## Further configuration
|
175
179
|
|
176
180
|
- [Social providers integration](https://github.com/AjuntamentdeBarcelona/decidim/blob/master/docs/social_providers.md): Enable sign up from social networks.
|
181
|
+
- [Analytics](https://github.com/AjuntamentdeBarcelona/decidim/blob/master/docs/analytics.md): How to enable analytics
|
177
182
|
|
178
183
|
## Technical tradeoffs
|
179
184
|
|
185
|
+
### Architecture
|
186
|
+
|
187
|
+
This is not your tipical Ruby on Rails Vanilla App. We've tried that using [Consul](http://decide.es) but we've found some problems on reutilization, adaptation, modularization and configuration. You can read more about that on "[Propuesta de Cambios de Arquitectura de Consul](https://www.gitbook.com/book/alabs/propuesta-de-cambios-en-la-arquitectura-de-consul/details)".
|
188
|
+
|
180
189
|
### Turbolinks
|
181
190
|
|
182
191
|
Decidim doesn't support `turbolinks` so it isn't included on our generated apps and it's removed for existing Rails applications which install the Decidim engine.
|
@@ -185,4 +194,13 @@ The main reason for this is we are injecting some scripts into the body for some
|
|
185
194
|
|
186
195
|
The support of Turbolinks was dropped in [d8c7d9f](https://github.com/AjuntamentdeBarcelona/decidim/commit/d8c7d9f63e4d75307e8f7a0360bef977fab209b6). If you're interested in bringing turbolinks back, further discussion is welcome.
|
187
196
|
|
188
|
-
|
197
|
+
## Following our license
|
198
|
+
|
199
|
+
If you plan to release your application you'll need to publish it using the same license: GPL Affero 3. We recommend doing that on Github before publishing, you can read more on "[Being Open Source From Day One is Especially Important for Government Projects](http://producingoss.com/en/governments-and-open-source.html#starting-open-for-govs)". If you have any trouble doing that you can contact us on [Gitter](https://gitter.im/AjuntamentdeBarcelona/decidim).
|
200
|
+
|
201
|
+
|
202
|
+
## Example applications
|
203
|
+
|
204
|
+
* [Demo](http://staging.decidim.codegram.com)
|
205
|
+
* [Decidim Barcelona](https://decidim.barcelona)
|
206
|
+
* [L'H ON dels barris](https://www.lhon-participa.cat)
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require "rspec/core/rake_task"
|
|
4
4
|
require_relative "lib/generators/decidim/app_generator"
|
5
5
|
require_relative "lib/generators/decidim/docker_generator"
|
6
6
|
|
7
|
-
DECIDIM_GEMS = %w(core system admin api pages meetings proposals comments results budgets).freeze
|
7
|
+
DECIDIM_GEMS = %w(core system admin api pages meetings proposals comments results budgets dev).freeze
|
8
8
|
|
9
9
|
RSpec::Core::RakeTask.new(:spec)
|
10
10
|
|
data/decidim-admin/README.md
CHANGED
@@ -60,6 +60,7 @@
|
|
60
60
|
|
61
61
|
.session-box {
|
62
62
|
padding: $global-padding 0;
|
63
|
+
border-bottom: 1px solid black;
|
63
64
|
|
64
65
|
@include grid-row;
|
65
66
|
|
@@ -69,5 +70,33 @@
|
|
69
70
|
overflow: hidden;
|
70
71
|
}
|
71
72
|
.sign-out{ @include grid-column(4); }
|
73
|
+
|
72
74
|
}
|
73
|
-
}
|
75
|
+
}
|
76
|
+
|
77
|
+
.dropdown > li > a{
|
78
|
+
padding-left: 0;
|
79
|
+
}
|
80
|
+
.dropdown{
|
81
|
+
display: inline-block;
|
82
|
+
vertical-align: middle;
|
83
|
+
}
|
84
|
+
|
85
|
+
.is-dropdown-submenu{
|
86
|
+
z-index: 2;
|
87
|
+
text-align: left;
|
88
|
+
background: lighten($black, 5) !important;
|
89
|
+
border: none !important;
|
90
|
+
box-shadow: 0 3px 5px rgba(0, 0, 0, .3) !important;;
|
91
|
+
min-width: 250px !important;
|
92
|
+
a{
|
93
|
+
color: $light-gray;
|
94
|
+
padding: .5rem;
|
95
|
+
}
|
96
|
+
a:hover{
|
97
|
+
color: lighten($light-gray, 20);
|
98
|
+
}
|
99
|
+
li:hover{
|
100
|
+
background: lighten($black, 10);
|
101
|
+
}
|
102
|
+
}
|
@@ -46,7 +46,10 @@ module Decidim
|
|
46
46
|
hero_image: form.hero_image,
|
47
47
|
banner_image: form.banner_image,
|
48
48
|
promoted: form.promoted,
|
49
|
-
|
49
|
+
meta_scope: form.meta_scope,
|
50
|
+
scope: form.scope,
|
51
|
+
organization: form.current_organization,
|
52
|
+
participatory_process_group: form.participatory_process_group
|
50
53
|
)
|
51
54
|
|
52
55
|
return process unless process.valid?
|
@@ -9,8 +9,9 @@ module Decidim
|
|
9
9
|
# form - A form object with the params.
|
10
10
|
# participatory_process - The ParticipatoryProcess that will hold the
|
11
11
|
# user role
|
12
|
-
def initialize(form, participatory_process)
|
12
|
+
def initialize(form, current_user, participatory_process)
|
13
13
|
@form = form
|
14
|
+
@current_user = current_user
|
14
15
|
@participatory_process = participatory_process
|
15
16
|
end
|
16
17
|
|
@@ -24,7 +25,7 @@ module Decidim
|
|
24
25
|
return broadcast(:invalid) if form.invalid?
|
25
26
|
return broadcast(:invalid) unless user
|
26
27
|
|
27
|
-
|
28
|
+
create_role
|
28
29
|
broadcast(:ok)
|
29
30
|
rescue ActiveRecord::RecordInvalid
|
30
31
|
form.errors.add(:email, :taken)
|
@@ -33,21 +34,39 @@ module Decidim
|
|
33
34
|
|
34
35
|
private
|
35
36
|
|
36
|
-
attr_reader :form, :participatory_process
|
37
|
+
attr_reader :form, :participatory_process, :current_user
|
37
38
|
|
38
|
-
def
|
39
|
+
def create_role
|
39
40
|
ParticipatoryProcessUserRole.create!(
|
40
|
-
role:
|
41
|
+
role: form.role.to_sym,
|
41
42
|
user: user,
|
42
43
|
participatory_process: @participatory_process
|
43
44
|
)
|
44
45
|
end
|
45
46
|
|
46
47
|
def user
|
47
|
-
User.where(
|
48
|
+
@user ||= User.where(
|
48
49
|
email: form.email,
|
49
50
|
organization: participatory_process.organization
|
50
|
-
).first
|
51
|
+
).first || InviteUser.call(user_form) do
|
52
|
+
on(:ok) do |user|
|
53
|
+
return user
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def user_form
|
59
|
+
OpenStruct.new(name: form.name,
|
60
|
+
email: form.email.downcase,
|
61
|
+
organization: participatory_process.organization,
|
62
|
+
roles: [form.role.to_sym],
|
63
|
+
invited_by: current_user,
|
64
|
+
invitation_instructions: invitation_instructions)
|
65
|
+
end
|
66
|
+
|
67
|
+
def invitation_instructions
|
68
|
+
return "invite_admin" if form.role == "admin"
|
69
|
+
"invite_collaborator"
|
51
70
|
end
|
52
71
|
end
|
53
72
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A command with all the business logic when creating a new participatory
|
5
|
+
# process group in the system.
|
6
|
+
class CreateParticipatoryProcessGroup < Rectify::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) if form.invalid?
|
22
|
+
group = create_participatory_process_group
|
23
|
+
|
24
|
+
if group.persisted?
|
25
|
+
broadcast(:ok, group)
|
26
|
+
else
|
27
|
+
form.errors.add(:hero_image, group.errors[:hero_image]) if group.errors.include? :hero_image
|
28
|
+
form.errors.add(:banner_image, group.errors[:banner_image]) if group.errors.include? :banner_image
|
29
|
+
broadcast(:invalid)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :form
|
36
|
+
|
37
|
+
def create_participatory_process_group
|
38
|
+
transaction do
|
39
|
+
group = ParticipatoryProcessGroup.create(
|
40
|
+
name: form.name,
|
41
|
+
description: form.description,
|
42
|
+
hero_image: form.hero_image,
|
43
|
+
participatory_processes: participatory_processes,
|
44
|
+
organization: form.current_organization
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def participatory_processes
|
50
|
+
Decidim::ParticipatoryProcess.where(id: form.participatory_process_ids)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -35,7 +35,6 @@ module Decidim
|
|
35
35
|
ParticipatoryProcessStep.create!(
|
36
36
|
title: form.title,
|
37
37
|
description: form.description,
|
38
|
-
short_description: form.short_description,
|
39
38
|
start_date: form.start_date,
|
40
39
|
end_date: form.end_date,
|
41
40
|
participatory_process: @participatory_process
|
@@ -29,8 +29,10 @@ module Decidim
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def reorder_steps
|
32
|
+
steps = @participatory_process.steps.reload
|
33
|
+
|
32
34
|
ReorderParticipatoryProcessSteps
|
33
|
-
.new(
|
35
|
+
.new(steps, steps.map(&:id))
|
34
36
|
.call
|
35
37
|
end
|
36
38
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A command with all the business logic when a user hides a resource.
|
5
|
+
class HideResource < Rectify::Command
|
6
|
+
# Public: Initializes the command.
|
7
|
+
#
|
8
|
+
# reportable - A Decidim::Reportable
|
9
|
+
def initialize(reportable)
|
10
|
+
@reportable = reportable
|
11
|
+
end
|
12
|
+
|
13
|
+
# Executes the command. Broadcasts these events:
|
14
|
+
#
|
15
|
+
# - :ok when everything is valid, together with the resource.
|
16
|
+
# - :invalid if the resource is already hidden
|
17
|
+
#
|
18
|
+
# Returns nothing.
|
19
|
+
def call
|
20
|
+
return broadcast(:invalid) unless hideable?
|
21
|
+
|
22
|
+
hide!
|
23
|
+
broadcast(:ok, @reportable)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def hideable?
|
29
|
+
!@reportable.hidden? && @reportable.reported?
|
30
|
+
end
|
31
|
+
|
32
|
+
def hide!
|
33
|
+
@reportable.moderation.update_attributes!(hidden_at: Time.current)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A command with all the business logic when a user unreports a resource.
|
5
|
+
class UnreportResource < Rectify::Command
|
6
|
+
# Public: Initializes the command.
|
7
|
+
#
|
8
|
+
# reportable - A Decidim::Reportable
|
9
|
+
def initialize(reportable)
|
10
|
+
@reportable = reportable
|
11
|
+
end
|
12
|
+
|
13
|
+
# Executes the command. Broadcasts these events:
|
14
|
+
#
|
15
|
+
# - :ok when everything is valid, together with the resource.
|
16
|
+
# - :invalid if the resource is not reported
|
17
|
+
#
|
18
|
+
# Returns nothing.
|
19
|
+
def call
|
20
|
+
return broadcast(:invalid) unless @reportable.reported?
|
21
|
+
|
22
|
+
unreport!
|
23
|
+
broadcast(:ok, @reportable)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def unreport!
|
29
|
+
@reportable.moderation.update_attributes!(report_count: 0, hidden_at: nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -58,8 +58,10 @@ module Decidim
|
|
58
58
|
target: form.target,
|
59
59
|
participatory_scope: form.participatory_scope,
|
60
60
|
participatory_structure: form.participatory_structure,
|
61
|
-
|
62
|
-
|
61
|
+
meta_scope: form.meta_scope,
|
62
|
+
end_date: form.end_date,
|
63
|
+
participatory_process_group: form.participatory_process_group
|
64
|
+
}
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A command with all the business logic when creating a new participatory
|
5
|
+
# process group in the system.
|
6
|
+
class UpdateParticipatoryProcessGroup < Rectify::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# participatory_process_group - the ParticipatoryProcessGroup to update
|
10
|
+
# form - A form object with the params.
|
11
|
+
def initialize(participatory_process_group, form)
|
12
|
+
@participatory_process_group = participatory_process_group
|
13
|
+
@form = form
|
14
|
+
end
|
15
|
+
|
16
|
+
# Executes the command. Broadcasts these events:
|
17
|
+
#
|
18
|
+
# - :ok when everything is valid.
|
19
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
20
|
+
#
|
21
|
+
# Returns nothing.
|
22
|
+
def call
|
23
|
+
return broadcast(:invalid) if form.invalid?
|
24
|
+
update_participatory_process_group
|
25
|
+
|
26
|
+
if @participatory_process_group.valid?
|
27
|
+
broadcast(:ok, @participatory_process_group)
|
28
|
+
else
|
29
|
+
form.errors.add(:hero_image, @participatory_process_group.errors[:hero_image]) if @participatory_process_group.errors.include? :hero_image
|
30
|
+
broadcast(:invalid)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :form
|
37
|
+
|
38
|
+
def update_participatory_process_group
|
39
|
+
@participatory_process_group.assign_attributes(attributes)
|
40
|
+
@participatory_process_group.save! if @participatory_process_group.valid?
|
41
|
+
end
|
42
|
+
|
43
|
+
def attributes
|
44
|
+
{
|
45
|
+
name: form.name,
|
46
|
+
hero_image: form.hero_image,
|
47
|
+
description: form.description,
|
48
|
+
participatory_processes: participatory_processes
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def participatory_processes
|
53
|
+
Decidim::ParticipatoryProcess.where(id: form.participatory_process_ids)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|