decidim 0.0.3 → 0.0.4
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/.github/ISSUE_TEMPLATE.md +23 -4
- data/.travis.yml +4 -1
- data/Gemfile.lock +56 -48
- data/Rakefile +1 -1
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +3 -0
- data/decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb +46 -0
- data/decidim-admin/app/commands/decidim/admin/update_organization.rb +17 -2
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +4 -2
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +3 -0
- data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +59 -0
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +20 -0
- data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +3 -1
- data/decidim-admin/app/forms/decidim/admin/organization_form.rb +10 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +8 -5
- data/decidim-admin/app/forms/decidim/admin/permission_form.rb +31 -0
- data/decidim-admin/app/forms/decidim/admin/permissions_form.rb +16 -0
- data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +1 -0
- data/decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb +1 -1
- data/decidim-admin/app/views/decidim/admin/attachments/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/attachments/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/categories/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/categories/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/dashboard/show.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/feature_permissions/edit.html.erb +27 -0
- data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +10 -0
- data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +34 -0
- data/decidim-admin/app/views/decidim/admin/organization/edit.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +17 -4
- data/decidim-admin/app/views/decidim/admin/participatory_processes/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/new.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/participatory_processes/show.html.erb +5 -2
- data/decidim-admin/app/views/decidim/admin/scopes/edit.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/scopes/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/scopes/new.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/static_pages/edit.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/static_pages/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/static_pages/new.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/static_pages/show.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/user_groups/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/users/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/users/new.html.erb +2 -2
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +1 -1
- data/decidim-admin/config/i18n-tasks.yml +4 -3
- data/decidim-admin/config/locales/ca.yml +20 -1
- data/decidim-admin/config/locales/en.yml +19 -0
- data/decidim-admin/config/locales/es.yml +19 -0
- data/decidim-admin/config/locales/eu.yml +5 -0
- data/decidim-admin/config/routes.rb +8 -1
- data/decidim-admin/db/seeds.rb +3 -1
- data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +19 -0
- data/decidim-admin/spec/commands/update_organization_spec.rb +20 -0
- data/decidim-admin/spec/features/admin_invite_spec.rb +5 -3
- data/decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb +44 -0
- data/decidim-admin/spec/features/admin_manages_features_spec.rb +38 -0
- data/decidim-admin/spec/features/admin_manages_participatory_process_admins_spec.rb +0 -2
- data/decidim-admin/spec/features/admin_manages_participatory_process_attachments_spec.rb +0 -2
- data/decidim-admin/spec/features/admin_manages_participatory_process_categories_spec.rb +0 -2
- data/decidim-admin/spec/features/admin_manages_participatory_process_steps_spec.rb +0 -2
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +0 -2
- data/decidim-admin/spec/features/admin_manages_user_groups_spec.rb +1 -3
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_admins_spec.rb +0 -2
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_attachments_spec.rb +0 -2
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_steps_spec.rb +0 -2
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_processes_spec.rb +0 -2
- data/decidim-admin/spec/features/process_admin_manages_participatory_process_categories_spec.rb +0 -2
- data/decidim-admin/spec/forms/organization_form_spec.rb +11 -2
- data/decidim-admin/spec/models/participatory_process_user_role_spec.rb +17 -0
- data/decidim-admin/spec/shared/manage_process_steps_examples.rb +3 -2
- data/decidim-budgets/app/assets/images/decidim/budgets/icon.svg +16 -4
- data/decidim-budgets/app/assets/javascripts/decidim/budgets/progressFixed.js.es6 +23 -0
- data/decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6 +1 -0
- data/decidim-budgets/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +1 -1
- data/decidim-budgets/app/commands/decidim/budgets/admin/create_project.rb +0 -1
- data/decidim-budgets/app/commands/decidim/budgets/admin/update_project.rb +0 -1
- data/decidim-budgets/app/controllers/decidim/budgets/admin/application_controller.rb +9 -0
- data/decidim-budgets/app/controllers/decidim/budgets/admin/attachments_controller.rb +29 -0
- data/decidim-budgets/app/controllers/decidim/budgets/line_items_controller.rb +2 -0
- data/decidim-budgets/app/controllers/decidim/budgets/orders_controller.rb +2 -0
- data/decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb +1 -2
- data/decidim-budgets/app/models/decidim/budgets/project.rb +1 -0
- data/decidim-budgets/app/services/decidim/budgets/project_search.rb +0 -1
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/_form.html.erb +0 -4
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/edit.html.erb +1 -1
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/index.html.erb +1 -0
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/new.html.erb +1 -1
- data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +2 -0
- data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +2 -2
- data/decidim-budgets/app/views/decidim/budgets/projects/_project_budget_button.html.erb +2 -2
- data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +3 -2
- data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +3 -7
- data/decidim-budgets/config/i18n-tasks.yml +1 -0
- data/decidim-budgets/config/locales/ca.yml +24 -5
- data/decidim-budgets/config/locales/en.yml +12 -3
- data/decidim-budgets/config/locales/es.yml +22 -3
- data/decidim-budgets/config/locales/eu.yml +5 -0
- data/decidim-budgets/db/migrate/20170207101750_remove_short_description_from_decidim_projects.rb +5 -0
- data/decidim-budgets/decidim-budgets.gemspec +1 -0
- data/decidim-budgets/lib/decidim/budgets/admin_engine.rb +4 -1
- data/decidim-budgets/lib/decidim/budgets/feature.rb +15 -4
- data/decidim-budgets/lib/decidim/budgets/test/factories.rb +2 -3
- data/decidim-budgets/spec/commands/create_project_spec.rb +0 -1
- data/decidim-budgets/spec/commands/update_project_spec.rb +0 -1
- data/decidim-budgets/spec/features/admin_manages_project_attachments_spec.rb +10 -0
- data/decidim-budgets/spec/features/admin_manages_projects_spec.rb +0 -2
- data/decidim-budgets/spec/features/orders_spec.rb +43 -5
- data/decidim-budgets/spec/features/process_admin_manages_project_attachments_spec.rb +12 -0
- data/decidim-budgets/spec/features/process_admin_manages_projects_spec.rb +0 -2
- data/decidim-budgets/spec/forms/project_form_spec.rb +0 -10
- data/decidim-budgets/spec/shared/manage_attachments_examples.rb +17 -0
- data/decidim-budgets/spec/shared/manage_projects_examples.rb +0 -7
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/commands/decidim/comments/create_comment.rb +10 -0
- data/decidim-comments/app/forms/decidim/comments/comment_form.rb +1 -1
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +33 -12
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +6 -0
- data/decidim-comments/app/frontend/comments/comment.component.jsx +7 -5
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +2 -2
- data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +5 -0
- data/decidim-comments/app/frontend/comments/comments.component.jsx +11 -0
- data/decidim-comments/app/frontend/comments/vote_button.component.jsx +5 -0
- data/decidim-comments/app/frontend/comments/vote_button_component.test.jsx +1 -1
- data/decidim-comments/app/frontend/entry.test.js +2 -0
- data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +31 -0
- data/decidim-comments/app/models/decidim/comments/comment.rb +6 -0
- data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +18 -0
- data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +18 -0
- data/decidim-comments/config/locales/ca.yml +17 -3
- data/decidim-comments/config/locales/en.yml +17 -3
- data/decidim-comments/config/locales/es.yml +17 -3
- data/decidim-comments/config/locales/eu.yml +5 -0
- data/decidim-comments/lib/decidim/comments.rb +1 -0
- data/decidim-comments/{app/helpers → lib}/decidim/comments/comments_helper.rb +0 -0
- data/decidim-comments/spec/commands/create_comment_spec.rb +68 -1
- data/decidim-comments/spec/features/comments_spec.rb +27 -20
- data/decidim-comments/spec/features/notifications_spec.rb +45 -0
- data/decidim-comments/spec/forms/comment_form_spec.rb +6 -0
- data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +36 -0
- data/decidim-comments/spec/models/comment_spec.rb +8 -0
- data/decidim-comments/spec/spec_helper.rb +0 -1
- data/decidim-comments/spec/types/mutation_type_spec.rb +8 -7
- data/decidim-dev/config/locales/ca.yml +5 -0
- data/decidim-dev/config/locales/es.yml +5 -0
- data/decidim-dev/config/locales/eu.yml +5 -0
- data/decidim-dev/decidim-dev.gemspec +2 -1
- data/decidim-dev/lib/decidim/dev.rb +2 -0
- data/decidim-dev/lib/decidim/dev/dummy_authorization_handler.rb +1 -0
- data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +4 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/action_mailer.rb +19 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +26 -3
- data/decidim-dev/lib/decidim/dev/test/rspec_support/translation_helpers.rb +1 -1
- data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/admin/meeting_closes/edit.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/edit.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/new.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +3 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +11 -1
- data/decidim-meetings/config/locales/ca.yml +3 -3
- data/decidim-meetings/config/locales/en.yml +1 -1
- data/decidim-meetings/config/locales/es.yml +1 -1
- data/decidim-meetings/config/locales/eu.yml +5 -0
- data/decidim-meetings/decidim-meetings.gemspec +1 -1
- data/decidim-meetings/lib/decidim/meetings/feature.rb +1 -0
- data/decidim-meetings/spec/features/admin_manages_meetings_attachments_spec.rb +0 -2
- data/decidim-meetings/spec/features/admin_manages_meetings_spec.rb +0 -2
- data/decidim-meetings/spec/features/process_admin_manages_meetings_attachments_spec.rb +0 -2
- data/decidim-meetings/spec/features/process_admin_manages_meetings_spec.rb +0 -2
- data/decidim-pages/app/assets/images/decidim/pages/icon.svg +1 -3
- data/decidim-pages/app/views/decidim/pages/admin/pages/edit.html.erb +1 -1
- data/decidim-pages/app/views/decidim/pages/application/show.html.erb +4 -1
- data/decidim-pages/config/locales/eu.yml +7 -0
- data/decidim-pages/lib/decidim/pages/feature.rb +1 -0
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +42 -5
- data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +3 -1
- data/decidim-proposals/app/helpers/decidim/proposals/proposal_votes_helper.rb +1 -1
- data/decidim-proposals/app/models/decidim/proposals/abilities/current_user.rb +22 -4
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +2 -2
- data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +25 -13
- data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/new.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +9 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +2 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +10 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +9 -9
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +2 -2
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +7 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.js.erb +6 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +22 -23
- data/decidim-proposals/config/i18n-tasks.yml +2 -0
- data/decidim-proposals/config/locales/ca.yml +23 -15
- data/decidim-proposals/config/locales/en.yml +12 -4
- data/decidim-proposals/config/locales/es.yml +12 -4
- data/decidim-proposals/config/locales/eu.yml +5 -0
- data/decidim-proposals/db/migrate/20170205082832_add_index_to_decidim_proposals_proposals_proposal_votes_count.rb +7 -0
- data/decidim-proposals/lib/decidim/proposals/feature.rb +10 -1
- data/decidim-proposals/lib/decidim/proposals/test/factories.rb +1 -1
- data/decidim-proposals/spec/commands/decidim/proposals/admin_create_proposal_spec.rb +0 -1
- data/decidim-proposals/spec/commands/decidim/proposals/create_proposal_spec.rb +0 -1
- data/decidim-proposals/spec/features/admin_manages_proposals_spec.rb +0 -2
- data/decidim-proposals/spec/features/process_admin_manages_proposals_spec.rb +0 -2
- data/decidim-proposals/spec/features/proposals_spec.rb +77 -0
- data/decidim-proposals/spec/features/vote_proposal_spec.rb +16 -1
- data/decidim-proposals/spec/forms/decidim/proposals/admin_proposal_form_spec.rb +0 -1
- data/decidim-proposals/spec/forms/decidim/proposals/proposal_form_spec.rb +0 -1
- data/decidim-proposals/spec/helpers/proposal_votes_helper_spec.rb +10 -0
- data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +56 -31
- data/decidim-proposals/spec/shared/create_proposal_examples.rb +2 -2
- data/decidim-results/app/views/decidim/results/admin/results/edit.html.erb +1 -1
- data/decidim-results/app/views/decidim/results/admin/results/new.html.erb +1 -1
- data/decidim-results/app/views/decidim/results/results/index.html.erb +3 -1
- data/decidim-results/app/views/decidim/results/results/show.html.erb +11 -1
- data/decidim-results/config/locales/ca.yml +2 -2
- data/decidim-results/config/locales/en.yml +1 -1
- data/decidim-results/config/locales/es.yml +1 -1
- data/decidim-results/config/locales/eu.yml +5 -0
- data/decidim-results/lib/decidim/results/feature.rb +1 -0
- data/decidim-results/spec/features/admin_manages_results_spec.rb +0 -2
- data/decidim-results/spec/features/process_admin_manages_results_spec.rb +0 -2
- data/decidim-system/app/assets/stylesheets/decidim/system/_foundation_and_overrides.scss +1 -1
- data/decidim-system/app/controllers/decidim/system/application_controller.rb +1 -0
- data/decidim-system/app/controllers/decidim/system/devise/sessions_controller.rb +1 -0
- data/decidim-system/app/views/decidim/system/admins/edit.html.erb +2 -2
- data/decidim-system/app/views/decidim/system/admins/index.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/admins/new.html.erb +2 -2
- data/decidim-system/app/views/decidim/system/admins/show.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/dashboard/show.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/devise/passwords/edit.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/devise/passwords/new.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/devise/sessions/new.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/organizations/edit.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/organizations/index.html.erb +1 -1
- data/decidim-system/app/views/decidim/system/organizations/new.html.erb +2 -2
- data/decidim-system/app/views/decidim/system/organizations/show.html.erb +1 -1
- data/decidim-system/config/locales/eu.yml +7 -0
- data/decidim-system/spec/features/organizations_spec.rb +1 -2
- data/lib/generators/decidim/install_generator.rb +9 -0
- data/lib/generators/decidim/templates/initializer.rb +1 -0
- data/package.json +6 -6
- data/yarn.lock +743 -738
- metadata +53 -25
- data/decidim-comments/spec/support/dummy.rb +0 -20
- data/decidim-proposals/app/views/decidim/proposals/proposals/_share.html.erb +0 -33
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency "date_validator", "~> 0.9"
|
19
19
|
s.add_dependency "searchlight", "~> 4.1.0"
|
20
20
|
s.add_dependency "kaminari", "~> 1.0.1"
|
21
|
-
s.add_dependency "geocoder", "~> 1.4.
|
21
|
+
s.add_dependency "geocoder", "~> 1.4.2"
|
22
22
|
s.add_dependency "httparty", "~> 0.14.0"
|
23
23
|
s.add_dependency "jquery-tmpl-rails", "~> 1.1.0"
|
24
24
|
|
@@ -22,6 +22,7 @@ Decidim.register_feature(:meetings) do |feature|
|
|
22
22
|
|
23
23
|
feature = Decidim::Feature.create!(
|
24
24
|
name: Decidim::Features::Namer.new(process.organization.available_locales, :meetings).i18n_name,
|
25
|
+
published_at: Time.current,
|
25
26
|
manifest_name: :meetings,
|
26
27
|
participatory_process: process
|
27
28
|
)
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
|
-
require_relative "../shared/admin_shared_context"
|
5
|
-
require_relative "../shared/manage_attachments_examples"
|
6
4
|
|
7
5
|
describe "Process admin manages meetings attachments", type: :feature do
|
8
6
|
include_context "admin"
|
@@ -1,3 +1 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
2
|
-
<path d="M0 0v8h7v-4h-4v-4h-3zm4 0v3h3l-3-3zm-3 2h1v1h-1v-1zm0 2h1v1h-1v-1zm0 2h4v1h-4v-1z" />
|
3
|
-
</svg>
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.02 36.02"><path d="M373,545.54a18,18,0,1,1,18-18A18,18,0,0,1,373,545.54Zm0-34a16,16,0,1,0,16,16A16,16,0,0,0,373,511.53Z" transform="translate(-354.99 -509.53)"/><path d="M377.73,536.41h-9.46a1,1,0,1,1,0-2h9.46A1,1,0,0,1,377.73,536.41Z" transform="translate(-354.99 -509.53)"/><path d="M375,525.54h-6.73a1,1,0,1,1,0-2H375A1,1,0,1,1,375,525.54Z" transform="translate(-354.99 -509.53)"/><path d="M375,535.41a1,1,0,0,1-1-1v-9.87a1,1,0,1,1,2,0v9.87A1,1,0,0,1,375,535.41Z" transform="translate(-354.99 -509.53)"/><path d="M373,523a3,3,0,1,1,3-3A3,3,0,0,1,373,523Zm0-4a1,1,0,1,0,1,1A1,1,0,0,0,373,519Z" transform="translate(-354.99 -509.53)"/><path d="M371,535.41a1,1,0,0,1-1-1v-9.87a1,1,0,1,1,2,0v9.87A1,1,0,0,1,371,535.41Z" transform="translate(-354.99 -509.53)"/></svg>
|
@@ -34,6 +34,7 @@ Decidim.register_feature(:pages) do |feature|
|
|
34
34
|
feature = Decidim::Feature.create!(
|
35
35
|
name: Decidim::Features::Namer.new(process.organization.available_locales, :pages).i18n_name,
|
36
36
|
manifest_name: :pages,
|
37
|
+
published_at: Time.current,
|
37
38
|
participatory_process: process
|
38
39
|
)
|
39
40
|
|
@@ -7,6 +7,8 @@ module Decidim
|
|
7
7
|
include FormFactory
|
8
8
|
include FilterResource
|
9
9
|
|
10
|
+
helper_method :order, :random_seed
|
11
|
+
|
10
12
|
before_action :authenticate_user!, only: [:new, :create]
|
11
13
|
|
12
14
|
def show
|
@@ -17,11 +19,20 @@ module Decidim
|
|
17
19
|
@proposals = search
|
18
20
|
.results
|
19
21
|
.includes(:author)
|
20
|
-
.includes(
|
21
|
-
.
|
22
|
-
|
22
|
+
.includes(:category)
|
23
|
+
.includes(:scope)
|
24
|
+
|
25
|
+
@proposals = @proposals.page(params[:page]).per(12)
|
26
|
+
@proposals = reorder(@proposals)
|
23
27
|
|
24
|
-
@
|
28
|
+
@voted_proposals = if current_user
|
29
|
+
ProposalVote.where(
|
30
|
+
author: current_user,
|
31
|
+
proposal: @proposals
|
32
|
+
).pluck(:decidim_proposal_id)
|
33
|
+
else
|
34
|
+
[]
|
35
|
+
end
|
25
36
|
end
|
26
37
|
|
27
38
|
def new
|
@@ -50,6 +61,31 @@ module Decidim
|
|
50
61
|
|
51
62
|
private
|
52
63
|
|
64
|
+
def order
|
65
|
+
@order = params[:order] || "random"
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns: A random float number between -1 and 1 to be used as a random seed at the database.
|
69
|
+
def random_seed
|
70
|
+
@random_seed ||= (params[:random_seed] ? params[:random_seed].to_f : (rand * 2 - 1))
|
71
|
+
end
|
72
|
+
|
73
|
+
def reorder(proposals)
|
74
|
+
case order
|
75
|
+
when "random"
|
76
|
+
Proposal.transaction do
|
77
|
+
Proposal.connection.execute("SELECT setseed(#{Proposal.connection.quote(random_seed)})")
|
78
|
+
proposals.order("RANDOM()").load
|
79
|
+
end
|
80
|
+
when "most_voted"
|
81
|
+
proposals.order(proposal_votes_count: :desc)
|
82
|
+
when "recent"
|
83
|
+
proposals.order(created_at: :desc)
|
84
|
+
else
|
85
|
+
proposals
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
53
89
|
def search_klass
|
54
90
|
ProposalSearch
|
55
91
|
end
|
@@ -61,7 +97,8 @@ module Decidim
|
|
61
97
|
activity: "",
|
62
98
|
category_id: "",
|
63
99
|
state: "all",
|
64
|
-
|
100
|
+
scope_id: "",
|
101
|
+
related_to: ""
|
65
102
|
}
|
66
103
|
end
|
67
104
|
end
|
@@ -11,7 +11,9 @@ module Decidim
|
|
11
11
|
attribute :scope_id, Integer
|
12
12
|
attribute :user_group_id, Integer
|
13
13
|
|
14
|
-
validates :title, :body, presence: true
|
14
|
+
validates :title, :body, presence: true, etiquette: true
|
15
|
+
validates :title, length: { maximum: 150 }
|
16
|
+
validates :body, length: { maximum: 500 }, etiquette: true
|
15
17
|
validates :category, presence: true, if: ->(form) { form.category_id.present? }
|
16
18
|
validates :scope, presence: true, if: ->(form) { form.scope_id.present? }
|
17
19
|
|
@@ -27,7 +27,7 @@ module Decidim
|
|
27
27
|
#
|
28
28
|
# Returns true if the vote limit is enabled
|
29
29
|
def vote_limit_enabled?
|
30
|
-
current_user && feature_settings.vote_limit.present? && feature_settings.vote_limit.positive?
|
30
|
+
current_user && current_settings.votes_enabled? && feature_settings.vote_limit.present? && feature_settings.vote_limit.positive?
|
31
31
|
end
|
32
32
|
|
33
33
|
# Return the remaining votes for a user if the current feature has a vote limit
|
@@ -16,27 +16,38 @@ module Decidim
|
|
16
16
|
@context = context
|
17
17
|
|
18
18
|
can :vote, Proposal do |_proposal|
|
19
|
-
voting_enabled? && remaining_votes.positive?
|
19
|
+
authorized?(:vote) && voting_enabled? && remaining_votes.positive?
|
20
20
|
end
|
21
21
|
|
22
22
|
can :unvote, Proposal do |_proposal|
|
23
|
-
voting_enabled? && vote_limit_enabled?
|
23
|
+
authorized?(:vote) && voting_enabled? && vote_limit_enabled?
|
24
24
|
end
|
25
25
|
|
26
|
-
can :create, Proposal if
|
26
|
+
can :create, Proposal if authorized?(:create) && creation_enabled?
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
+
def authorized?(action)
|
32
|
+
return unless feature
|
33
|
+
|
34
|
+
ActionAuthorizer.new(user, feature, action).authorize.ok?
|
35
|
+
end
|
36
|
+
|
31
37
|
def vote_limit_enabled?
|
32
38
|
return unless feature_settings
|
33
39
|
feature_settings.vote_limit.present? && feature_settings.vote_limit.positive?
|
34
40
|
end
|
35
41
|
|
42
|
+
def creation_enabled?
|
43
|
+
return unless current_settings
|
44
|
+
current_settings.creation_enabled?
|
45
|
+
end
|
46
|
+
|
36
47
|
def remaining_votes
|
37
48
|
return 1 unless vote_limit_enabled?
|
38
49
|
|
39
|
-
proposals = Proposal.where(feature:
|
50
|
+
proposals = Proposal.where(feature: feature)
|
40
51
|
votes_count = ProposalVote.where(author: user, proposal: proposals).size
|
41
52
|
feature_settings.vote_limit - votes_count
|
42
53
|
end
|
@@ -53,6 +64,13 @@ module Decidim
|
|
53
64
|
def feature_settings
|
54
65
|
context.fetch(:feature_settings, nil)
|
55
66
|
end
|
67
|
+
|
68
|
+
def feature
|
69
|
+
feature = context.fetch(:current_feature, nil)
|
70
|
+
return nil unless feature && feature.manifest.name == :proposals
|
71
|
+
|
72
|
+
feature
|
73
|
+
end
|
56
74
|
end
|
57
75
|
end
|
58
76
|
end
|
@@ -11,7 +11,7 @@ module Decidim
|
|
11
11
|
|
12
12
|
feature_manifest_name "proposals"
|
13
13
|
|
14
|
-
has_many :votes, foreign_key: "decidim_proposal_id", class_name: ProposalVote, dependent: :destroy
|
14
|
+
has_many :votes, foreign_key: "decidim_proposal_id", class_name: ProposalVote, dependent: :destroy, counter_cache: "proposal_votes_count"
|
15
15
|
|
16
16
|
validates :title, :body, presence: true
|
17
17
|
|
@@ -30,7 +30,7 @@ module Decidim
|
|
30
30
|
#
|
31
31
|
# Returns Boolean.
|
32
32
|
def voted_by?(user)
|
33
|
-
votes.
|
33
|
+
votes.where(author: user).any?
|
34
34
|
end
|
35
35
|
|
36
36
|
# Public: Checks if the organization has given an answer for the proposal.
|
@@ -8,10 +8,8 @@ module Decidim
|
|
8
8
|
# feature - A Decidim::Feature to get the proposals from.
|
9
9
|
# page - The page number to paginate the results.
|
10
10
|
# per_page - The number of proposals to return per page.
|
11
|
-
# random_seed - A random flaot number between -1 and 1 to be used as a random seed at the database.
|
12
11
|
def initialize(options = {})
|
13
12
|
super(Proposal.all, options)
|
14
|
-
@random_seed = options[:random_seed].to_f
|
15
13
|
end
|
16
14
|
|
17
15
|
# Handle the search_text filter
|
@@ -46,6 +44,11 @@ module Decidim
|
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
47
|
+
# Handle the scope_id filter
|
48
|
+
def search_scope_id
|
49
|
+
query.where(decidim_scope_id: scope_id)
|
50
|
+
end
|
51
|
+
|
49
52
|
# Handle the state filter
|
50
53
|
def search_state
|
51
54
|
if state == "accepted"
|
@@ -57,18 +60,27 @@ module Decidim
|
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
60
|
-
#
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
# Filters Proposals by the name of the classes they are linked to. By default,
|
64
|
+
# returns all Proposals. When a `related_to` param is given, then it camelcases item
|
65
|
+
# to find the real class name and checks the links for the Proposals.
|
66
|
+
#
|
67
|
+
# The `related_to` param is expected to be in this form:
|
68
|
+
#
|
69
|
+
# "decidim/meetings/meeting"
|
70
|
+
#
|
71
|
+
# This can be achieved by performing `klass.name.underscore`.
|
72
|
+
#
|
73
|
+
# Returns only those proposals that are linked to the given class name.
|
74
|
+
def search_related_to
|
75
|
+
from = query
|
76
|
+
.joins(:resource_links_from)
|
77
|
+
.where(decidim_resource_links: { to_type: related_to.camelcase })
|
78
|
+
|
79
|
+
to = query
|
80
|
+
.joins(:resource_links_to)
|
81
|
+
.where(decidim_resource_links: { from_type: related_to.camelcase })
|
67
82
|
|
68
|
-
|
69
|
-
def random_seed
|
70
|
-
@random_seed = (rand * 2 - 1) if @random_seed == 0.0 || @random_seed > 1 || @random_seed < -1
|
71
|
-
@random_seed
|
83
|
+
query.where(id: from).or(query.where(id: to))
|
72
84
|
end
|
73
85
|
end
|
74
86
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h3><%= t ".title", title: proposal.title %></h3>
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= decidim_form_for(@form, url: proposal_proposal_answer_path(proposal, @form)) do |f| %>
|
4
4
|
<div class="field">
|
5
5
|
<%= f.collection_radio_buttons :state, [["accepted", t('.accepted')], ["rejected", t('.rejected')]], :first, :last, prompt: true %>
|
6
6
|
</div>
|
@@ -16,13 +16,21 @@
|
|
16
16
|
|
17
17
|
<%= form.collection_radio_buttons :state, [["all", t('.all')], ["accepted", t('.accepted')], ["rejected", t('.rejected')]], :first, :last, legend_title: t('.state') %>
|
18
18
|
|
19
|
+
<% if linked_classes_for(Decidim::Proposals::Proposal).any? %>
|
20
|
+
<%= form.collection_radio_buttons :related_to, linked_classes_filter_values_for(Decidim::Proposals::Proposal), :first, :last, legend_title: t('.related_to') %>
|
21
|
+
<% end %>
|
22
|
+
|
19
23
|
<% if current_user && current_settings.votes_enabled? %>
|
20
24
|
<%= form.collection_check_boxes :activity, [["voted", t('.voted')]], :first, :last, legend_title: t('.activity') %>
|
21
25
|
<% end %>
|
22
26
|
|
27
|
+
<% if current_organization.scopes.any? %>
|
28
|
+
<%= form.collection_check_boxes :scope_id, current_organization.scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t('.scopes') %>
|
29
|
+
<% end %>
|
30
|
+
|
23
31
|
<% if current_feature.categories.any? %>
|
24
32
|
<%= form.categories_select :category_id, current_feature.categories, legend_title: t('.category'), disable_parents: false, label: false, include_blank: true %>
|
25
33
|
<% end %>
|
26
34
|
|
27
|
-
<%=
|
35
|
+
<%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
|
28
36
|
<% end %>
|
@@ -19,11 +19,7 @@
|
|
19
19
|
</div>
|
20
20
|
<%= render partial: "proposal_badge", locals: { proposal: proposal } %>
|
21
21
|
<p><%= truncate(proposal.body, length: 100) %></p>
|
22
|
-
|
23
|
-
<ul class="tags tags--proposal">
|
24
|
-
<li><a href=""><%= translated_attribute(proposal.category.name) %></a></li>
|
25
|
-
</ul>
|
26
|
-
<% end %>
|
22
|
+
<%= render partial: "tags", locals: { proposal: proposal } %>
|
27
23
|
</div>
|
28
24
|
<div class="card__footer">
|
29
25
|
<div class="card__support">
|
@@ -31,7 +27,7 @@
|
|
31
27
|
<div id="proposal-<%= proposal.id %>-votes-count" class="card__support__data">
|
32
28
|
<%= render partial: "votes_count", locals: { proposal: proposal, from_proposals_list: true } %>
|
33
29
|
</div>
|
34
|
-
<div id="proposal-<%= proposal.id %>-vote-button">
|
30
|
+
<div id="proposal-<%= proposal.id %>-vote-button">
|
35
31
|
<%= render partial: "vote_button", locals: { proposal: proposal, from_proposals_list: true } %>
|
36
32
|
</div>
|
37
33
|
<% elsif !current_settings.votes_enabled? || current_settings.votes_enabled? && current_settings.votes_blocked? %>
|
@@ -1,4 +1,5 @@
|
|
1
|
+
<%= order_selector [:random, :most_voted, :recent], i18n_scope: "decidim.proposals.proposals.orders" %>
|
1
2
|
<div class="row small-up-1 medium-up-2 card-grid">
|
2
3
|
<%= render @proposals %>
|
3
4
|
</div>
|
4
|
-
<%= decidim_paginate @proposals, random_seed:
|
5
|
+
<%= decidim_paginate @proposals, random_seed: random_seed %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if proposal.category.present? || proposal.scope.present? %>
|
2
|
+
<ul class="tags tags--proposal" >
|
3
|
+
<% if proposal.category.present? %>
|
4
|
+
<li><%= link_to translated_attribute(proposal.category.name), decidim_proposals.proposals_path(filter: { category_id: proposal.category.id }) %></li>
|
5
|
+
<% end %>
|
6
|
+
<% if proposal.scope.present? %>
|
7
|
+
<li><%= link_to proposal.scope.name, decidim_proposals.proposals_path(filter: { scope_id: [proposal.scope.id] }) %></li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
<% end %>
|
@@ -1,7 +1,11 @@
|
|
1
|
-
<% if current_user %>
|
2
|
-
|
1
|
+
<% if !current_user %>
|
2
|
+
<button class="card__button button <%= vote_button_classes(from_proposals_list) %>" data-toggle="loginModal">
|
3
|
+
<%= t('.vote') %>
|
4
|
+
</button>
|
5
|
+
<% else %>
|
6
|
+
<% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
|
3
7
|
<% if vote_limit_enabled? %>
|
4
|
-
<%=
|
8
|
+
<%= action_authorized_button_to :vote, t('.already_voted'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), method: :delete, remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)} success" %>
|
5
9
|
<% else %>
|
6
10
|
<button class="card__button button <%= vote_button_classes(from_proposals_list) %> success">
|
7
11
|
<%= t('.already_voted') %>
|
@@ -9,17 +13,13 @@
|
|
9
13
|
<% end %>
|
10
14
|
<% else %>
|
11
15
|
<% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
|
12
|
-
<%=
|
16
|
+
<%= action_authorized_button_to :vote, t('.no_votes_remaining'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)}", disabled: true %>
|
13
17
|
<% elsif current_settings.votes_blocked? %>
|
14
18
|
<button class="card__button button <%= vote_button_classes(from_proposals_list) %> disabled">
|
15
19
|
<%= t('.votes_blocked') %>
|
16
20
|
</button>
|
17
21
|
<% else %>
|
18
|
-
<%=
|
22
|
+
<%= action_authorized_button_to "vote", t('.vote'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)}" %>
|
19
23
|
<% end %>
|
20
24
|
<% end %>
|
21
|
-
<% else %>
|
22
|
-
<button class="card__button button <%= vote_button_classes(from_proposals_list) %>" data-toggle="loginModal">
|
23
|
-
<%= t('.vote') %>
|
24
|
-
</button>
|
25
25
|
<% end %>
|