decidim 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.eslintrc.json +2 -5
- data/.mention-bot +2 -1
- data/.yardopts +8 -0
- data/Gemfile.lock +64 -62
- data/README.md +11 -9
- data/decidim-admin/app/assets/javascripts/decidim/admin/sort_steps.js.es6 +3 -3
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_email_preview.scss +5 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/application.scss +1 -0
- data/decidim-admin/app/commands/decidim/admin/create_newsletter.rb +30 -0
- data/decidim-admin/app/commands/decidim/admin/deliver_newsletter.rb +29 -0
- data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +9 -0
- data/decidim-admin/app/commands/decidim/admin/update_newsletter.rb +33 -0
- data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +115 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +4 -4
- data/decidim-admin/app/forms/decidim/admin/newsletter_form.rb +15 -0
- data/decidim-admin/app/jobs/decidim/admin/newsletter_delivery_job.rb +18 -0
- data/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +32 -0
- data/decidim-admin/app/models/decidim/admin/abilities/admin_user.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/abilities/base.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/abilities/collaborator_user.rb +19 -0
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_admin.rb +1 -1
- data/decidim-admin/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +1 -1
- data/decidim-admin/app/views/decidim/admin/newsletters/_form.html.erb +5 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/edit.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/index.html.erb +47 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/new.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/show.html.erb +14 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
- data/decidim-admin/app/views/layouts/decidim/admin/_sidebar.html.erb +1 -0
- data/decidim-admin/config/locales/ca.yml +40 -0
- data/decidim-admin/config/locales/en.yml +40 -0
- data/decidim-admin/config/locales/es.yml +40 -0
- data/decidim-admin/config/routes.rb +7 -0
- data/decidim-admin/decidim-admin.gemspec +0 -1
- data/decidim-admin/lib/decidim/admin/engine.rb +1 -0
- data/decidim-admin/lib/decidim/admin/features/base_controller.rb +5 -1
- data/decidim-admin/spec/commands/create_newsletter_spec.rb +62 -0
- data/decidim-admin/spec/commands/deliver_newsletter_spec.rb +45 -0
- data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +12 -0
- data/decidim-admin/spec/commands/update_newsletter_spec.rb +64 -0
- data/decidim-admin/spec/features/admin_manages_newsletters_spec.rb +147 -0
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +1 -5
- data/decidim-admin/spec/features/static_pages_spec.rb +16 -0
- data/decidim-admin/spec/forms/newsletter_form_spec.rb +47 -0
- data/decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb +25 -0
- data/decidim-admin/spec/jobs/newsletter_job_spec.rb +29 -0
- data/decidim-admin/spec/models/abilities/collaborator_user_spec.rb +66 -0
- data/decidim-admin/spec/organization_dashboard_constraint_spec.rb +55 -0
- data/decidim-admin/spec/queries/manageable_participatory_processes_for_user_spec.rb +8 -0
- data/decidim-admin/spec/shared/manage_processes_examples.rb +1 -5
- data/decidim-api/lib/decidim/api.rb +2 -7
- data/decidim-api/lib/decidim/api/{types/mutation.rb → mutation_type.rb} +0 -0
- data/decidim-api/lib/decidim/api/{types/query.rb → query_type.rb} +0 -0
- data/decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6 +4 -4
- data/decidim-budgets/app/commands/decidim/budgets/add_line_item.rb +4 -2
- data/decidim-budgets/app/commands/decidim/budgets/checkout.rb +7 -3
- data/decidim-budgets/app/models/decidim/budgets/order.rb +16 -1
- data/decidim-budgets/app/models/decidim/budgets/project.rb +16 -0
- data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +7 -7
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_confirm.html.erb +27 -25
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_summary.html.erb +4 -13
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_progress.html.erb +23 -21
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +25 -23
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_total_budget.html.erb +3 -1
- data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +32 -30
- data/decidim-budgets/app/views/decidim/budgets/projects/_projects.html.erb +1 -3
- data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +0 -4
- data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +5 -6
- data/decidim-budgets/config/i18n-tasks.yml +1 -0
- data/decidim-budgets/config/locales/ca.yml +7 -2
- data/decidim-budgets/config/locales/en.yml +17 -6
- data/decidim-budgets/config/locales/es.yml +7 -2
- data/decidim-budgets/lib/decidim/budgets/feature.rb +2 -2
- data/decidim-budgets/spec/commands/add_line_item_spec.rb +16 -3
- data/decidim-budgets/spec/commands/cancel_order_spec.rb +7 -1
- data/decidim-budgets/spec/commands/checkout_spec.rb +9 -2
- data/decidim-budgets/spec/commands/remove_line_item_spec.rb +16 -5
- data/decidim-budgets/spec/features/orders_spec.rb +8 -2
- data/decidim-budgets/spec/models/order_spec.rb +31 -2
- data/decidim-budgets/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-comments/README.md +1 -1
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +156 -93
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +36 -23
- data/decidim-comments/app/frontend/comments/add_comment_form.mutation.graphql +5 -3
- data/decidim-comments/app/frontend/comments/add_comment_form_commentable.fragment.graphql +4 -0
- data/decidim-comments/app/frontend/comments/add_comment_form_session.fragment.graphql +6 -0
- data/decidim-comments/app/frontend/comments/comment.component.jsx +11 -13
- data/decidim-comments/app/frontend/comments/comment.component.test.jsx +22 -21
- data/decidim-comments/app/frontend/comments/comment.fragment.graphql +4 -4
- data/decidim-comments/app/frontend/comments/comment_data.fragment.graphql +4 -3
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +1 -1
- data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +3 -3
- data/decidim-comments/app/frontend/comments/comment_thread.component.test.jsx +3 -3
- data/decidim-comments/app/frontend/comments/comment_thread.fragment.graphql +1 -1
- data/decidim-comments/app/frontend/comments/comments.component.jsx +47 -39
- data/decidim-comments/app/frontend/comments/comments.component.test.jsx +51 -38
- data/decidim-comments/app/frontend/comments/comments.query.graphql +10 -4
- data/decidim-comments/app/frontend/comments/down_vote_button.component.jsx +6 -3
- data/decidim-comments/app/frontend/comments/up_vote_button.component.jsx +7 -4
- data/decidim-comments/app/frontend/support/generate_comments_data.js +4 -4
- data/decidim-comments/app/models/decidim/comments/comment.rb +7 -9
- data/decidim-comments/app/queries/decidim/comments/{comments_with_replies.rb → sorted_comments.rb} +3 -8
- data/decidim-comments/app/types/decidim/comments/commentable_interface.rb +44 -0
- data/decidim-comments/app/types/decidim/comments/commentable_mutation_type.rb +29 -0
- data/decidim-comments/app/types/decidim/comments/commentable_type.rb +14 -0
- data/decidim-comments/config/locales/ca.yml +3 -1
- data/decidim-comments/config/locales/en.yml +5 -2
- data/decidim-comments/config/locales/es.yml +3 -1
- data/decidim-comments/lib/decidim/comments.rb +4 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/add_comment_type.rb +0 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/comment_mutation_type.rb +0 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/comment_type.rb +11 -17
- data/decidim-comments/lib/decidim/comments/commentable.rb +45 -0
- data/decidim-comments/lib/decidim/comments/comments_helper.rb +15 -10
- data/decidim-comments/lib/decidim/comments/mutation_extensions.rb +8 -16
- data/decidim-comments/lib/decidim/comments/query_extensions.rb +5 -8
- data/decidim-comments/lib/decidim/comments/test/factories.rb +3 -3
- data/decidim-comments/spec/commands/vote_comment_spec.rb +3 -1
- data/decidim-comments/spec/features/comments_spec.rb +28 -14
- data/decidim-comments/spec/features/notifications_spec.rb +1 -1
- data/decidim-comments/spec/helpers/comments_helper_spec.rb +4 -27
- data/decidim-comments/spec/models/comment_spec.rb +7 -11
- data/decidim-comments/spec/models/comment_vote_spec.rb +3 -1
- data/decidim-comments/spec/models/seed_spec.rb +3 -4
- data/decidim-comments/spec/queries/{comments_with_replies_spec.rb → sorted_comments_spec.rb} +12 -29
- data/decidim-comments/spec/types/comment_type_spec.rb +23 -17
- data/decidim-comments/spec/types/commentable_mutation_type_spec.rb +34 -0
- data/decidim-comments/spec/types/commentable_type_spec.rb +48 -0
- data/decidim-comments/spec/types/mutation_type_spec.rb +5 -22
- data/decidim-comments/spec/types/query_type_spec.rb +0 -24
- data/decidim-dev/config/i18n-tasks.yml +4 -0
- data/decidim-dev/decidim-dev.gemspec +1 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/action_mailer.rb +10 -4
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +6 -5
- data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +0 -1
- data/decidim-meetings/app/assets/javascripts/decidim/meetings/map.js.es6.erb +8 -3
- data/decidim-meetings/app/assets/stylesheets/decidim/meetings/map.css +3 -1
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -2
- data/decidim-meetings/app/forms/decidim/meetings/admin/close_meeting_form.rb +2 -1
- data/decidim-meetings/app/helpers/decidim/meetings/map_helper.rb +1 -0
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +7 -3
- data/decidim-meetings/app/views/decidim/meetings/meetings/_datetime.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +5 -5
- data/decidim-meetings/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +1 -5
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +16 -9
- data/decidim-meetings/config/locales/ca.yml +2 -3
- data/decidim-meetings/config/locales/en.yml +2 -3
- data/decidim-meetings/config/locales/es.yml +2 -3
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +75 -24
- data/decidim-meetings/spec/forms/close_meeting_form_spec.rb +1 -1
- data/decidim-meetings/spec/services/meeting_search_spec.rb +15 -12
- data/decidim-meetings/vendor/assets/javascripts/leaflet.markercluster.js +7 -0
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.css +14 -0
- data/decidim-pages/app/models/decidim/pages/page.rb +22 -0
- data/decidim-pages/app/views/decidim/pages/application/show.html.erb +2 -6
- data/decidim-pages/config/locales/ca.yml +2 -2
- data/decidim-pages/config/locales/en.yml +2 -2
- data/decidim-pages/config/locales/es.yml +2 -2
- data/decidim-pages/lib/decidim/pages/feature.rb +2 -2
- data/decidim-pages/spec/features/page_show_spec.rb +0 -33
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +2 -0
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/admin_user.rb +45 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/process_admin_user.rb +57 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +21 -0
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +16 -10
- data/decidim-proposals/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +4 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +7 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +3 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +23 -21
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +9 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_limit.html.erb +1 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +0 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +2 -6
- data/decidim-proposals/config/locales/ca.yml +8 -1
- data/decidim-proposals/config/locales/en.yml +8 -1
- data/decidim-proposals/config/locales/es.yml +8 -1
- data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +7 -0
- data/decidim-proposals/lib/decidim/proposals/feature.rb +6 -2
- data/decidim-proposals/spec/features/proposals_spec.rb +226 -40
- data/decidim-proposals/spec/models/decidim/proposals/abilities/admin_user_spec.rb +62 -0
- data/decidim-proposals/spec/models/decidim/proposals/abilities/process_admin_user_spec.rb +63 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +161 -50
- data/decidim-results/app/models/decidim/results/result.rb +21 -0
- data/decidim-results/app/views/decidim/results/results/index.html.erb +0 -4
- data/decidim-results/app/views/decidim/results/results/show.html.erb +2 -8
- data/decidim-results/config/i18n-tasks.yml +1 -0
- data/decidim-results/config/locales/ca.yml +5 -2
- data/decidim-results/config/locales/en.yml +5 -2
- data/decidim-results/config/locales/es.yml +5 -2
- data/decidim-results/lib/decidim/results/feature.rb +2 -2
- data/decidim-results/spec/services/result_stats_calculator_spec.rb +2 -2
- data/decidim-results/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-system/config/i18n-tasks.yml +1 -1
- data/package.json +50 -51
- data/yarn.lock +198 -151
- metadata +69 -36
- data/decidim-admin/spec/features/admin_access_control.rb +0 -52
- data/decidim-api/lib/decidim/api/types/author_interface.rb +0 -13
- data/decidim-api/lib/decidim/api/types/localized_string.rb +0 -13
- data/decidim-api/lib/decidim/api/types/translated_field.rb +0 -44
- data/decidim-api/spec/types/localized_string_type_spec.rb +0 -31
- data/decidim-api/spec/types/translated_field_type_spec.rb +0 -69
- data/decidim-comments/app/frontend/comments/add_comment_form.fragment.graphql +0 -6
@@ -15,6 +15,14 @@ describe Decidim::Admin::ManageableParticipatoryProcessesForUser do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
context "when the user is a collaborator" do
|
19
|
+
let(:user) { create :user, :collaborator }
|
20
|
+
|
21
|
+
it "returns only the organization processes" do
|
22
|
+
expect(subject.query).to eq [organization_process]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
18
26
|
context "when the user is not an admin" do
|
19
27
|
let(:user) { create :user }
|
20
28
|
let!(:organization_process2) { create :participatory_process, organization: user.organization }
|
@@ -75,12 +75,8 @@ RSpec.shared_examples "manage processes examples" do
|
|
75
75
|
expect(page).to have_content("successfully")
|
76
76
|
end
|
77
77
|
|
78
|
-
within "
|
78
|
+
within ".tabs-content" do
|
79
79
|
expect(page).to have_content("My new title")
|
80
|
-
click_link("My new title")
|
81
|
-
end
|
82
|
-
|
83
|
-
within "dl" do
|
84
80
|
expect(page).not_to have_css("img[src*='#{image2_filename}']")
|
85
81
|
expect(page).to have_css("img[src*='#{image3_filename}']")
|
86
82
|
end
|
@@ -5,13 +5,8 @@ module Decidim
|
|
5
5
|
# This module holds all business logic related to exposing a Public API for
|
6
6
|
# decidim.
|
7
7
|
module Api
|
8
|
-
autoload :MutationType, "decidim/api/
|
9
|
-
autoload :QueryType, "decidim/api/
|
10
|
-
autoload :AuthorInterface, "decidim/api/types/author_interface"
|
11
|
-
|
12
|
-
autoload :TranslatedFieldType, "decidim/api/types/translated_field"
|
13
|
-
autoload :LocalizedStringType, "decidim/api/types/localized_string"
|
14
|
-
|
8
|
+
autoload :MutationType, "decidim/api/mutation_type"
|
9
|
+
autoload :QueryType, "decidim/api/query_type"
|
15
10
|
autoload :Schema, "decidim/api/schema"
|
16
11
|
end
|
17
12
|
end
|
File without changes
|
File without changes
|
@@ -6,7 +6,7 @@ $(() => {
|
|
6
6
|
const $budgetSummaryTotal = $('.budget-summary__total');
|
7
7
|
const $budgetExceedModal = $('#budget-excess');
|
8
8
|
|
9
|
-
const totalBudget = $budgetSummaryTotal.
|
9
|
+
const totalBudget = parseInt($budgetSummaryTotal.attr('data-total-budget'), 10);
|
10
10
|
|
11
11
|
const cancelEvent = (event) => {
|
12
12
|
event.stopPropagation();
|
@@ -14,14 +14,14 @@ $(() => {
|
|
14
14
|
};
|
15
15
|
|
16
16
|
$projects.on('click', '.budget--list__action', (event) => {
|
17
|
-
const currentBudget = $('.budget-summary__progressbox').
|
17
|
+
const currentBudget = parseInt($('.budget-summary__progressbox').attr('data-current-budget'), 10);
|
18
18
|
const $currentTarget = $(event.currentTarget);
|
19
|
-
const projectBudget = $currentTarget.
|
19
|
+
const projectBudget = parseInt($currentTarget.attr('data-budget'), 10);
|
20
20
|
|
21
21
|
if ($currentTarget.attr('disabled')) {
|
22
22
|
cancelEvent(event);
|
23
23
|
|
24
|
-
} else if ($currentTarget.
|
24
|
+
} else if ($currentTarget.attr('data-add') && ((currentBudget + projectBudget) > totalBudget)) {
|
25
25
|
$budgetExceedModal.foundation('toggle');
|
26
26
|
cancelEvent(event);
|
27
27
|
}
|
@@ -19,15 +19,19 @@ module Decidim
|
|
19
19
|
#
|
20
20
|
# Returns nothing.
|
21
21
|
def call
|
22
|
-
return broadcast(:invalid) unless
|
23
|
-
checkout!
|
22
|
+
return broadcast(:invalid, @order) unless checkout!
|
24
23
|
broadcast(:ok, @order)
|
25
24
|
end
|
26
25
|
|
27
26
|
private
|
28
27
|
|
29
28
|
def checkout!
|
30
|
-
@order
|
29
|
+
return unless @order
|
30
|
+
|
31
|
+
@order.with_lock do
|
32
|
+
@order.checked_out_at = Time.current
|
33
|
+
@order.save
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -16,9 +16,17 @@ module Decidim
|
|
16
16
|
validates :user, presence: true, uniqueness: { scope: :feature }
|
17
17
|
validate :user_belongs_to_organization
|
18
18
|
|
19
|
+
validates :total_budget, numericality: {
|
20
|
+
greater_than_or_equal_to: :minimum_budget
|
21
|
+
}, if: :checked_out?
|
22
|
+
|
23
|
+
validates :total_budget, numericality: {
|
24
|
+
less_than_or_equal_to: :maximum_budget
|
25
|
+
}
|
26
|
+
|
19
27
|
# Public: Returns the sum of project budgets
|
20
28
|
def total_budget
|
21
|
-
|
29
|
+
projects.to_a.sum(&:budget)
|
22
30
|
end
|
23
31
|
|
24
32
|
# Public: Returns true if the order has been checked out
|
@@ -38,9 +46,16 @@ module Decidim
|
|
38
46
|
|
39
47
|
# Public: Returns the required minimum budget to checkout
|
40
48
|
def minimum_budget
|
49
|
+
return 0 unless feature
|
41
50
|
feature.settings.total_budget.to_f * (feature.settings.vote_threshold_percent.to_f / 100)
|
42
51
|
end
|
43
52
|
|
53
|
+
# Public: Returns the required maximum budget to checkout
|
54
|
+
def maximum_budget
|
55
|
+
return 0 unless feature
|
56
|
+
feature.settings.total_budget.to_f
|
57
|
+
end
|
58
|
+
|
44
59
|
private
|
45
60
|
|
46
61
|
def user_belongs_to_organization
|
@@ -9,8 +9,24 @@ module Decidim
|
|
9
9
|
include Decidim::HasScope
|
10
10
|
include Decidim::HasCategory
|
11
11
|
include Decidim::HasAttachments
|
12
|
+
include Decidim::Comments::Commentable
|
12
13
|
|
13
14
|
feature_manifest_name "budgets"
|
15
|
+
|
16
|
+
# Public: Overrides the `commentable?` Commentable concern method.
|
17
|
+
def commentable?
|
18
|
+
feature.settings.comments_enabled?
|
19
|
+
end
|
20
|
+
|
21
|
+
# Public: Overrides the `accepts_new_comments?` Commentable concern method.
|
22
|
+
def accepts_new_comments?
|
23
|
+
commentable? && !feature.active_step_settings.comments_blocked
|
24
|
+
end
|
25
|
+
|
26
|
+
# Public: Overrides the `comments_have_votes?` Commentable concern method.
|
27
|
+
def comments_have_votes?
|
28
|
+
true
|
29
|
+
end
|
14
30
|
end
|
15
31
|
end
|
16
32
|
end
|
@@ -5,19 +5,19 @@ var $projectItem = $('#project-<%= project.id %>-item');
|
|
5
5
|
var $projectBudgetButton = $('#project-<%= project.id %>-budget-button');
|
6
6
|
var $budgetConfirm = $('#budget-confirm');
|
7
7
|
|
8
|
-
$orderTotalBudget
|
9
|
-
$orderSelectedProjects
|
10
|
-
$orderProgress
|
11
|
-
$budgetConfirm
|
8
|
+
morphdom($orderTotalBudget[0], '<%= j(render partial: 'decidim/budgets/projects/order_total_budget') %>');
|
9
|
+
morphdom($orderSelectedProjects[0], '<%= j(render partial: 'decidim/budgets/projects/order_selected_projects') %>');
|
10
|
+
morphdom($orderProgress[0], '<%= j(render partial: 'decidim/budgets/projects/order_progress') %>');
|
11
|
+
morphdom($budgetConfirm[0], '<%= j(render partial: 'decidim/budgets/projects/budget_confirm') %>')
|
12
12
|
|
13
|
-
$(
|
13
|
+
$("#order-progress").foundation();
|
14
14
|
|
15
15
|
if ($projectItem.length > 0) {
|
16
|
-
$projectItem
|
16
|
+
morphdom($projectItem[0], '<%= j(render partial: 'decidim/budgets/projects/project', locals: { project: project }) %>');
|
17
17
|
}
|
18
18
|
|
19
19
|
if ($projectBudgetButton.length > 0) {
|
20
|
-
$projectBudgetButton
|
20
|
+
morphdom($projectBudgetButton[0], '<%= j(render partial: 'decidim/budgets/projects/project_budget_button', locals: { project: project }) %>');
|
21
21
|
}
|
22
22
|
|
23
23
|
window.DecidimBudgets.checkProgressPosition();
|
@@ -1,30 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
<div class="reveal" data-reveal id="budget-confirm">
|
2
|
+
<% if current_order.present? %>
|
3
|
+
<div class="reveal__header">
|
4
|
+
<h3 class="reveal__title"><%= t('.title') %></h3>
|
5
|
+
<button class="close-button" data-close aria-label="<%= t('.cancel') %>" type="button">
|
6
|
+
<span aria-hidden="true">×</span>
|
7
|
+
</button>
|
8
|
+
</div>
|
9
|
+
<p><%= t('.description') %></p>
|
10
|
+
<div class="card card--secondary">
|
11
|
+
<ul class="card__content">
|
12
|
+
<% current_order.projects.each do |project| %>
|
13
|
+
<li class="budget-summary__selected-item">
|
14
|
+
<%= link_to translated_attribute(project.title), project %>
|
15
|
+
<strong class="budget-summary__selected-number">
|
16
|
+
<%= budget_to_currency project.budget %>
|
17
|
+
</strong>
|
18
|
+
</li>
|
19
|
+
<% end %>
|
20
|
+
</ul>
|
21
|
+
</div>
|
22
|
+
<p class="text-center"><%= t('.are_you_sure') %></p>
|
22
23
|
<div class="row">
|
23
24
|
<div class="columns medium-8 medium-offset-2">
|
24
25
|
<%= button_to t('.confirm'), checkout_order_path, class: "button expanded" %>
|
25
26
|
</div>
|
26
27
|
</div>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<% end %>
|
28
|
+
<div class="text-center">
|
29
|
+
<button class="link" data-close><%= t('.cancel') %></button>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
@@ -20,27 +20,18 @@
|
|
20
20
|
</span>
|
21
21
|
</div>
|
22
22
|
|
23
|
-
|
24
|
-
<%= render partial: 'order_progress' %>
|
25
|
-
</div>
|
23
|
+
<%= render partial: 'order_progress' %>
|
26
24
|
|
27
25
|
<div>
|
28
26
|
<span class="mini-title">
|
29
27
|
<%= t('.assigned') %>
|
30
|
-
|
31
|
-
<%= render partial: 'order_total_budget' %>
|
32
|
-
</strong>
|
28
|
+
<%= render partial: 'order_total_budget' %>
|
33
29
|
</span>
|
34
30
|
</div>
|
35
31
|
</div>
|
36
32
|
|
37
|
-
|
38
|
-
<%= render partial: 'order_selected_projects' %>
|
39
|
-
</div>
|
33
|
+
<%= render partial: 'order_selected_projects' %>
|
40
34
|
</div>
|
41
35
|
|
42
36
|
<%= render partial: "budget_excess" %>
|
43
|
-
|
44
|
-
<div class="reveal" data-reveal id="budget-confirm">
|
45
|
-
<%= render partial: "budget_confirm" %>
|
46
|
-
</div>
|
37
|
+
<%= render partial: "budget_confirm" %>
|
@@ -1,24 +1,8 @@
|
|
1
|
-
<div
|
2
|
-
<div class="
|
3
|
-
<div class="progress-
|
4
|
-
<!--Change width and text dynamically.-->
|
5
|
-
<div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
|
6
|
-
<p class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</p>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
<% unless current_order_checked_out? %>
|
10
|
-
<% if current_order_can_be_checked_out? %>
|
11
|
-
<button class="button small button--sc" data-toggle="budget-confirm"><%= t('.vote') %></button>
|
12
|
-
<% else %>
|
13
|
-
<button class="button small button--sc" data-toggle="budget-confirm" disabled><%= t('.vote') %></button>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
16
|
-
</div>
|
17
|
-
|
18
|
-
<div class="progressbox-fixed-wrapper" data-progressbox-fixed>
|
19
|
-
<div class="budget-summary__progressbox budget-summary__progressbox--fixed">
|
20
|
-
<div class="progress budget-progress budget-progress--fixed" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
|
1
|
+
<div id="order-progress">
|
2
|
+
<div class="budget-summary__progressbox" data-current-budget="<%= current_order ? current_order.total_budget : 0 %>">
|
3
|
+
<div class="progress budget-progress" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
|
21
4
|
<div class="progress-meter progress-meter--minimum" style="width: <%= 100 - current_order_budget_percent %>%"></div>
|
5
|
+
<!--Change width and text dynamically.-->
|
22
6
|
<div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
|
23
7
|
<p class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</p>
|
24
8
|
</div>
|
@@ -31,4 +15,22 @@
|
|
31
15
|
<% end %>
|
32
16
|
<% end %>
|
33
17
|
</div>
|
34
|
-
|
18
|
+
|
19
|
+
<div class="progressbox-fixed-wrapper" data-progressbox-fixed>
|
20
|
+
<div class="budget-summary__progressbox budget-summary__progressbox--fixed">
|
21
|
+
<div class="progress budget-progress budget-progress--fixed" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
|
22
|
+
<div class="progress-meter progress-meter--minimum" style="width: <%= 100 - current_order_budget_percent %>%"></div>
|
23
|
+
<div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
|
24
|
+
<p class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</p>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% unless current_order_checked_out? %>
|
28
|
+
<% if current_order_can_be_checked_out? %>
|
29
|
+
<button class="button small button--sc" data-toggle="budget-confirm"><%= t('.vote') %></button>
|
30
|
+
<% else %>
|
31
|
+
<button class="button small button--sc" data-toggle="budget-confirm" disabled><%= t('.vote') %></button>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
@@ -1,25 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%=
|
1
|
+
<div id="order-selected-projects">
|
2
|
+
<% if current_order&.projects&.any? %>
|
3
|
+
<div class="card__content budget-summary__selected">
|
4
|
+
<button data-toggle="reveal-selected">
|
5
|
+
<strong><%= current_order.projects.size %> </strong><%= t('.selected_projects', count: current_order.projects.size) %>
|
6
|
+
<%= icon("caret-bottom", class:"icon--small", aria_label: t('.view'), role: "img") %>
|
7
|
+
</button>
|
8
|
+
<div id="reveal-selected" class="hide" data-toggler=".hide">
|
9
|
+
<ul class="budget-summary__selected-list">
|
10
|
+
<% current_order.projects.each do |project| %>
|
11
|
+
<li class="budget-summary__selected-item">
|
12
|
+
<%= link_to translated_attribute(project.title), project %>
|
13
|
+
<strong class="budget-summary__selected-number">
|
14
|
+
<%= budget_to_currency project.budget %>
|
15
|
+
</strong>
|
16
|
+
<% unless current_order_checked_out? %>
|
17
|
+
<%= button_to order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true }, form: { style: "display: inline" } do %>
|
18
|
+
<%= icon("trash", aria_label: t('.remove'), role: "img") %>
|
19
|
+
<% end %>
|
18
20
|
<% end %>
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
</
|
21
|
+
</li>
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
</div>
|
23
25
|
</div>
|
24
|
-
|
25
|
-
|
26
|
+
<% end %>
|
27
|
+
</div>
|
@@ -1,40 +1,42 @@
|
|
1
|
-
<div class="card--
|
2
|
-
<div>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<%= render partial: "decidim/budgets/projects/tags", locals: { project: project } %>
|
9
|
-
</div>
|
10
|
-
</div>
|
11
|
-
<% if current_user.present? %>
|
12
|
-
<% if current_order && current_order.projects.include?(project) %>
|
13
|
-
<div class="card--list__data budget-list__data budget-list__data--added">
|
14
|
-
<span class="card--list__data__number budget-list__number">
|
15
|
-
<%= budget_to_currency(project.budget) %>
|
16
|
-
</span>
|
17
|
-
<%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true, budget: project.budget }, disabled: current_order_checked_out?, class: "button tiny budget--list__action success" do %>
|
18
|
-
<%= icon("check", class: "icon--small", aria_label: t('.remove'), role: "img") %>
|
1
|
+
<div id="project-<%= project.id %>-item" class="card--list__item">
|
2
|
+
<div class="card--list__text">
|
3
|
+
<div>
|
4
|
+
<%= link_to project, class: "card__link" do %>
|
5
|
+
<h5 class="card__title budget-list__title">
|
6
|
+
<%= translated_attribute project.title %>
|
7
|
+
</h5>
|
19
8
|
<% end %>
|
9
|
+
<%= render partial: "decidim/budgets/projects/tags", locals: { project: project } %>
|
20
10
|
</div>
|
11
|
+
</div>
|
12
|
+
<% if current_user.present? %>
|
13
|
+
<% if current_order && current_order.projects.include?(project) %>
|
14
|
+
<div class="card--list__data budget-list__data budget-list__data--added">
|
15
|
+
<span class="card--list__data__number budget-list__number">
|
16
|
+
<%= budget_to_currency(project.budget) %>
|
17
|
+
</span>
|
18
|
+
<%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true, budget: project.budget }, disabled: current_order_checked_out?, class: "button tiny budget--list__action success" do %>
|
19
|
+
<%= icon("check", class: "icon--small", aria_label: t('.remove'), role: "img") %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<% else %>
|
23
|
+
<div class="card--list__data budget-list__data">
|
24
|
+
<span class="card--list__data__number budget-list__number">
|
25
|
+
<%= budget_to_currency(project.budget) %>
|
26
|
+
</span>
|
27
|
+
<%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :post, remote: true, data: { disable: true, budget: project.budget, add: true }, disabled: current_order_checked_out?, class: "button tiny hollow budget--list__action" do %>
|
28
|
+
<%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
21
32
|
<% else %>
|
22
33
|
<div class="card--list__data budget-list__data">
|
23
34
|
<span class="card--list__data__number budget-list__number">
|
24
35
|
<%= budget_to_currency(project.budget) %>
|
25
36
|
</span>
|
26
|
-
|
37
|
+
<a href="#" class="button tiny hollow budget--list__action disabled" data-toggle="loginModal">
|
27
38
|
<%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
|
28
|
-
|
39
|
+
</a>
|
29
40
|
</div>
|
30
41
|
<% end %>
|
31
|
-
|
32
|
-
<div class="card--list__data budget-list__data">
|
33
|
-
<span class="card--list__data__number budget-list__number">
|
34
|
-
<%= budget_to_currency(project.budget) %>
|
35
|
-
</span>
|
36
|
-
<a href="#" class="button tiny hollow budget--list__action disabled" data-toggle="loginModal">
|
37
|
-
<%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
|
38
|
-
</a>
|
39
|
-
</div>
|
40
|
-
<% end %>
|
42
|
+
</div>
|