decidim 0.0.2 → 0.0.3
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/.travis.yml +12 -0
- data/Dockerfile +2 -0
- data/Gemfile.lock +80 -54
- data/README.md +15 -2
- data/decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6 +3 -2
- data/decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6 +1 -1
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_foundation_and_overrides.scss +1 -1
- data/decidim-admin/app/commands/decidim/admin/{create_participatory_process_attachment.rb → create_attachment.rb} +6 -7
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process.rb +12 -3
- data/decidim-admin/app/commands/decidim/admin/{update_participatory_process_attachment.rb → update_attachment.rb} +7 -6
- data/decidim-admin/app/commands/decidim/admin/update_feature.rb +2 -1
- data/decidim-admin/app/commands/decidim/admin/update_organization.rb +1 -0
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +16 -4
- data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb +116 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +5 -67
- data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +5 -5
- data/decidim-admin/app/forms/decidim/admin/{participatory_process_attachment_form.rb → attachment_form.rb} +2 -2
- data/decidim-admin/app/forms/decidim/admin/feature_form.rb +1 -0
- data/decidim-admin/app/forms/decidim/admin/organization_form.rb +1 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +8 -1
- data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +1 -0
- data/decidim-admin/app/helpers/decidim/admin/feature_settings_helper.rb +29 -0
- data/decidim-admin/app/models/decidim/admin/abilities/admin_user.rb +4 -4
- data/decidim-admin/app/models/decidim/admin/abilities/base.rb +3 -3
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_admin.rb +15 -7
- data/decidim-admin/app/views/decidim/admin/{participatory_process_attachments → attachments}/_form.html.erb +0 -0
- data/decidim-admin/app/views/decidim/admin/attachments/edit.html.erb +9 -0
- data/decidim-admin/app/views/decidim/admin/attachments/index.html.erb +37 -0
- data/decidim-admin/app/views/decidim/admin/attachments/new.html.erb +9 -0
- data/decidim-admin/app/views/decidim/admin/attachments/show.html.erb +25 -0
- data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +1 -0
- data/decidim-admin/app/views/decidim/admin/features/_settings_fields.html.erb +6 -3
- data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +4 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +16 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/show.html.erb +11 -1
- data/decidim-admin/app/views/layouts/decidim/admin/_header.html.erb +2 -2
- data/decidim-admin/app/views/layouts/decidim/admin/_sidebar.html.erb +1 -1
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
- data/decidim-admin/config/locales/ca.yml +29 -27
- data/decidim-admin/config/locales/en.yml +29 -27
- data/decidim-admin/config/locales/es.yml +29 -27
- data/decidim-admin/config/routes.rb +1 -1
- data/decidim-admin/db/migrate/20170128112958_change_user_groups_verified_to_timestamp.rb +9 -0
- data/decidim-admin/decidim-admin.gemspec +0 -1
- data/decidim-admin/lib/decidim/admin/engine.rb +2 -2
- data/decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb +103 -0
- data/decidim-admin/spec/commands/create_category_spec.rb +1 -1
- data/decidim-admin/spec/commands/create_feature_spec.rb +1 -1
- data/decidim-admin/spec/commands/create_participatory_process_spec.rb +32 -2
- data/decidim-admin/spec/commands/create_static_page_spec.rb +1 -1
- data/decidim-admin/spec/commands/destroy_category_spec.rb +1 -1
- data/decidim-admin/spec/commands/destroy_feature_spec.rb +2 -2
- data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +1 -1
- data/decidim-admin/spec/commands/update_category_spec.rb +1 -1
- data/decidim-admin/spec/commands/update_feature_spec.rb +3 -1
- data/decidim-admin/spec/commands/update_organization_spec.rb +12 -2
- data/decidim-admin/spec/commands/update_static_page_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_organization_admins_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_organization_scopes_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +1 -1
- data/decidim-admin/spec/features/static_pages_spec.rb +1 -1
- data/decidim-admin/spec/forms/participatory_process_form_spec.rb +32 -2
- data/decidim-admin/spec/forms/participatory_process_step_form_spec.rb +3 -3
- data/decidim-admin/spec/forms/scope_form_spec.rb +2 -2
- data/decidim-admin/spec/forms/static_page_form_spec.rb +2 -2
- data/decidim-admin/spec/helpers/feature_settings_helper_spec.rb +56 -0
- data/decidim-admin/spec/models/abilities/admin_user_spec.rb +7 -6
- data/decidim-admin/spec/models/abilities/participatory_process_admin_spec.rb +5 -8
- data/decidim-admin/spec/shared/manage_process_admins_examples.rb +1 -1
- data/decidim-admin/spec/shared/manage_process_attachments_examples.rb +4 -94
- data/decidim-admin/spec/shared/manage_process_categories_examples.rb +2 -1
- data/decidim-admin/spec/shared/manage_process_steps_examples.rb +1 -1
- data/decidim-admin/spec/shared/manage_processes_examples.rb +4 -3
- data/decidim-admin/spec/views/decidim/static_pages/_form.html.erb_spec.rb +2 -2
- data/decidim-api/app/views/layouts/decidim/api/documentation.html.erb +1 -1
- data/decidim-api/decidim-api.gemspec +1 -1
- data/decidim-api/lib/decidim/api.rb +1 -0
- data/decidim-api/lib/decidim/api/schema.rb +5 -0
- data/decidim-api/lib/decidim/api/test/type_context.rb +1 -0
- data/decidim-api/lib/decidim/api/types/author_interface.rb +13 -0
- data/decidim-api/spec/types/query_type_spec.rb +1 -1
- data/decidim-api/spec/types/translated_field_type_spec.rb +1 -1
- data/decidim-budgets/.gitignore +7 -0
- data/decidim-budgets/README.md +23 -0
- data/decidim-budgets/Rakefile +2 -0
- data/decidim-budgets/app/assets/config/decidim_budgets_manifest.js +1 -0
- data/decidim-budgets/app/assets/images/decidim/budgets/icon.svg +4 -0
- data/decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6 +28 -0
- data/decidim-budgets/app/assets/stylesheets/decidim/budgets/_budgets.scss +1 -0
- data/decidim-budgets/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +32 -0
- data/decidim-budgets/app/assets/stylesheets/decidim/budgets/budget/_budget-meter.scss +78 -0
- data/decidim-budgets/app/assets/stylesheets/decidim/budgets/budget/_progress.scss +17 -0
- data/decidim-budgets/app/commands/decidim/budgets/add_line_item.rb +43 -0
- data/decidim-budgets/app/commands/decidim/budgets/admin/create_project.rb +52 -0
- data/decidim-budgets/app/commands/decidim/budgets/admin/update_project.rb +56 -0
- data/decidim-budgets/app/commands/decidim/budgets/cancel_order.rb +36 -0
- data/decidim-budgets/app/commands/decidim/budgets/checkout.rb +34 -0
- data/decidim-budgets/app/commands/decidim/budgets/remove_line_item.rb +35 -0
- data/decidim-budgets/app/controllers/concerns/decidim/budgets/needs_current_order.rb +27 -0
- data/decidim-budgets/app/controllers/decidim/budgets/admin/application_controller.rb +14 -0
- data/decidim-budgets/app/controllers/decidim/budgets/admin/projects_controller.rb +69 -0
- data/decidim-budgets/app/controllers/decidim/budgets/application_controller.rb +13 -0
- data/decidim-budgets/app/controllers/decidim/budgets/line_items_controller.rb +43 -0
- data/decidim-budgets/app/controllers/decidim/budgets/orders_controller.rb +38 -0
- data/decidim-budgets/app/controllers/decidim/budgets/projects_controller.rb +44 -0
- data/decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb +44 -0
- data/decidim-budgets/app/helpers/decidim/budgets/application_helper.rb +12 -0
- data/decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb +29 -0
- data/decidim-budgets/app/models/decidim/budgets/application_record.rb +9 -0
- data/decidim-budgets/app/models/decidim/budgets/line_item.rb +20 -0
- data/decidim-budgets/app/models/decidim/budgets/order.rb +52 -0
- data/decidim-budgets/app/models/decidim/budgets/project.rb +15 -0
- data/decidim-budgets/app/services/decidim/budgets/project_search.rb +58 -0
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/_form.html.erb +31 -0
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/edit.html.erb +9 -0
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/index.html.erb +27 -0
- data/{decidim-admin/app/views/decidim/admin/participatory_process_attachments → decidim-budgets/app/views/decidim/budgets/admin/projects}/new.html.erb +0 -0
- data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +21 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_confirm.html.erb +30 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_excess.html.erb +14 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_summary.html.erb +46 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_count.html.erb +1 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_filters.html.erb +24 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_linked_projects.html.erb +12 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_progress.html.erb +34 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +25 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_total_budget.html.erb +1 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +40 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_project_budget_button.html.erb +9 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_projects.html.erb +8 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_tags.html.erb +10 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +26 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/index.js.erb +2 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +48 -0
- data/decidim-budgets/bin/rails +14 -0
- data/decidim-budgets/config/i18n-tasks.yml +4 -0
- data/decidim-budgets/config/locales/ca.yml +84 -0
- data/decidim-budgets/config/locales/en.yml +95 -0
- data/decidim-budgets/config/locales/es.yml +84 -0
- data/decidim-budgets/db/migrate/20170127114122_create_projects.rb +15 -0
- data/decidim-budgets/db/migrate/20170130095615_create_orders.rb +13 -0
- data/decidim-budgets/db/migrate/20170130101825_create_line_items.rb +10 -0
- data/decidim-budgets/decidim-budgets.gemspec +24 -0
- data/decidim-budgets/lib/decidim/budgets.rb +11 -0
- data/decidim-budgets/lib/decidim/budgets/admin.rb +9 -0
- data/decidim-budgets/lib/decidim/budgets/admin_engine.rb +22 -0
- data/decidim-budgets/lib/decidim/budgets/feature.rb +59 -0
- data/decidim-budgets/lib/decidim/budgets/list_engine.rb +30 -0
- data/decidim-budgets/lib/decidim/budgets/test/factories.rb +43 -0
- data/decidim-budgets/spec/commands/add_line_item_spec.rb +48 -0
- data/decidim-budgets/spec/commands/cancel_order_spec.rb +42 -0
- data/decidim-budgets/spec/commands/checkout_spec.rb +45 -0
- data/decidim-budgets/spec/commands/create_project_spec.rb +72 -0
- data/decidim-budgets/spec/commands/remove_line_item_spec.rb +31 -0
- data/decidim-budgets/spec/commands/update_project_spec.rb +65 -0
- data/decidim-budgets/spec/factories.rb +4 -0
- data/decidim-budgets/spec/features/admin_manages_projects_spec.rb +16 -0
- data/decidim-budgets/spec/features/orders_spec.rb +149 -0
- data/decidim-budgets/spec/features/process_admin_manages_projects_spec.rb +17 -0
- data/decidim-budgets/spec/forms/project_form_spec.rb +115 -0
- data/decidim-budgets/spec/models/line_item_spec.rb +35 -0
- data/decidim-budgets/spec/models/order_spec.rb +45 -0
- data/decidim-budgets/spec/models/project_spec.rb +30 -0
- data/decidim-budgets/spec/services/project_search_spec.rb +97 -0
- data/decidim-budgets/spec/shared/admin_shared_context.rb +11 -0
- data/decidim-budgets/spec/shared/manage_projects_examples.rb +104 -0
- data/decidim-budgets/spec/spec_helper.rb +2 -0
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/commands/decidim/comments/create_comment.rb +2 -1
- data/decidim-comments/app/forms/decidim/comments/comment_form.rb +1 -0
- data/decidim-comments/app/frontend/application/apollo_client.js +1 -1
- data/decidim-comments/app/frontend/application/application.component.jsx +1 -1
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +76 -20
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +77 -22
- data/decidim-comments/app/frontend/comments/add_comment_form.fragment.graphql +6 -0
- data/decidim-comments/app/frontend/comments/add_comment_form.mutation.graphql +2 -2
- data/decidim-comments/app/frontend/comments/comment.component.jsx +15 -15
- data/decidim-comments/app/frontend/comments/comment.component.test.jsx +42 -41
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +1 -1
- data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +7 -7
- data/decidim-comments/app/frontend/comments/comment_thread.component.test.jsx +21 -19
- data/decidim-comments/app/frontend/comments/comments.component.jsx +21 -17
- data/decidim-comments/app/frontend/comments/comments.component.test.jsx +47 -32
- data/decidim-comments/app/frontend/comments/comments.query.graphql +6 -3
- data/decidim-comments/app/frontend/comments/down_vote_button.component.jsx +21 -10
- data/decidim-comments/app/frontend/comments/up_vote_button.component.jsx +23 -12
- data/decidim-comments/app/frontend/comments/vote_button.component.jsx +15 -7
- data/decidim-comments/app/frontend/comments/vote_button_component.test.jsx +7 -2
- data/decidim-comments/app/frontend/entry.js +1 -8
- data/decidim-comments/app/frontend/support/generate_user_data.js +13 -0
- data/decidim-comments/app/frontend/support/generate_user_group_data.js +14 -0
- data/decidim-comments/app/helpers/decidim/comments/comments_helper.rb +10 -15
- data/decidim-comments/app/models/decidim/comments/comment.rb +5 -7
- data/decidim-comments/app/types/decidim/comments/comment_type.rb +5 -1
- data/decidim-comments/config/locales/ca.yml +5 -1
- data/decidim-comments/config/locales/en.yml +4 -1
- data/decidim-comments/config/locales/es.yml +5 -1
- data/decidim-comments/db/migrate/20170123102043_add_user_group_id_to_comments.rb +5 -0
- data/decidim-comments/decidim-comments.gemspec +0 -1
- data/decidim-comments/lib/decidim/comments/engine.rb +0 -1
- data/decidim-comments/lib/decidim/comments/mutation_extensions.rb +2 -1
- data/decidim-comments/spec/commands/create_comment_spec.rb +6 -3
- data/decidim-comments/spec/commands/vote_comment_spec.rb +4 -4
- data/decidim-comments/spec/features/comments_spec.rb +27 -3
- data/decidim-comments/spec/forms/comment_form_spec.rb +6 -3
- data/decidim-comments/spec/models/comment_spec.rb +25 -32
- data/decidim-comments/spec/queries/comments_with_replies_spec.rb +2 -2
- data/decidim-comments/spec/types/comment_type_spec.rb +2 -2
- data/decidim-comments/spec/types/query_type_spec.rb +5 -5
- data/decidim-dev/app/views/decidim/dummy_resource/_linked_dummys.html.erb +5 -0
- data/decidim-dev/config/locales/en.yml +5 -0
- data/decidim-dev/decidim-dev.gemspec +3 -3
- data/decidim-dev/lib/decidim/dev/assets/avatar.jpg +0 -0
- data/decidim-dev/lib/decidim/dev/assets/icon.png +0 -0
- data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +1 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/action_mailer.rb +1 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/engine_routes.rb +9 -5
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +24 -0
- data/decidim-meetings/app/assets/config/decidim_meetings_manifest.js +2 -0
- data/decidim-meetings/app/assets/javascripts/decidim/meetings/map.js.es6.erb +92 -0
- data/decidim-meetings/app/assets/stylesheets/decidim/meetings/map.css +1 -0
- data/decidim-meetings/app/commands/decidim/meetings/admin/close_meeting.rb +53 -0
- data/decidim-meetings/app/commands/decidim/meetings/admin/create_meeting.rb +15 -3
- data/decidim-meetings/app/commands/decidim/meetings/admin/update_meeting.rb +15 -3
- data/decidim-meetings/app/controllers/decidim/meetings/admin/application_controller.rb +9 -0
- data/decidim-meetings/app/controllers/decidim/meetings/admin/attachments_controller.rb +29 -0
- data/decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb +38 -0
- data/decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb +0 -12
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +11 -9
- data/decidim-meetings/app/forms/decidim/meetings/admin/close_meeting_form.rb +31 -0
- data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +0 -2
- data/decidim-meetings/app/helpers/decidim/meetings/admin/application_helper.rb +12 -0
- data/decidim-meetings/app/helpers/decidim/meetings/application_helper.rb +1 -0
- data/decidim-meetings/app/helpers/decidim/meetings/map_helper.rb +46 -0
- data/decidim-meetings/app/models/decidim/meetings/meeting.rb +11 -15
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +0 -1
- data/decidim-meetings/app/services/decidim/meetings/static_map_generator.rb +50 -0
- data/decidim-meetings/app/views/decidim/meetings/admin/meeting_closes/_form.html.erb +23 -0
- data/decidim-meetings/app/views/decidim/meetings/admin/meeting_closes/edit.html.erb +9 -0
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/_form.html.erb +2 -6
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/index.html.erb +14 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_datetime.html.erb +8 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters_small_view.html.erb +18 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +22 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +3 -10
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +42 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.js.erb +6 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +33 -7
- data/decidim-meetings/bin/rails +1 -1
- data/decidim-meetings/config/i18n-tasks.yml +2 -0
- data/decidim-meetings/config/locales/ca.yml +37 -4
- data/decidim-meetings/config/locales/en.yml +34 -1
- data/decidim-meetings/config/locales/es.yml +36 -3
- data/decidim-meetings/db/migrate/20170110142105_close_a_meeting.rb +9 -0
- data/decidim-meetings/db/migrate/20170123151650_add_latitude_and_longitude_to_meetings.rb +6 -0
- data/decidim-meetings/db/migrate/20170129153716_remove_short_description_from_meetings.rb +5 -0
- data/decidim-meetings/decidim-meetings.gemspec +7 -0
- data/decidim-meetings/lib/decidim/meetings/admin_engine.rb +31 -1
- data/decidim-meetings/lib/decidim/meetings/feature.rb +20 -6
- data/decidim-meetings/lib/decidim/meetings/list_engine.rb +10 -1
- data/decidim-meetings/lib/decidim/meetings/seeds/Exampledocument.pdf +0 -0
- data/decidim-meetings/lib/decidim/meetings/seeds/city.jpeg +0 -0
- data/decidim-meetings/lib/decidim/meetings/test/factories.rb +23 -0
- data/decidim-meetings/spec/commands/close_meeting_spec.rb +78 -0
- data/decidim-meetings/spec/commands/create_meeting_spec.rb +22 -3
- data/decidim-meetings/spec/commands/update_meeting_spec.rb +32 -3
- data/decidim-meetings/spec/controllers/meetings_controller_spec.rb +41 -0
- data/decidim-meetings/spec/factories.rb +3 -13
- data/decidim-meetings/spec/features/admin_manages_meetings_attachments_spec.rb +10 -0
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +55 -1
- data/decidim-meetings/spec/features/process_admin_manages_meetings_attachments_spec.rb +12 -0
- data/decidim-meetings/spec/forms/close_meeting_form_spec.rb +90 -0
- data/decidim-meetings/spec/forms/meeting_form_spec.rb +1 -7
- data/decidim-meetings/spec/models/meeting_spec.rb +42 -24
- data/decidim-meetings/spec/services/meeting_search_spec.rb +1 -17
- data/decidim-meetings/spec/services/static_map_generator_spec.rb +33 -0
- data/decidim-meetings/spec/shared/manage_attachments_examples.rb +17 -0
- data/decidim-meetings/spec/shared/manage_meetings_examples.rb +58 -8
- data/decidim-meetings/spec/spec_helper.rb +5 -0
- data/decidim-meetings/spec/support/geocoder.rb +7 -0
- data/decidim-meetings/vendor/assets/javascripts/leaflet-svg-icon.js +179 -0
- data/decidim-meetings/vendor/assets/javascripts/leaflet-tilelayer-here.js +166 -0
- data/decidim-meetings/vendor/assets/javascripts/leaflet.js +9 -0
- data/decidim-meetings/vendor/assets/stylesheets/leaflet.css +624 -0
- data/decidim-pages/app/models/decidim/pages/page.rb +10 -1
- data/decidim-pages/app/views/decidim/pages/application/show.html.erb +2 -1
- data/decidim-pages/spec/commands/create_page_spec.rb +2 -2
- data/decidim-pages/spec/commands/destroy_page_spec.rb +1 -1
- data/decidim-pages/spec/commands/update_page_spec.rb +1 -1
- data/decidim-pages/spec/factories.rb +1 -1
- data/decidim-pages/spec/features/admin_spec.rb +1 -0
- data/decidim-pages/spec/models/page_spec.rb +15 -0
- data/decidim-proposals/app/assets/stylesheets/decidim/proposals/social_share.css.scss +5 -0
- data/decidim-proposals/app/commands/decidim/proposals/admin/answer_proposal.rb +43 -0
- data/decidim-proposals/app/commands/decidim/proposals/create_proposal.rb +1 -0
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +37 -0
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +1 -0
- data/decidim-proposals/app/controllers/decidim/proposals/proposal_votes_controller.rb +18 -7
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +8 -7
- data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb +18 -0
- data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +1 -0
- data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +17 -0
- data/decidim-proposals/app/helpers/decidim/proposals/proposal_votes_helper.rb +19 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/current_user.rb +59 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +30 -33
- data/decidim-proposals/app/models/decidim/proposals/proposal_vote.rb +2 -0
- data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +11 -0
- data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +15 -0
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +8 -0
- data/decidim-proposals/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +20 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +3 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +18 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_linked_proposals.html.erb +27 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +3 -2
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +3 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +1 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_share.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +16 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_limit.html.erb +23 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +13 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +6 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +15 -2
- data/decidim-proposals/config/i18n-tasks.yml +3 -0
- data/decidim-proposals/config/locales/ca.yml +54 -1
- data/decidim-proposals/config/locales/en.yml +54 -0
- data/decidim-proposals/config/locales/es.yml +54 -1
- data/decidim-proposals/db/migrate/20170120151202_add_user_group_id_to_proposals.rb +5 -0
- data/decidim-proposals/db/migrate/20170131092413_add_answers_to_proposals.rb +7 -0
- data/decidim-proposals/decidim-proposals.gemspec +3 -0
- data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +3 -1
- data/decidim-proposals/lib/decidim/proposals/engine.rb +7 -1
- data/decidim-proposals/lib/decidim/proposals/feature.rb +28 -1
- data/decidim-proposals/lib/decidim/proposals/test/factories.rb +83 -0
- data/decidim-proposals/spec/commands/decidim/proposals/admin_create_proposal_spec.rb +14 -0
- data/decidim-proposals/spec/commands/decidim/proposals/answer_proposal_spec.rb +53 -0
- data/decidim-proposals/spec/commands/decidim/proposals/create_proposal_spec.rb +3 -56
- data/decidim-proposals/spec/controllers/decidim/admin/proposal_answers_controller_spec.rb +45 -0
- data/decidim-proposals/spec/controllers/decidim/proposal_votes_controller_spec.rb +113 -0
- data/decidim-proposals/spec/controllers/decidim/proposals_controller_spec.rb +53 -0
- data/decidim-proposals/spec/factories.rb +1 -23
- data/decidim-proposals/spec/features/proposals_spec.rb +201 -38
- data/decidim-proposals/spec/features/vote_proposal_spec.rb +83 -11
- data/decidim-proposals/spec/forms/decidim/proposals/admin_proposal_form_spec.rb +13 -0
- data/decidim-proposals/spec/forms/decidim/proposals/proposal_answer_form_spec.rb +50 -0
- data/decidim-proposals/spec/forms/decidim/proposals/proposal_form_spec.rb +5 -93
- data/decidim-proposals/spec/helpers/application_helper_spec.rb +33 -0
- data/decidim-proposals/spec/helpers/proposal_votes_helper_spec.rb +53 -0
- data/decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb +1 -1
- data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +21 -19
- data/decidim-proposals/spec/models/decidim/proposals/proposal_vote_spec.rb +19 -1
- data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +66 -25
- data/decidim-proposals/spec/shared/create_proposal_examples.rb +69 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +49 -0
- data/decidim-proposals/spec/shared/proposal_form_examples.rb +100 -0
- data/decidim-results/.gitignore +7 -0
- data/decidim-results/README.md +23 -0
- data/decidim-results/Rakefile +2 -0
- data/decidim-results/app/assets/images/decidim/results/icon.svg +1 -0
- data/decidim-results/app/commands/decidim/results/admin/create_result.rb +65 -0
- data/decidim-results/app/commands/decidim/results/admin/update_result.rb +69 -0
- data/decidim-results/app/controllers/decidim/results/admin/application_controller.rb +14 -0
- data/decidim-results/app/controllers/decidim/results/admin/results_controller.rb +69 -0
- data/decidim-results/app/controllers/decidim/results/application_controller.rb +13 -0
- data/decidim-results/app/controllers/decidim/results/results_controller.rb +42 -0
- data/decidim-results/app/forms/decidim/results/admin/result_form.rb +40 -0
- data/decidim-results/app/helpers/decidim/results/application_helper.rb +11 -0
- data/decidim-results/app/models/decidim/results/application_record.rb +9 -0
- data/decidim-results/app/models/decidim/results/result.rb +15 -0
- data/decidim-results/app/services/decidim/results/result_search.rb +44 -0
- data/decidim-results/app/services/decidim/results/result_stats_calculator.rb +51 -0
- data/decidim-results/app/views/decidim/results/admin/results/_form.html.erb +23 -0
- data/decidim-results/app/views/decidim/results/admin/results/edit.html.erb +9 -0
- data/decidim-results/app/views/decidim/results/admin/results/index.html.erb +27 -0
- data/decidim-results/app/views/decidim/results/admin/results/new.html.erb +9 -0
- data/decidim-results/app/views/decidim/results/results/_count.html.erb +1 -0
- data/decidim-results/app/views/decidim/results/results/_filters.html.erb +22 -0
- data/decidim-results/app/views/decidim/results/results/_linked_results.html.erb +12 -0
- data/decidim-results/app/views/decidim/results/results/_results.html.erb +16 -0
- data/decidim-results/app/views/decidim/results/results/_tags.html.erb +10 -0
- data/decidim-results/app/views/decidim/results/results/index.html.erb +22 -0
- data/decidim-results/app/views/decidim/results/results/index.js.erb +2 -0
- data/decidim-results/app/views/decidim/results/results/show.html.erb +52 -0
- data/decidim-results/bin/rails +14 -0
- data/decidim-results/config/i18n-tasks.yml +5 -0
- data/decidim-results/config/locales/ca.yml +61 -0
- data/decidim-results/config/locales/en.yml +62 -0
- data/decidim-results/config/locales/es.yml +61 -0
- data/decidim-results/db/migrate/20170116104125_create_results.rb +14 -0
- data/decidim-results/db/migrate/20170129164553_remove_short_description_from_results.rb +5 -0
- data/decidim-results/decidim-results.gemspec +26 -0
- data/decidim-results/lib/decidim/results.rb +11 -0
- data/decidim-results/lib/decidim/results/admin.rb +9 -0
- data/decidim-results/lib/decidim/results/admin_engine.rb +22 -0
- data/decidim-results/lib/decidim/results/feature.rb +52 -0
- data/decidim-results/lib/decidim/results/list_engine.rb +19 -0
- data/decidim-results/lib/decidim/results/test/factories.rb +11 -0
- data/decidim-results/spec/commands/create_result_spec.rb +90 -0
- data/decidim-results/spec/commands/update_result_spec.rb +83 -0
- data/decidim-results/spec/factories.rb +6 -0
- data/decidim-results/spec/features/admin_manages_results_spec.rb +16 -0
- data/decidim-results/spec/features/explore_results_spec.rb +186 -0
- data/decidim-results/spec/features/process_admin_manages_results_spec.rb +17 -0
- data/decidim-results/spec/forms/result_form_spec.rb +91 -0
- data/decidim-results/spec/models/result_spec.rb +18 -0
- data/decidim-results/spec/services/result_search_spec.rb +97 -0
- data/decidim-results/spec/services/result_stats_calculator_spec.rb +93 -0
- data/decidim-results/spec/shared/admin_shared_context.rb +11 -0
- data/decidim-results/spec/shared/manage_results_examples.rb +96 -0
- data/decidim-results/spec/spec_helper.rb +2 -0
- data/decidim-system/app/assets/javascripts/decidim/system/application.js.es6 +1 -3
- data/decidim-system/app/views/layouts/decidim/system/_header.html.erb +2 -2
- data/decidim-system/decidim-system.gemspec +0 -1
- data/decidim-system/lib/decidim/system/engine.rb +0 -1
- data/decidim-system/spec/features/manage_admins_spec.rb +1 -1
- data/decidim-system/spec/features/organizations_spec.rb +1 -1
- data/decidim.gemspec +2 -0
- data/docs/how_to_create_a_plugin.md +0 -2
- data/lib/decidim.rb +2 -0
- data/lib/generators/decidim/install_generator.rb +1 -0
- data/lib/generators/decidim/templates/Gemfile.erb +10 -1
- data/lib/generators/decidim/templates/initializer.rb +9 -0
- data/lib/generators/decidim/templates/secrets.yml.erb +3 -0
- data/lib/generators/decidim/templates/social_share_button.rb +1 -1
- data/package.json +2 -3
- data/yarn.lock +10 -8
- metadata +265 -32
- data/decidim-admin/app/helpers/decidim/admin/aria_selected_link_to_helper.rb +0 -28
- data/decidim-admin/app/views/decidim/admin/participatory_process_attachments/edit.html.erb +0 -9
- data/decidim-admin/app/views/decidim/admin/participatory_process_attachments/index.html.erb +0 -37
- data/decidim-admin/app/views/decidim/admin/participatory_process_attachments/show.html.erb +0 -25
- data/decidim-comments/app/frontend/support/generate_current_user_data.js +0 -13
- data/decidim-comments/app/types/decidim/comments/author_type.rb +0 -15
- data/decidim-comments/spec/types/author_type_spec.rb +0 -21
- data/decidim-dev/lib/decidim/dev/assets/avatar.svg +0 -14
- data/decidim-proposals/app/views/decidim/proposals/proposal_votes/create.js.erb +0 -5
@@ -9,12 +9,10 @@ describe "Vote Proposal", type: :feature do
|
|
9
9
|
let!(:proposal) { Decidim::Proposals::Proposal.where(feature: feature).first }
|
10
10
|
let!(:user) { create :user, :confirmed, organization: organization }
|
11
11
|
|
12
|
-
let(:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
feature.save
|
17
|
-
visit_feature
|
12
|
+
let!(:feature) do
|
13
|
+
create(:proposal_feature,
|
14
|
+
manifest: manifest,
|
15
|
+
participatory_process: participatory_process)
|
18
16
|
end
|
19
17
|
|
20
18
|
context "when votes are not enabled" do
|
@@ -25,10 +23,17 @@ describe "Vote Proposal", type: :feature do
|
|
25
23
|
end
|
26
24
|
|
27
25
|
context "when votes are enabled" do
|
28
|
-
let(:
|
29
|
-
|
26
|
+
let!(:feature) do
|
27
|
+
create(:proposal_feature,
|
28
|
+
:with_votes_enabled,
|
29
|
+
manifest: manifest,
|
30
|
+
participatory_process: participatory_process)
|
31
|
+
end
|
32
|
+
|
30
33
|
context "when the user is not logged in" do
|
31
34
|
it "should be given the option to sign in" do
|
35
|
+
visit_feature
|
36
|
+
|
32
37
|
within ".card__support", match: :first do
|
33
38
|
page.find('.card__button').click
|
34
39
|
end
|
@@ -58,7 +63,7 @@ describe "Vote Proposal", type: :feature do
|
|
58
63
|
|
59
64
|
context "when the proposal is already voted" do
|
60
65
|
before do
|
61
|
-
create(:proposal_vote, proposal: proposal, author: user)
|
66
|
+
create(:proposal_vote, proposal: proposal, author: user)
|
62
67
|
visit_feature
|
63
68
|
end
|
64
69
|
|
@@ -69,10 +74,77 @@ describe "Vote Proposal", type: :feature do
|
|
69
74
|
end
|
70
75
|
|
71
76
|
within "#proposal-#{proposal.id}-votes-count" do
|
72
|
-
expect(page).to have_content("1 VOTE")
|
77
|
+
expect(page).to have_content("1 VOTE")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "when the feature has a vote limit" do
|
83
|
+
let(:vote_limit) { 10 }
|
84
|
+
|
85
|
+
let!(:feature) do
|
86
|
+
create(:proposal_feature,
|
87
|
+
:with_votes_enabled,
|
88
|
+
:with_vote_limit,
|
89
|
+
vote_limit: vote_limit,
|
90
|
+
manifest: manifest,
|
91
|
+
participatory_process: participatory_process)
|
92
|
+
end
|
93
|
+
|
94
|
+
context "when the proposal is not voted yet" do
|
95
|
+
it "should update the remaining votes counter" do
|
96
|
+
within "#proposal-#{proposal.id}-vote-button" do
|
97
|
+
page.find('.card__button').click
|
98
|
+
expect(page).to have_css('.card__button.success')
|
99
|
+
end
|
100
|
+
|
101
|
+
expect(page).to have_content("REMAINING 9 VOTES")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context "when the proposal is already voted" do
|
106
|
+
before do
|
107
|
+
create(:proposal_vote, proposal: proposal, author: user)
|
108
|
+
visit_feature
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should be able to undo the vote" do
|
112
|
+
within "#proposal-#{proposal.id}-vote-button" do
|
113
|
+
expect(page).to have_css('.card__button.success')
|
114
|
+
page.find('.card__button').click
|
115
|
+
end
|
116
|
+
|
117
|
+
expect(page).to have_content("REMAINING 10 VOTES")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "when the user has reached the votes limit" do
|
122
|
+
let(:vote_limit) { 1 }
|
123
|
+
|
124
|
+
before do
|
125
|
+
create(:proposal_vote, proposal: proposal, author: user)
|
126
|
+
visit_feature
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should not be able to vote other proposals" do
|
130
|
+
expect(page).to have_css('.card__button[disabled]', count: 2)
|
131
|
+
end
|
132
|
+
|
133
|
+
context "when votes are blocked" do
|
134
|
+
let!(:feature) do
|
135
|
+
create(:proposal_feature,
|
136
|
+
:with_votes_blocked,
|
137
|
+
manifest: manifest,
|
138
|
+
participatory_process: participatory_process)
|
139
|
+
end
|
140
|
+
|
141
|
+
it "shows the vote count but not the vote button" do
|
142
|
+
expect(page).to have_css('.card__support__data', text: "1 VOTE")
|
143
|
+
expect(page).to have_content("Voting disabled")
|
144
|
+
end
|
73
145
|
end
|
74
146
|
end
|
75
147
|
end
|
76
148
|
end
|
77
149
|
end
|
78
|
-
end
|
150
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
require_relative "../../../shared/proposal_form_examples"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Proposals
|
7
|
+
module Admin
|
8
|
+
describe ProposalForm do
|
9
|
+
it_behaves_like "a proposal form"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
module Decidim
|
5
|
+
module Proposals
|
6
|
+
module Admin
|
7
|
+
describe ProposalAnswerForm do
|
8
|
+
let(:organization) { create(:organization) }
|
9
|
+
let(:state) { "accepted" }
|
10
|
+
let(:answer) { Decidim::Faker::Localized.sentence(3) }
|
11
|
+
let(:params) do
|
12
|
+
{
|
13
|
+
state: state, answer: answer
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:form) do
|
18
|
+
described_class.from_params(params).with_context(
|
19
|
+
current_organization: organization
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
subject { form }
|
24
|
+
|
25
|
+
context "when everything is OK" do
|
26
|
+
it { is_expected.to be_valid }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when the state is not valid" do
|
30
|
+
let(:state) { "foo" }
|
31
|
+
it { is_expected.to be_invalid }
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when there's no state" do
|
35
|
+
let(:state) { nil }
|
36
|
+
it { is_expected.to be_invalid }
|
37
|
+
end
|
38
|
+
|
39
|
+
context "rejecting a proposal" do
|
40
|
+
let(:state) { "rejected" }
|
41
|
+
|
42
|
+
context "when there's no answer" do
|
43
|
+
let(:answer) { nil }
|
44
|
+
it { is_expected.to be_invalid }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,105 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "spec_helper"
|
3
|
+
require_relative "../../../shared/proposal_form_examples"
|
3
4
|
|
4
5
|
module Decidim
|
5
6
|
module Proposals
|
6
7
|
describe ProposalForm do
|
7
|
-
|
8
|
-
let(:title) { "Oriol for president!" }
|
9
|
-
let(:body) { "Everything would be better" }
|
10
|
-
let(:author) { create(:user, organization: feature.organization) }
|
11
|
-
let(:category) { create(:category, participatory_process: feature.participatory_process) }
|
12
|
-
let(:scope) { create(:scope, organization: feature.organization) }
|
13
|
-
let(:category_id) { category.try(:id)}
|
14
|
-
let(:scope_id) { scope.try(:id)}
|
15
|
-
let(:params) do
|
16
|
-
{
|
17
|
-
title: title,
|
18
|
-
body: body,
|
19
|
-
author: author,
|
20
|
-
category_id: category_id,
|
21
|
-
scope_id: scope_id
|
22
|
-
}
|
23
|
-
end
|
8
|
+
it_behaves_like "a proposal form"
|
24
9
|
|
25
|
-
let(:
|
26
|
-
|
27
|
-
|
28
|
-
current_organization: feature.organization
|
10
|
+
let(:params) do
|
11
|
+
super.merge(
|
12
|
+
user_group_id: user_group_id
|
29
13
|
)
|
30
14
|
end
|
31
|
-
|
32
|
-
subject { form }
|
33
|
-
|
34
|
-
context "when everything is OK" do
|
35
|
-
it { is_expected.to be_valid }
|
36
|
-
end
|
37
|
-
|
38
|
-
context "when there's no title" do
|
39
|
-
let(:title) { nil }
|
40
|
-
it { is_expected.to be_invalid }
|
41
|
-
end
|
42
|
-
|
43
|
-
context "when there's no body" do
|
44
|
-
let(:body) { nil }
|
45
|
-
it { is_expected.to be_invalid }
|
46
|
-
end
|
47
|
-
|
48
|
-
context "when no category_id" do
|
49
|
-
let(:category_id) { nil }
|
50
|
-
it { is_expected.to be_valid }
|
51
|
-
end
|
52
|
-
|
53
|
-
context "when no scope_id" do
|
54
|
-
let(:scope_id) { nil }
|
55
|
-
it { is_expected.to be_valid }
|
56
|
-
end
|
57
|
-
|
58
|
-
context "with invalid category_id" do
|
59
|
-
let(:category_id) { 987 }
|
60
|
-
it { is_expected.to be_invalid}
|
61
|
-
end
|
62
|
-
|
63
|
-
context "with invalid scope_id" do
|
64
|
-
let(:scope_id) { 987 }
|
65
|
-
it { is_expected.to be_invalid}
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "category" do
|
69
|
-
subject { form.category }
|
70
|
-
|
71
|
-
context "when the category exists" do
|
72
|
-
it { is_expected.to be_kind_of(Decidim::Category) }
|
73
|
-
end
|
74
|
-
|
75
|
-
context "when the category does not exist" do
|
76
|
-
let(:category_id) { 7654 }
|
77
|
-
it { is_expected.to eq(nil) }
|
78
|
-
end
|
79
|
-
|
80
|
-
context "when the category is from another process" do
|
81
|
-
let(:category_id) { create(:category).id }
|
82
|
-
it { is_expected.to eq(nil) }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "scope" do
|
87
|
-
subject { form.scope }
|
88
|
-
|
89
|
-
context "when the scope exists" do
|
90
|
-
it { is_expected.to be_kind_of(Decidim::Scope) }
|
91
|
-
end
|
92
|
-
|
93
|
-
context "when the scope does not exist" do
|
94
|
-
let(:scope_id) { 3456 }
|
95
|
-
it { is_expected.to eq(nil) }
|
96
|
-
end
|
97
|
-
|
98
|
-
context "when the scope is from another organization" do
|
99
|
-
let(:scope_id) { create(:scope).id }
|
100
|
-
it { is_expected.to eq(nil) }
|
101
|
-
end
|
102
|
-
end
|
103
15
|
end
|
104
16
|
end
|
105
17
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
module Decidim
|
5
|
+
module Proposals
|
6
|
+
describe ApplicationHelper do
|
7
|
+
describe "humanize_proposal_state" do
|
8
|
+
let(:helper) do
|
9
|
+
Class.new.tap do |v|
|
10
|
+
v.extend(Decidim::Proposals::ApplicationHelper)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
subject { helper.humanize_proposal_state(state) }
|
15
|
+
|
16
|
+
context "when it is accepted" do
|
17
|
+
let(:state) { "accepted" }
|
18
|
+
it { is_expected.to eq("Accepted") }
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when it is rejected" do
|
22
|
+
let(:state) { "rejected" }
|
23
|
+
it { is_expected.to eq("Rejected") }
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when it is nil" do
|
27
|
+
let(:state) { nil }
|
28
|
+
it { is_expected.to eq("Not answered") }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -4,6 +4,17 @@ require "spec_helper"
|
|
4
4
|
module Decidim
|
5
5
|
module Proposals
|
6
6
|
describe ProposalVotesHelper do
|
7
|
+
let(:organization) { create(:organization) }
|
8
|
+
let(:vote_limit) { 10 }
|
9
|
+
let(:proposal_feature) { create(:proposal_feature, organization: organization) }
|
10
|
+
let(:user) { create(:user, organization: organization) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
allow(helper).to receive(:current_user).and_return(user)
|
14
|
+
allow(helper).to receive(:current_feature).and_return(proposal_feature)
|
15
|
+
allow(helper).to receive(:feature_settings).and_return(double(vote_limit: vote_limit))
|
16
|
+
end
|
17
|
+
|
7
18
|
describe "#vote_button_classes" do
|
8
19
|
it "returns small buttons classes from proposals list" do
|
9
20
|
expect(helper.vote_button_classes(true)).to eq("small")
|
@@ -23,6 +34,48 @@ module Decidim
|
|
23
34
|
expect(helper.votes_count_classes(false)).to eq(number: "extra__suport-number", label: "extra__suport-text")
|
24
35
|
end
|
25
36
|
end
|
37
|
+
|
38
|
+
describe "#vote_limit_enabled?" do
|
39
|
+
context "when the current_user is not present" do
|
40
|
+
let(:user) { nil }
|
41
|
+
|
42
|
+
it "returns false" do
|
43
|
+
expect(helper).to receive(:current_user).and_return(nil)
|
44
|
+
expect(helper.vote_limit_enabled?).to be_falsy
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when the current_settings vote_limit is not present" do
|
49
|
+
let(:vote_limit) { nil }
|
50
|
+
|
51
|
+
it "returns false" do
|
52
|
+
expect(helper.vote_limit_enabled?).to be_falsy
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the current_settings vote_limit is less or equal 0" do
|
57
|
+
let(:vote_limit) { 0 }
|
58
|
+
|
59
|
+
it "returns false" do
|
60
|
+
expect(helper.vote_limit_enabled?).to be_falsy
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when the current_settings vote_limit is greater than 0" do
|
65
|
+
it "returns true" do
|
66
|
+
expect(helper.vote_limit_enabled?).to be_truthy
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "#remaining_votes_count_for" do
|
72
|
+
it "returns the remaining votes for a user based on the feature votes limit" do
|
73
|
+
proposal = create(:proposal, feature: proposal_feature)
|
74
|
+
create(:proposal_vote, author: user, proposal: proposal)
|
75
|
+
|
76
|
+
expect(helper.remaining_votes_count_for(user)).to eq(9)
|
77
|
+
end
|
78
|
+
end
|
26
79
|
end
|
27
80
|
end
|
28
81
|
end
|
@@ -4,31 +4,19 @@ require "spec_helper"
|
|
4
4
|
module Decidim
|
5
5
|
module Proposals
|
6
6
|
describe Proposal do
|
7
|
-
|
7
|
+
let(:proposal) { build(:proposal) }
|
8
|
+
subject { proposal }
|
9
|
+
|
10
|
+
include_examples "authorable"
|
11
|
+
include_examples "has feature"
|
12
|
+
include_examples "has scope"
|
13
|
+
include_examples "has category"
|
8
14
|
|
9
15
|
it { is_expected.to be_valid }
|
10
16
|
|
11
17
|
it "has a votes association returning proposal votes" do
|
12
18
|
expect(subject.votes.count).to eq(0)
|
13
19
|
end
|
14
|
-
|
15
|
-
context "when the category is from another feature" do
|
16
|
-
subject { build(:proposal, category: create(:category))}
|
17
|
-
|
18
|
-
it { is_expected.to be_invalid}
|
19
|
-
end
|
20
|
-
|
21
|
-
context "when the author is from another organization" do
|
22
|
-
subject { build(:proposal, author: create(:user))}
|
23
|
-
|
24
|
-
it { is_expected.to be_invalid}
|
25
|
-
end
|
26
|
-
|
27
|
-
context "when the scope is from another organization" do
|
28
|
-
subject { build(:proposal, scope: create(:scope))}
|
29
|
-
|
30
|
-
it { is_expected.to be_invalid}
|
31
|
-
end
|
32
20
|
|
33
21
|
describe "#voted_by?" do
|
34
22
|
let(:user) { create(:user, organization: subject.organization) }
|
@@ -42,6 +30,20 @@ module Decidim
|
|
42
30
|
expect(subject.voted_by?(user)).to be_truthy
|
43
31
|
end
|
44
32
|
end
|
33
|
+
|
34
|
+
context "when it has been accepted" do
|
35
|
+
let(:proposal) { build(:proposal, :accepted) }
|
36
|
+
|
37
|
+
it { is_expected.to be_answered }
|
38
|
+
it { is_expected.to be_accepted }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when it has been rejected" do
|
42
|
+
let(:proposal) { build(:proposal, :rejected) }
|
43
|
+
|
44
|
+
it { is_expected.to be_answered }
|
45
|
+
it { is_expected.to be_rejected }
|
46
|
+
end
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|