decidim 0.0.1 → 0.0.2
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/.codeclimate.yml +4 -5
- data/.eslintignore +2 -0
- data/.eslintrc.json +2 -0
- data/.gitignore +1 -0
- data/.inch.yml +5 -0
- data/.mention-bot +8 -0
- data/.rubocop.yml +8 -31
- data/.ruby-version +1 -1
- data/.travis.yml +24 -14
- data/Dockerfile +1 -3
- data/Gemfile +1 -3
- data/Gemfile.lock +175 -138
- data/README.md +63 -5
- data/Rakefile +1 -1
- data/codecov.yml +1 -0
- data/decidim-admin/Rakefile +1 -1
- data/decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6 +0 -1
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_foundation_and_overrides.scss +1 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_icons.scss +9 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/application.scss +1 -0
- data/decidim-admin/app/commands/decidim/admin/create_feature.rb +3 -1
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process.rb +26 -14
- data/decidim-admin/app/commands/decidim/admin/destroy_feature.rb +5 -0
- data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +29 -0
- data/decidim-admin/app/commands/decidim/admin/update_feature.rb +47 -0
- data/decidim-admin/app/commands/decidim/admin/update_organization.rb +3 -1
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +37 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +0 -16
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_steps_controller.rb +10 -3
- data/decidim-admin/app/controllers/decidim/admin/static_pages_controller.rb +4 -4
- data/decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb +32 -0
- data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +87 -0
- data/decidim-admin/app/forms/decidim/admin/category_form.rb +1 -7
- data/decidim-admin/app/forms/decidim/admin/feature_form.rb +26 -0
- data/decidim-admin/app/forms/decidim/admin/organization_form.rb +2 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_step_form.rb +1 -1
- data/decidim-admin/app/forms/decidim/admin/static_page_form.rb +2 -3
- data/decidim-admin/app/models/decidim/admin/abilities/admin_user.rb +6 -0
- data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +4 -1
- data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +49 -0
- data/decidim-admin/app/views/decidim/admin/features/_settings_fields.html.erb +5 -0
- data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +9 -0
- data/decidim-admin/app/views/decidim/admin/features/index.html.erb +6 -0
- data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +8 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_attachments/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/index.html.erb +2 -6
- data/decidim-admin/app/views/decidim/admin/user_groups/index.html.erb +32 -0
- data/decidim-admin/app/views/decidim/admin/users/_form.html.erb +6 -0
- data/decidim-admin/app/views/decidim/admin/users/index.html.erb +54 -0
- data/decidim-admin/app/views/decidim/admin/users/new.html.erb +11 -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 +1 -1
- data/decidim-admin/config/i18n-tasks.yml +1 -0
- data/decidim-admin/config/locales/ca.yml +103 -5
- data/decidim-admin/config/locales/en.yml +57 -4
- data/decidim-admin/config/locales/es.yml +103 -5
- data/decidim-admin/config/routes.rb +11 -0
- data/decidim-admin/decidim-admin.gemspec +2 -3
- data/decidim-admin/lib/decidim/admin/features/base_controller.rb +7 -3
- data/decidim-admin/lib/decidim/admin/test/factories.rb +8 -0
- data/decidim-admin/spec/commands/create_category_spec.rb +2 -1
- data/decidim-admin/spec/commands/create_feature_spec.rb +21 -2
- data/decidim-admin/spec/commands/create_participatory_process_spec.rb +13 -1
- data/decidim-admin/spec/commands/create_static_page_spec.rb +1 -1
- data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +45 -0
- data/decidim-admin/spec/commands/update_category_spec.rb +2 -1
- data/decidim-admin/spec/commands/update_feature_spec.rb +79 -0
- data/decidim-admin/spec/commands/update_organization_spec.rb +3 -2
- data/decidim-admin/spec/commands/update_static_page_spec.rb +3 -2
- data/decidim-admin/spec/factories.rb +2 -9
- data/decidim-admin/spec/features/admin_manages_features_spec.rb +84 -2
- data/decidim-admin/spec/features/admin_manages_organization_admins_spec.rb +71 -0
- data/decidim-admin/spec/features/admin_manages_user_groups_spec.rb +24 -0
- data/decidim-admin/spec/forms/category_form_spec.rb +3 -7
- data/decidim-admin/spec/forms/organization_form_spec.rb +8 -2
- data/decidim-admin/spec/forms/participatory_process_form_spec.rb +2 -1
- data/decidim-admin/spec/forms/participatory_process_step_form_spec.rb +2 -21
- data/decidim-admin/spec/forms/scope_form_spec.rb +1 -1
- data/decidim-admin/spec/forms/static_page_form_spec.rb +2 -7
- data/decidim-admin/spec/models/abilities/admin_user_spec.rb +22 -0
- data/decidim-admin/spec/shared/manage_process_attachments_examples.rb +2 -1
- data/decidim-admin/spec/shared/manage_process_steps_examples.rb +2 -15
- data/decidim-admin/spec/spec_helper.rb +3 -1
- data/decidim-api/Rakefile +1 -1
- data/decidim-api/decidim-api.gemspec +3 -3
- data/decidim-api/spec/factories.rb +2 -2
- data/decidim-api/spec/spec_helper.rb +3 -1
- data/decidim-comments/Rakefile +1 -1
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/commands/decidim/comments/vote_comment.rb +38 -0
- data/decidim-comments/app/frontend/application/icon.component.jsx +9 -4
- data/decidim-comments/app/frontend/application/icon.component.test.jsx +12 -2
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +43 -11
- data/decidim-comments/app/frontend/comments/add_comment_form.mutation.graphql +1 -4
- data/decidim-comments/app/frontend/comments/comment.component.jsx +67 -7
- data/decidim-comments/app/frontend/comments/comment.component.test.jsx +49 -1
- data/decidim-comments/app/frontend/comments/comment_data.fragment.graphql +3 -0
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +51 -6
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.test.jsx +12 -1
- data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +11 -5
- data/decidim-comments/app/frontend/comments/comment_thread.component.test.jsx +13 -3
- data/decidim-comments/app/frontend/comments/comment_thread.fragment.graphql +1 -3
- data/decidim-comments/app/frontend/comments/comments.component.jsx +37 -11
- data/decidim-comments/app/frontend/comments/comments.component.test.jsx +44 -7
- data/decidim-comments/app/frontend/comments/comments.query.graphql +2 -2
- data/decidim-comments/app/frontend/comments/down_vote.fragment.graphql +6 -0
- data/decidim-comments/app/frontend/comments/down_vote.mutation.graphql +7 -0
- data/decidim-comments/app/frontend/comments/down_vote_button.component.jsx +84 -0
- data/decidim-comments/app/frontend/comments/down_vote_button.component.test.jsx +48 -0
- data/decidim-comments/app/frontend/comments/up_vote.fragment.graphql +6 -0
- data/decidim-comments/app/frontend/comments/up_vote.mutation.graphql +7 -0
- data/decidim-comments/app/frontend/comments/up_vote_button.component.jsx +84 -0
- data/decidim-comments/app/frontend/comments/up_vote_button.component.test.jsx +48 -0
- data/decidim-comments/app/frontend/comments/vote_button.component.jsx +19 -0
- data/decidim-comments/app/frontend/comments/vote_button_component.test.jsx +38 -0
- data/decidim-comments/app/frontend/support/generate_comments_data.js +7 -2
- data/decidim-comments/app/helpers/decidim/comments/comments_helper.rb +1 -1
- data/decidim-comments/app/models/decidim/comments/application_record.rb +9 -0
- data/decidim-comments/app/models/decidim/comments/comment.rb +19 -4
- data/decidim-comments/app/models/decidim/comments/comment_vote.rb +22 -0
- data/decidim-comments/app/models/decidim/comments/seed.rb +27 -0
- data/decidim-comments/app/queries/decidim/comments/comments_with_replies.rb +88 -0
- data/decidim-comments/app/resolvers/decidim/comments/vote_comment_resolver.rb +20 -0
- data/decidim-comments/app/types/decidim/comments/comment_mutation_type.rb +19 -0
- data/decidim-comments/app/types/decidim/comments/comment_type.rb +38 -2
- data/decidim-comments/config/locales/en.yml +1 -0
- data/decidim-comments/db/migrate/20161130143508_create_comments.rb +4 -2
- data/decidim-comments/db/migrate/20161219150806_create_comment_votes.rb +13 -0
- data/decidim-comments/decidim-comments.gemspec +0 -3
- data/decidim-comments/lib/decidim/comments/mutation_extensions.rb +9 -0
- data/decidim-comments/lib/decidim/comments/query_extensions.rb +3 -5
- data/decidim-comments/lib/decidim/comments/test/factories.rb +22 -0
- data/decidim-comments/spec/commands/vote_comment_spec.rb +124 -0
- data/decidim-comments/spec/factories.rb +2 -9
- data/decidim-comments/spec/features/comments_spec.rb +37 -0
- data/decidim-comments/spec/models/comment_spec.rb +34 -0
- data/decidim-comments/spec/models/comment_vote_spec.rb +44 -0
- data/decidim-comments/spec/models/seed_spec.rb +19 -0
- data/decidim-comments/spec/queries/comments_with_replies_spec.rb +86 -0
- data/decidim-comments/spec/spec_helper.rb +3 -1
- data/decidim-comments/spec/support/dummy.rb +1 -1
- data/decidim-comments/spec/types/comment_mutation_type_spec.rb +46 -0
- data/decidim-comments/spec/types/comment_type_spec.rb +57 -3
- data/{decidim-api → decidim-comments}/spec/types/mutation_type_spec.rb +11 -0
- data/decidim-dev/README.md +7 -11
- data/decidim-dev/decidim-dev.gemspec +5 -4
- data/decidim-dev/lib/decidim/dev.rb +20 -0
- data/decidim-dev/lib/decidim/dev/assets/Exampledocument.docx +0 -0
- data/decidim-dev/lib/decidim/dev/assets/Exampledocument.odt +0 -0
- data/decidim-dev/lib/decidim/dev/assets/Exampledocument.pdf +0 -0
- data/decidim-dev/lib/decidim/dev/assets/avatar.svg +14 -0
- data/decidim-dev/lib/decidim/dev/assets/city.jpeg +0 -0
- data/decidim-dev/lib/decidim/dev/assets/city2.jpeg +0 -0
- data/decidim-dev/lib/decidim/dev/assets/city3.jpeg +0 -0
- data/decidim-dev/lib/decidim/dev/assets/malicious.jpg +0 -0
- data/decidim-dev/lib/decidim/{common_rake.rb → dev/common_rake.rb} +1 -1
- data/decidim-dev/lib/decidim/{dummy_authorization_handler.rb → dev/dummy_authorization_handler.rb} +4 -4
- data/decidim-dev/lib/decidim/{test → dev/test}/authorization_shared_examples.rb +0 -8
- data/decidim-dev/lib/decidim/{test → dev/test}/base_spec_helper.rb +4 -1
- data/decidim-dev/lib/decidim/{test → dev/test}/i18n_spec.rb +1 -1
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/action_mailer.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/active_job.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/authenticated_controller_context.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/authorization_handlers.rb +1 -1
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/capybara.rb +3 -10
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/database_cleaner.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/engine_routes.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/factory_girl.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/feature.rb +10 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/feature_context.rb +2 -2
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/helpers.rb +4 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/i18n.rb +1 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/bind-polyfill.js +18 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/object-assign-polyfill.js +24 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/promise.js +233 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/translation_helpers.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/warden.rb +0 -0
- data/decidim-dev/lib/decidim/{test → dev/test}/rspec_support/wisper.rb +0 -0
- data/decidim-dev/lib/generators/decidim/dummy_generator.rb +2 -2
- data/decidim-dev/lib/generators/decidim/templates/decidim_dev.rb +2 -0
- data/decidim-meetings/Rakefile +1 -1
- data/decidim-meetings/app/assets/images/decidim/meetings/icon.svg +1 -0
- data/decidim-meetings/app/commands/decidim/meetings/admin/create_meeting.rb +2 -0
- data/decidim-meetings/app/commands/decidim/meetings/admin/update_meeting.rb +2 -0
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +30 -6
- data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +14 -0
- data/decidim-meetings/app/helpers/decidim/meetings/application_helper.rb +10 -0
- data/decidim-meetings/app/models/decidim/meetings/meeting.rb +18 -1
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +48 -0
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/_form.html.erb +9 -2
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +24 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +30 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_tags.html.erb +10 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +8 -26
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.js.erb +2 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +1 -0
- data/decidim-meetings/config/locales/ca.yml +7 -0
- data/decidim-meetings/config/locales/en.yml +7 -0
- data/decidim-meetings/config/locales/es.yml +7 -0
- data/decidim-meetings/db/migrate/20161130121354_create_meetings.rb +2 -0
- data/decidim-meetings/decidim-meetings.gemspec +2 -0
- data/decidim-meetings/lib/decidim/meetings/feature.rb +7 -2
- data/decidim-meetings/lib/decidim/meetings/list_engine.rb +3 -0
- data/decidim-meetings/spec/commands/create_meeting_spec.rb +21 -0
- data/decidim-meetings/spec/commands/update_meeting_spec.rb +17 -2
- data/decidim-meetings/spec/factories.rb +3 -3
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +53 -0
- data/decidim-meetings/spec/forms/meeting_form_spec.rb +19 -1
- data/decidim-meetings/spec/models/meeting_spec.rb +20 -0
- data/decidim-meetings/spec/services/meeting_search_spec.rb +146 -0
- data/decidim-meetings/spec/shared/admin_shared_context.rb +4 -2
- data/decidim-meetings/spec/shared/manage_meetings_examples.rb +5 -2
- data/decidim-meetings/spec/spec_helper.rb +1 -1
- data/decidim-pages/Rakefile +1 -1
- data/decidim-pages/app/assets/images/decidim/pages/icon.svg +3 -0
- data/decidim-pages/app/commands/decidim/pages/admin/update_page.rb +1 -2
- data/decidim-pages/app/forms/decidim/pages/admin/page_form.rb +0 -1
- 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 +3 -3
- data/decidim-pages/config/i18n-tasks.yml +1 -0
- data/decidim-pages/config/locales/ca.yml +5 -1
- data/decidim-pages/config/locales/en.yml +5 -1
- data/decidim-pages/config/locales/es.yml +5 -1
- data/decidim-pages/db/migrate/20170110145040_remove_commentable_flag_from_pages.rb +5 -0
- data/decidim-pages/lib/decidim/pages/feature.rb +13 -3
- data/decidim-pages/spec/commands/update_page_spec.rb +2 -1
- data/decidim-pages/spec/factories.rb +2 -2
- data/decidim-pages/spec/features/admin_spec.rb +0 -11
- data/decidim-pages/spec/features/page_show_spec.rb +13 -10
- data/decidim-pages/spec/forms/page_form_spec.rb +4 -4
- data/decidim-pages/spec/spec_helper.rb +3 -1
- data/decidim-proposals/Rakefile +1 -1
- data/decidim-proposals/app/assets/config/decidim_proposals_manifest.css +1 -0
- data/decidim-proposals/app/assets/config/decidim_proposals_manifest.js +1 -0
- data/decidim-proposals/app/assets/images/decidim/proposals/icon.svg +1 -0
- data/decidim-proposals/app/assets/javascripts/decidim/proposals/social_share.js +2 -0
- data/decidim-proposals/app/assets/stylesheets/decidim/proposals/social_share.css.scss +14 -0
- data/decidim-proposals/app/commands/decidim/proposals/create_proposal.rb +5 -3
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +3 -3
- data/decidim-proposals/app/controllers/decidim/proposals/proposal_votes_controller.rb +25 -0
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +33 -6
- data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_form.rb +7 -6
- data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +6 -6
- data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +3 -1
- data/decidim-proposals/app/helpers/decidim/proposals/proposal_votes_helper.rb +27 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +8 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal_vote.rb +20 -0
- data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +39 -11
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/_form.html.erb +2 -2
- data/decidim-proposals/app/views/decidim/proposals/proposal_votes/create.js.erb +5 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_count.html.erb +1 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +26 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +11 -2
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +4 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_share.html.erb +33 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +13 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +6 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +11 -11
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.js.erb +5 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +31 -4
- data/decidim-proposals/config/i18n-tasks.yml +1 -0
- data/decidim-proposals/config/initializers/social_share_button.rb +4 -0
- data/decidim-proposals/config/locales/ca.yml +28 -2
- data/decidim-proposals/config/locales/en.yml +27 -1
- data/decidim-proposals/config/locales/es.yml +28 -2
- data/decidim-proposals/db/migrate/20170112115253_create_proposal_votes.rb +12 -0
- data/decidim-proposals/db/migrate/20170113114245_add_text_search_indexes.rb +6 -0
- data/decidim-proposals/db/migrate/20170118120151_add_counter_cache_votes_to_proposals.rb +5 -0
- data/decidim-proposals/decidim-proposals.gemspec +2 -1
- data/decidim-proposals/lib/decidim/proposals/engine.rb +8 -1
- data/decidim-proposals/lib/decidim/proposals/feature.rb +30 -4
- data/decidim-proposals/spec/commands/decidim/proposals/create_proposal_spec.rb +10 -3
- data/decidim-proposals/spec/factories.rb +9 -4
- data/decidim-proposals/spec/features/admin_manages_proposals_spec.rb +2 -0
- data/decidim-proposals/spec/features/process_admin_manages_proposals_spec.rb +2 -0
- data/decidim-proposals/spec/features/proposals_spec.rb +41 -31
- data/decidim-proposals/spec/features/vote_proposal_spec.rb +78 -0
- data/decidim-proposals/spec/forms/decidim/proposals/proposal_form_spec.rb +11 -10
- data/decidim-proposals/spec/helpers/proposal_votes_helper_spec.rb +28 -0
- data/decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb +1 -1
- data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +20 -3
- data/decidim-proposals/spec/models/decidim/proposals/proposal_vote_spec.rb +43 -0
- data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +50 -4
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +1 -1
- data/decidim-proposals/spec/spec_helper.rb +1 -1
- data/decidim-system/Rakefile +1 -1
- data/decidim-system/app/commands/decidim/system/register_organization.rb +13 -12
- data/decidim-system/decidim-system.gemspec +2 -3
- data/decidim-system/spec/factories.rb +1 -1
- data/decidim-system/spec/spec_helper.rb +3 -1
- data/docs/social_providers.md +41 -0
- data/karma.conf.js +4 -2
- data/lib/generators/decidim/app_generator.rb +6 -0
- data/lib/generators/decidim/demo_generator.rb +2 -2
- data/lib/generators/decidim/install_generator.rb +5 -4
- data/lib/generators/decidim/templates/Gemfile.erb +3 -5
- data/lib/generators/decidim/templates/initializer.rb +1 -1
- data/lib/generators/decidim/templates/secrets.yml.erb +26 -0
- data/lib/generators/decidim/templates/social_share_button.rb +7 -0
- data/package.json +16 -6
- data/webpack.config.js +23 -8
- data/yarn.lock +401 -345
- metadata +130 -48
- data/Gemfile.common +0 -1
- data/decidim-admin/Gemfile +0 -6
- data/decidim-comments/Gemfile +0 -6
- data/decidim-comments/package.json +0 -21
- data/decidim-dev/Gemfile +0 -6
- data/decidim-dev/lib/decidim/test/rspec_support/bullet.rb +0 -15
- data/decidim-dev/lib/generators/decidim/templates/bullet.rb +0 -6
- data/decidim-system/Gemfile +0 -6
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "spec_helper"
|
5
|
+
require_relative "../shared/participatory_admin_shared_context"
|
6
|
+
|
7
|
+
describe "Admin manage user groups", type: :feature do
|
8
|
+
include_context "participatory process admin"
|
9
|
+
let!(:user_groups) { create_list(:user_group_membership, 10, user: create(:user, organization: organization)) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
switch_to_host(organization.host)
|
13
|
+
login_as user, scope: :user
|
14
|
+
visit decidim_admin.user_groups_path
|
15
|
+
end
|
16
|
+
|
17
|
+
it "verify a user group" do
|
18
|
+
click_button "Verify", match: :first
|
19
|
+
|
20
|
+
expect(page).not_to have_selector(".actions button", match: :first)
|
21
|
+
|
22
|
+
expect(page).to have_content("verified successfully")
|
23
|
+
end
|
24
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
require "spec_helper"
|
3
4
|
|
@@ -37,7 +38,8 @@ module Decidim
|
|
37
38
|
|
38
39
|
subject do
|
39
40
|
described_class.from_params(
|
40
|
-
attributes
|
41
|
+
attributes
|
42
|
+
).with_context(
|
41
43
|
current_process: participatory_process,
|
42
44
|
current_organization: organization
|
43
45
|
)
|
@@ -47,12 +49,6 @@ module Decidim
|
|
47
49
|
it { is_expected.to be_valid }
|
48
50
|
end
|
49
51
|
|
50
|
-
context "when participatory process is not set" do
|
51
|
-
let(:participatory_process) { nil }
|
52
|
-
|
53
|
-
it { is_expected.not_to be_valid }
|
54
|
-
end
|
55
|
-
|
56
52
|
context "when some language in name is missing" do
|
57
53
|
let(:name) do
|
58
54
|
{
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
module Admin
|
7
7
|
describe OrganizationForm do
|
8
8
|
let(:name) { "My super organization" }
|
9
|
+
let(:twitter_handler) { "My awesome handler" }
|
9
10
|
let(:welcome_text) do
|
10
11
|
{
|
11
12
|
en: "Welcome",
|
@@ -33,7 +34,8 @@ module Decidim
|
|
33
34
|
"description_en" => description[:en],
|
34
35
|
"description_es" => description[:es],
|
35
36
|
"description_ca" => description[:ca],
|
36
|
-
"homepage_image" => Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__), "..", "..", "..", "decidim-dev", "spec", "support", "city.jpeg"), "image/jpeg")
|
37
|
+
"homepage_image" => Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__), "..", "..", "..", "decidim-dev", "spec", "support", "city.jpeg"), "image/jpeg"),
|
38
|
+
"show_statics" => false
|
37
39
|
}
|
38
40
|
}
|
39
41
|
end
|
@@ -44,7 +46,11 @@ module Decidim
|
|
44
46
|
}
|
45
47
|
end
|
46
48
|
|
47
|
-
subject
|
49
|
+
subject do
|
50
|
+
described_class.from_params(attributes).with_context(
|
51
|
+
context
|
52
|
+
)
|
53
|
+
end
|
48
54
|
|
49
55
|
context "when everything is OK" do
|
50
56
|
it { is_expected.to be_valid }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
require "spec_helper"
|
3
4
|
|
@@ -54,7 +55,7 @@ module Decidim
|
|
54
55
|
}
|
55
56
|
end
|
56
57
|
|
57
|
-
subject { described_class.from_params(attributes
|
58
|
+
subject { described_class.from_params(attributes).with_context(current_organization: organization) }
|
58
59
|
|
59
60
|
context "when everything is OK" do
|
60
61
|
it { is_expected.to be_valid }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
require "spec_helper"
|
3
4
|
|
@@ -46,7 +47,7 @@ module Decidim
|
|
46
47
|
end
|
47
48
|
let(:organization) { build(:organization) }
|
48
49
|
|
49
|
-
subject { described_class.from_params(attributes
|
50
|
+
subject { described_class.from_params(attributes).with_context(current_organization: organization) }
|
50
51
|
|
51
52
|
describe "dates" do
|
52
53
|
context "when the dates are set" do
|
@@ -82,26 +83,6 @@ module Decidim
|
|
82
83
|
it { is_expected.to be_invalid }
|
83
84
|
end
|
84
85
|
|
85
|
-
context "when some language in description is missing" do
|
86
|
-
let(:description) do
|
87
|
-
{
|
88
|
-
ca: "Descripció"
|
89
|
-
}
|
90
|
-
end
|
91
|
-
|
92
|
-
it { is_expected.to be_invalid }
|
93
|
-
end
|
94
|
-
|
95
|
-
context "when some language in short_description is missing" do
|
96
|
-
let(:short_description) do
|
97
|
-
{
|
98
|
-
en: "Short description"
|
99
|
-
}
|
100
|
-
end
|
101
|
-
|
102
|
-
it { is_expected.to be_invalid }
|
103
|
-
end
|
104
|
-
|
105
86
|
context "when the start_date is later than end_date" do
|
106
87
|
let(:start_date) { 1.month.from_now }
|
107
88
|
let(:end_date) { 2.months.ago }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
require "spec_helper"
|
3
4
|
|
@@ -35,7 +36,7 @@ module Decidim
|
|
35
36
|
}
|
36
37
|
end
|
37
38
|
|
38
|
-
subject { described_class.from_params(attributes) }
|
39
|
+
subject { described_class.from_params(attributes).with_context(current_organization: organization) }
|
39
40
|
|
40
41
|
context "when everything is OK" do
|
41
42
|
it { is_expected.to be_valid }
|
@@ -68,12 +69,6 @@ module Decidim
|
|
68
69
|
it { is_expected.to be_invalid }
|
69
70
|
end
|
70
71
|
|
71
|
-
context "when organization is missing" do
|
72
|
-
let(:organization) { nil }
|
73
|
-
|
74
|
-
it { is_expected.to be_invalid }
|
75
|
-
end
|
76
|
-
|
77
72
|
context "when slug is not unique" do
|
78
73
|
before do
|
79
74
|
create(:static_page, organization: organization, slug: slug)
|
@@ -26,6 +26,15 @@ describe Decidim::Admin::Abilities::AdminUser do
|
|
26
26
|
it { is_expected.to be_able_to(:new, Decidim::StaticPage) }
|
27
27
|
it { is_expected.to be_able_to(:read, Decidim::StaticPage) }
|
28
28
|
|
29
|
+
it { is_expected.to be_able_to(:create, Decidim::User) }
|
30
|
+
it { is_expected.to be_able_to(:index, Decidim::User) }
|
31
|
+
it { is_expected.to be_able_to(:new, Decidim::User) }
|
32
|
+
it { is_expected.to be_able_to(:read, Decidim::User) }
|
33
|
+
it { is_expected.to be_able_to(:invite, Decidim::User) }
|
34
|
+
|
35
|
+
it { is_expected.to be_able_to(:index, Decidim::UserGroup) }
|
36
|
+
it { is_expected.to be_able_to(:verify, Decidim::UserGroup) }
|
37
|
+
|
29
38
|
context "when a page is a default one" do
|
30
39
|
let(:page) { build(:static_page, :default) }
|
31
40
|
let(:form) { Decidim::Admin::StaticPageForm.new(slug: page.slug) }
|
@@ -59,4 +68,17 @@ describe Decidim::Admin::Abilities::AdminUser do
|
|
59
68
|
it { is_expected.not_to be_able_to(:update, organization) }
|
60
69
|
it { is_expected.not_to be_able_to(:read, organization) }
|
61
70
|
end
|
71
|
+
|
72
|
+
context "when destroying a user" do
|
73
|
+
context "when the user is themselves" do
|
74
|
+
let(:user_to_destroy) { user }
|
75
|
+
it { is_expected.not_to be_able_to(:destroy, user_to_destroy) }
|
76
|
+
end
|
77
|
+
|
78
|
+
context "when it is another user" do
|
79
|
+
let(:user_to_destroy) { build(:user) }
|
80
|
+
|
81
|
+
it { is_expected.to be_able_to(:destroy, user_to_destroy) }
|
82
|
+
end
|
83
|
+
end
|
62
84
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
# frozen_string_literal: true
|
2
3
|
RSpec.shared_examples "manage process attachments examples" do
|
3
4
|
let!(:attachment) do
|
@@ -42,7 +43,7 @@ RSpec.shared_examples "manage process attachments examples" do
|
|
42
43
|
ca: "Document Molt Important"
|
43
44
|
)
|
44
45
|
|
45
|
-
|
46
|
+
fill_in_i18n(
|
46
47
|
:participatory_process_attachment_description,
|
47
48
|
"#description-tabs",
|
48
49
|
en: "This document contains important information",
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
RSpec.shared_examples "manage process steps examples" do
|
3
4
|
let(:active) { false }
|
@@ -132,21 +133,7 @@ RSpec.shared_examples "manage process steps examples" do
|
|
132
133
|
end
|
133
134
|
|
134
135
|
within find("tr", text: translated(process_step.title)) do
|
135
|
-
expect(page).to
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context "deactivating a step" do
|
141
|
-
let(:active) { true }
|
142
|
-
|
143
|
-
it "deactivates a step" do
|
144
|
-
within find("tr", text: translated(process_step.title)) do
|
145
|
-
click_link "Deactivate"
|
146
|
-
end
|
147
|
-
|
148
|
-
within find("tr", text: translated(process_step.title)) do
|
149
|
-
expect(page).to have_content("Activate")
|
136
|
+
expect(page).to have_no_content("Activate")
|
150
137
|
end
|
151
138
|
end
|
152
139
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
ENV["ENGINE_NAME"] = File.dirname(File.dirname(__FILE__)).split("/").last
|
2
|
-
|
2
|
+
|
3
|
+
require "decidim/dev/test/base_spec_helper"
|
4
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
3
5
|
|
4
6
|
RSpec.configure do |config|
|
5
7
|
config.include ProcessesMenuLinksHelpers
|
data/decidim-api/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require "decidim/common_rake"
|
2
|
+
require "decidim/dev/common_rake"
|
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = "API engine for decidim"
|
13
13
|
s.description = "API engine for decidim"
|
14
14
|
|
15
|
-
s.files = Dir["{app,config,db,lib}/**/*", "LICENSE.txt", "Rakefile", "README.md"]
|
15
|
+
s.files = Dir["{app,config,db,lib,vendor}/**/*", "LICENSE.txt", "Rakefile", "README.md"]
|
16
16
|
|
17
17
|
s.add_dependency "rails", *Decidim.rails_version
|
18
|
-
s.add_dependency "graphql", "~> 1.
|
19
|
-
s.add_dependency "graphiql-rails", "~> 1.4.
|
18
|
+
s.add_dependency "graphql", "~> 1.4.1"
|
19
|
+
s.add_dependency "graphiql-rails", "~> 1.4.1"
|
20
20
|
s.add_dependency "rack-cors", "~> 0.4.0"
|
21
21
|
s.add_dependency "sprockets-es6", "~> 0.9.2"
|
22
22
|
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require "decidim/core/test/factories"
|
2
|
+
require "decidim/comments/test/factories"
|
data/decidim-comments/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require "decidim/common_rake"
|
2
|
+
require "decidim/dev/common_rake"
|
Binary file
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Comments
|
4
|
+
# A command with all the business logic to upvote a comment
|
5
|
+
class VoteComment < Rectify::Command
|
6
|
+
# Public: Initializes the command.
|
7
|
+
#
|
8
|
+
# comment - A comment
|
9
|
+
# author - A user
|
10
|
+
# options - An optional hash of options (default: { weight: 1 })
|
11
|
+
# * weight: The vote's weight. Valid values 1 and -1.
|
12
|
+
def initialize(comment, author, options = { weight: 1 })
|
13
|
+
@comment = comment
|
14
|
+
@author = author
|
15
|
+
@weight = options[:weight]
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the vote wasn't create
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
if @weight == 1
|
26
|
+
@comment.up_votes.create!(author: @author)
|
27
|
+
elsif @weight == -1
|
28
|
+
@comment.down_votes.create!(author: @author)
|
29
|
+
else
|
30
|
+
return broadcast(:invalid)
|
31
|
+
end
|
32
|
+
broadcast(:ok, @comment)
|
33
|
+
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique
|
34
|
+
broadcast(:invalid)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -2,20 +2,25 @@ import { PropTypes } from 'react';
|
|
2
2
|
|
3
3
|
import assetUrl from '../support/asset_url';
|
4
4
|
|
5
|
-
const Icon = ({ name }) => {
|
5
|
+
const Icon = ({ name, iconExtraClassName }) => {
|
6
6
|
if (navigator.userAgent.match(/PhantomJS/)) {
|
7
|
-
return <span>{name}</span>;
|
7
|
+
return <span className={`icon ${iconExtraClassName} ${name}`}>{name}</span>;
|
8
8
|
}
|
9
9
|
|
10
10
|
return (
|
11
|
-
<svg className={`icon
|
11
|
+
<svg className={`icon ${iconExtraClassName} ${name}`}>
|
12
12
|
<use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref={`${assetUrl('icons.svg')}#${name}`} />
|
13
13
|
</svg>
|
14
14
|
);
|
15
15
|
};
|
16
16
|
|
17
|
+
Icon.defaultProps = {
|
18
|
+
iconExtraClassName: 'icon--before'
|
19
|
+
};
|
20
|
+
|
17
21
|
Icon.propTypes = {
|
18
|
-
name: PropTypes.string.isRequired
|
22
|
+
name: PropTypes.string.isRequired,
|
23
|
+
iconExtraClassName: PropTypes.string.isRequired
|
19
24
|
};
|
20
25
|
|
21
26
|
export default Icon;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { shallow } from 'enzyme';
|
1
|
+
import { shallow, mount } from 'enzyme';
|
2
2
|
|
3
|
-
import Icon
|
3
|
+
import Icon from './icon.component';
|
4
4
|
|
5
5
|
describe("<Icon /", () => {
|
6
6
|
beforeEach(() => {
|
@@ -40,4 +40,14 @@ describe("<Icon /", () => {
|
|
40
40
|
const wrapper = shallow(<Icon name="icon-thumb-up" />);
|
41
41
|
expect(wrapper.find('span')).to.have.text('icon-thumb-up');
|
42
42
|
});
|
43
|
+
|
44
|
+
it("should have a default prop iconExtraClassName with value 'icon--before'", () => {
|
45
|
+
const wrapper = mount(<Icon name="icon-thumb-up" />);
|
46
|
+
expect(wrapper).to.have.prop('iconExtraClassName').equal('icon--before');
|
47
|
+
});
|
48
|
+
|
49
|
+
it("should render the svg with an extra class defined by iconExtraClassName", () => {
|
50
|
+
const wrapper = mount(<Icon name="icon-thumb-up" iconExtraClassName="icon--small" />);
|
51
|
+
expect(wrapper.find('.icon--small')).to.be.present();
|
52
|
+
});
|
43
53
|
});
|
@@ -4,13 +4,16 @@ import { graphql } from 'react-apollo';
|
|
4
4
|
import gql from 'graphql-tag';
|
5
5
|
import { I18n } from 'react-i18nify';
|
6
6
|
import uuid from 'uuid';
|
7
|
-
import moment from 'moment';
|
8
7
|
import classnames from 'classnames';
|
9
8
|
|
10
9
|
import Icon from '../application/icon.component';
|
11
10
|
|
12
11
|
import addCommentMutation from './add_comment_form.mutation.graphql';
|
12
|
+
import commentThreadFragment from './comment_thread.fragment.graphql'
|
13
|
+
import commentFragment from './comment.fragment.graphql';
|
13
14
|
import commentDataFragment from './comment_data.fragment.graphql';
|
15
|
+
import upVoteFragment from './up_vote.fragment.graphql';
|
16
|
+
import downVoteFragment from './down_vote.fragment.graphql';
|
14
17
|
|
15
18
|
/**
|
16
19
|
* Renders a form to create new comments.
|
@@ -37,13 +40,7 @@ export class AddCommentForm extends Component {
|
|
37
40
|
{this._renderOpinionButtons()}
|
38
41
|
<form onSubmit={(evt) => this._addComment(evt)}>
|
39
42
|
<label className="show-for-sr" htmlFor={`add-comment-${commentableType}-${commentableId}`}>{ I18n.t("components.add_comment_form.form.body.label") }</label>
|
40
|
-
|
41
|
-
ref={(textarea) => this.bodyTextArea = textarea}
|
42
|
-
id={`add-comment-${commentableType}-${commentableId}`}
|
43
|
-
rows="4"
|
44
|
-
placeholder={I18n.t("components.add_comment_form.form.body.placeholder")}
|
45
|
-
onChange={(evt) => this._checkCommentBody(evt.target.value)}
|
46
|
-
/>
|
43
|
+
{this._renderTextArea()}
|
47
44
|
<input
|
48
45
|
type="submit"
|
49
46
|
className={submitButtonClassName}
|
@@ -74,6 +71,30 @@ export class AddCommentForm extends Component {
|
|
74
71
|
return null;
|
75
72
|
}
|
76
73
|
|
74
|
+
/**
|
75
|
+
* Render the form heading based on showTitle prop
|
76
|
+
* @private
|
77
|
+
* @returns {Void|DOMElement} - The heading or an empty element
|
78
|
+
*/
|
79
|
+
_renderTextArea() {
|
80
|
+
const { commentableType, commentableId, autoFocus} = this.props;
|
81
|
+
|
82
|
+
let textAreaProps = {
|
83
|
+
ref: (textarea) => {this.bodyTextArea = textarea},
|
84
|
+
id: `add-comment-${commentableType}-${commentableId}`,
|
85
|
+
rows: "4",
|
86
|
+
placeholder: I18n.t("components.add_comment_form.form.body.placeholder"),
|
87
|
+
onChange: (evt) => this._checkCommentBody(evt.target.value)
|
88
|
+
};
|
89
|
+
if (autoFocus) {
|
90
|
+
textAreaProps.autoFocus = 'autoFocus';
|
91
|
+
}
|
92
|
+
|
93
|
+
return (
|
94
|
+
<textarea {...textAreaProps} />
|
95
|
+
);
|
96
|
+
}
|
97
|
+
|
77
98
|
/**
|
78
99
|
* Render opinion buttons or not based on the arguable prop
|
79
100
|
* @private
|
@@ -172,12 +193,17 @@ AddCommentForm.propTypes = {
|
|
172
193
|
showTitle: PropTypes.bool.isRequired,
|
173
194
|
submitButtonClassName: PropTypes.string.isRequired,
|
174
195
|
onCommentAdded: PropTypes.func,
|
175
|
-
arguable: PropTypes.bool
|
196
|
+
arguable: PropTypes.bool,
|
197
|
+
autoFocus: PropTypes.bool
|
176
198
|
};
|
177
199
|
|
178
200
|
const AddCommentFormWithMutation = graphql(gql`
|
179
201
|
${addCommentMutation}
|
202
|
+
${commentThreadFragment}
|
203
|
+
${commentFragment}
|
180
204
|
${commentDataFragment}
|
205
|
+
${upVoteFragment}
|
206
|
+
${downVoteFragment}
|
181
207
|
`, {
|
182
208
|
props: ({ ownProps, mutate }) => ({
|
183
209
|
addComment: ({ body, alignment }) => mutate({
|
@@ -192,7 +218,7 @@ const AddCommentFormWithMutation = graphql(gql`
|
|
192
218
|
addComment: {
|
193
219
|
__typename: 'Comment',
|
194
220
|
id: uuid(),
|
195
|
-
createdAt:
|
221
|
+
createdAt: new Date().toISOString(),
|
196
222
|
body,
|
197
223
|
alignment: alignment,
|
198
224
|
author: {
|
@@ -201,7 +227,12 @@ const AddCommentFormWithMutation = graphql(gql`
|
|
201
227
|
avatarUrl: ownProps.currentUser.avatarUrl
|
202
228
|
},
|
203
229
|
replies: [],
|
204
|
-
|
230
|
+
hasReplies: false,
|
231
|
+
canHaveReplies: false,
|
232
|
+
upVotes: 0,
|
233
|
+
upVoted: false,
|
234
|
+
downVotes: 0,
|
235
|
+
downVoted: false
|
205
236
|
}
|
206
237
|
},
|
207
238
|
updateQueries: {
|
@@ -216,6 +247,7 @@ const AddCommentFormWithMutation = graphql(gql`
|
|
216
247
|
if (comment.id === commentableId) {
|
217
248
|
return {
|
218
249
|
...comment,
|
250
|
+
hasReplies: true,
|
219
251
|
replies: [
|
220
252
|
...replies,
|
221
253
|
newComment
|