decidim-proposals 0.10.1 → 0.11.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +3 -3
  4. data/app/assets/javascripts/decidim/proposals/admin/proposals.es6 +6 -7
  5. data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +17 -17
  6. data/app/assets/javascripts/decidim/proposals/utils.js.es6 +2 -2
  7. data/app/commands/decidim/proposals/admin/create_proposal.rb +2 -2
  8. data/app/commands/decidim/proposals/admin/import_proposals.rb +16 -8
  9. data/app/commands/decidim/proposals/create_proposal.rb +6 -6
  10. data/app/commands/decidim/proposals/destroy_proposal.rb +33 -0
  11. data/app/commands/decidim/proposals/update_proposal.rb +4 -4
  12. data/app/controllers/decidim/proposals/admin/application_controller.rb +2 -2
  13. data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +1 -1
  14. data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +1 -1
  15. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -2
  16. data/app/controllers/decidim/proposals/admin/proposals_imports_controller.rb +4 -4
  17. data/app/controllers/decidim/proposals/application_controller.rb +5 -5
  18. data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +1 -1
  19. data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
  20. data/app/controllers/decidim/proposals/proposal_widgets_controller.rb +1 -1
  21. data/app/controllers/decidim/proposals/proposals_controller.rb +52 -24
  22. data/app/events/decidim/proposals/proposal_mentioned_event.rb +19 -0
  23. data/app/forms/decidim/proposals/admin/proposal_form.rb +3 -3
  24. data/app/forms/decidim/proposals/admin/proposals_import_form.rb +9 -9
  25. data/app/forms/decidim/proposals/proposal_form.rb +5 -4
  26. data/app/helpers/decidim/proposals/application_helper.rb +38 -3
  27. data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +7 -3
  28. data/app/helpers/decidim/proposals/proposal_votes_helper.rb +9 -9
  29. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +2 -1
  30. data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +28 -0
  31. data/app/jobs/decidim/proposals/settings_change_job.rb +4 -4
  32. data/app/models/decidim/proposals/abilities/admin_ability.rb +4 -4
  33. data/app/models/decidim/proposals/abilities/current_user_ability.rb +12 -12
  34. data/app/models/decidim/proposals/abilities/participatory_process_admin_ability.rb +8 -8
  35. data/app/models/decidim/proposals/abilities/participatory_process_moderator_ability.rb +1 -1
  36. data/app/models/decidim/proposals/proposal.rb +7 -7
  37. data/app/models/decidim/proposals/proposal_endorsement.rb +6 -2
  38. data/app/presenters/decidim/proposals/proposal_presenter.rb +12 -0
  39. data/app/queries/decidim/proposals/filtered_proposals.rb +9 -9
  40. data/app/queries/decidim/proposals/similar_proposals.rb +9 -9
  41. data/app/services/decidim/proposals/proposal_search.rb +1 -1
  42. data/app/types/decidim/proposals/proposal_type.rb +17 -2
  43. data/app/types/decidim/proposals/proposals_type.rb +6 -6
  44. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +1 -1
  45. data/app/views/decidim/participatory_processes/participatory_process_groups/_proposal.html.erb +1 -1
  46. data/app/views/decidim/participatory_spaces/_highlighted_proposals.html.erb +2 -2
  47. data/app/views/decidim/participatory_spaces/_proposal.html.erb +1 -1
  48. data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +3 -3
  49. data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +2 -2
  50. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +3 -3
  51. data/app/views/decidim/proposals/admin/proposal_notes/index.html.erb +1 -1
  52. data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +2 -2
  53. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +3 -3
  54. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +1 -1
  55. data/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
  56. data/app/views/decidim/proposals/admin/proposals/new.html.erb +2 -2
  57. data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +3 -3
  58. data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +3 -3
  59. data/app/views/decidim/proposals/admin/shared/_info_proposal.html.erb +1 -1
  60. data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +2 -2
  61. data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +2 -2
  62. data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +19 -8
  63. data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +2 -2
  64. data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +3 -3
  65. data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +4 -4
  66. data/app/views/decidim/proposals/proposals/_endorsements_count.html.erb +2 -2
  67. data/app/views/decidim/proposals/proposals/_filters.html.erb +10 -10
  68. data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
  69. data/app/views/decidim/proposals/proposals/_identities_listing.html.erb +30 -0
  70. data/app/views/decidim/proposals/proposals/{_endorsement_xxs.html.erb → _identity_xxs.html.erb} +1 -2
  71. data/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -2
  72. data/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -1
  73. data/app/views/decidim/proposals/proposals/_tags.html.erb +25 -0
  74. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +7 -7
  75. data/app/views/decidim/proposals/proposals/_votes_count.html.erb +6 -5
  76. data/app/views/decidim/proposals/proposals/_voting_rules.html.erb +7 -7
  77. data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +5 -5
  78. data/app/views/decidim/proposals/proposals/compare.html.erb +1 -1
  79. data/app/views/decidim/proposals/proposals/complete.html.erb +70 -0
  80. data/app/views/decidim/proposals/proposals/edit.html.erb +3 -3
  81. data/app/views/decidim/proposals/proposals/edit_draft.html.erb +5 -3
  82. data/app/views/decidim/proposals/proposals/index.html.erb +5 -5
  83. data/app/views/decidim/proposals/proposals/new.html.erb +1 -43
  84. data/app/views/decidim/proposals/proposals/preview.html.erb +1 -1
  85. data/app/views/decidim/proposals/proposals/show.html.erb +16 -23
  86. data/config/locales/ca.yml +69 -55
  87. data/config/locales/en.yml +64 -50
  88. data/config/locales/es.yml +73 -59
  89. data/config/locales/eu.yml +64 -50
  90. data/config/locales/fi.yml +64 -50
  91. data/config/locales/fr.yml +75 -61
  92. data/config/locales/gl.yml +64 -50
  93. data/config/locales/it.yml +64 -50
  94. data/config/locales/nl.yml +153 -139
  95. data/config/locales/pl.yml +64 -50
  96. data/config/locales/pt-BR.yml +64 -50
  97. data/config/locales/pt.yml +64 -50
  98. data/config/locales/ru.yml +0 -9
  99. data/config/locales/sv.yml +64 -50
  100. data/config/locales/uk.yml +2 -16
  101. data/db/migrate/20171212102250_enable_pg_extensions.rb +12 -1
  102. data/db/migrate/20180305133811_rename_features_to_components_at_proposals.rb +11 -0
  103. data/db/migrate/20180413135249_fix_nil_threshold_per_proposal.rb +18 -0
  104. data/lib/decidim/content_parsers/proposal_parser.rb +95 -0
  105. data/lib/decidim/content_renderers/proposal_renderer.rb +33 -0
  106. data/lib/decidim/proposals.rb +9 -1
  107. data/lib/decidim/proposals/commentable_proposal.rb +3 -3
  108. data/lib/decidim/proposals/{feature.rb → component.rb} +39 -38
  109. data/lib/decidim/proposals/engine.rb +21 -6
  110. data/lib/decidim/proposals/proposal_serializer.rb +3 -3
  111. data/lib/decidim/proposals/test/factories.rb +5 -8
  112. data/lib/decidim/proposals/version.rb +1 -1
  113. metadata +32 -23
  114. data/app/views/decidim/proposals/proposals/_endorsements_listing.html.erb +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 134c47ba1de8ba2cdf3a628a14c2dc48698f211e82c681780c84dc8b2430c9dc
4
- data.tar.gz: 32a3c2095ce8d9911fedfb4b2de32700e8486f77295b0803286dc13177edec30
3
+ metadata.gz: 61f120f1a36e87a9527996ea017a92f0b86b86568238b2f3da8d3a1e71f6f2b8
4
+ data.tar.gz: 9f16f208205af60021e22ebe63b5de3777257b307bb20df62fe3b21854af8743
5
5
  SHA512:
6
- metadata.gz: ef07e3be67591e0b8762c564f249f264a9dc21c85a3cf369cef4a705a08487c3936a399d797027aa79fba678eb189c3f40b9c782a96de8db01faae4a38844f80
7
- data.tar.gz: a62d55e516832b9e7406caeb89313fdc36316918457fe0006b006b0296824b7c39311f89c96c536b936f4a1178ec42e73a0593faf871802275a46ab6be55b4fc
6
+ metadata.gz: 422a99e81a8365aedcaf35b849878c314fad0175bb2de621b15e64d9764583488c5639a8879b6ffda09b57e21f36474ed29078debdbcfdd0d4d5b500fa942b8b
7
+ data.tar.gz: dc7f9546a449a83fd9625ae16c8dadb319784e57bdb3ccd7e455a341c9bf9b8442d060c902a2d04ed9de2cb82d4b7888516a1b2ab94f65dc4144bb9de30aa1fa
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Decidim::Proposals
2
2
 
3
- The Proposals module adds one of the main features of Decidim: allows users to contribute to a participatory process by creating proposals.
3
+ The Proposals module adds one of the main components of Decidim: allows users to contribute to a participatory process by creating proposals.
4
4
 
5
5
  ## Usage
6
6
 
7
- Proposals will be available as a Feature for a Participatory Process.
7
+ Proposals will be available as a Component for a Participatory Process.
8
8
 
9
9
  ## Installation
10
10
 
@@ -2,8 +2,8 @@ $(() => {
2
2
  window.DecidimProposals = window.DecidimProposals || {};
3
3
 
4
4
  window.DecidimProposals.bindProposalAddress = () => {
5
- const $checkbox = $('#proposal_has_address');
6
- const $addressInput = $('#address_input');
5
+ const $checkbox = $("#proposal_has_address");
6
+ const $addressInput = $("#address_input");
7
7
 
8
8
  if ($checkbox.length > 0) {
9
9
  const toggleInput = () => {
@@ -14,7 +14,7 @@ $(() => {
14
14
  }
15
15
  }
16
16
  toggleInput();
17
- $checkbox.on('change', toggleInput);
17
+ $checkbox.on("change", toggleInput);
18
18
  }
19
19
  };
20
20
 
@@ -4,7 +4,7 @@ $(document).ready(function () {
4
4
  return $('.table-list .js-check-all-proposal:checked').length
5
5
  }
6
6
 
7
- let selectedProposalsCountUpdate = function() {
7
+ window.selectedProposalsCountUpdate = function() {
8
8
  if(selectedProposalsCount() == 0){
9
9
  $("#js-recategorize-proposals-count").text("")
10
10
  } else {
@@ -25,7 +25,7 @@ $(document).ready(function () {
25
25
  }
26
26
  }
27
27
 
28
- let showOtherActionsButtons = function() {
28
+ window.showOtherActionsButtons = function() {
29
29
  $("#js-other-actions-wrapper").removeClass('hide');
30
30
  }
31
31
 
@@ -37,13 +37,12 @@ $(document).ready(function () {
37
37
  $("#js-recategorize-proposals-actions").removeClass('hide');
38
38
  }
39
39
 
40
- let hideRecategorizeProposalActions = function() {
41
- $("#js-recategorize-proposals-actions").addClass('hide');
40
+ window.hideRecategorizeProposalActions = function() {
41
+ return $("#js-recategorize-proposals-actions").addClass('hide');
42
42
  }
43
43
 
44
-
45
44
  if ($('#js-form-recategorize-proposals').length) {
46
- hideRecategorizeProposalActions();
45
+ window.hideRecategorizeProposalActions();
47
46
  $("#js-bulk-actions-button").addClass('hide');
48
47
 
49
48
  $("#js-bulk-actions-recategorize").click(function(e){
@@ -105,7 +104,7 @@ $(document).ready(function () {
105
104
  });
106
105
 
107
106
  $('#js-cancel-edit-category').on('click', function (e) {
108
- hideRecategorizeProposalActions();
107
+ window.hideRecategorizeProposalActions()
109
108
  showBulkActionsButton();
110
109
  showOtherActionsButtons();
111
110
  });
@@ -5,17 +5,17 @@
5
5
  */
6
6
  $(document).ready(function () {
7
7
 
8
- let button = $('#select-identity-button'),
8
+ let button = $("#select-identity-button"),
9
9
  refreshUrl = null,
10
- userIdentitiesDialog = $('#user-identities');
10
+ userIdentitiesDialog = $("#user-identities");
11
11
 
12
12
  if (userIdentitiesDialog.length) {
13
- refreshUrl = userIdentitiesDialog.data('refresh-url');
13
+ refreshUrl = userIdentitiesDialog.data("refresh-url");
14
14
 
15
15
  button.click(function () {
16
16
  $.ajax(refreshUrl).done(function(response) {
17
- userIdentitiesDialog.html(response).foundation('open');
18
- button.trigger('ajax:success')
17
+ userIdentitiesDialog.html(response).foundation("open");
18
+ button.trigger("ajax:success")
19
19
  });
20
20
  });
21
21
  }
@@ -27,26 +27,26 @@ $(document).ready(function () {
27
27
  *
28
28
  */
29
29
  $(document).ready(function () {
30
- $("#select-identity-button").on('ajax:success', function() {
30
+ $("#select-identity-button").on("ajax:success", function() {
31
31
  // once reveal popup has been rendered register event callbacks
32
32
  $("#user-identities ul.reveal__list li").each(function(index, elem) {
33
33
  let liTag = $(elem)
34
- liTag.on('click', function() {
35
- let method = liTag.data('method')
36
- let url = liTag.data('url')
34
+ liTag.on("click", function() {
35
+ let method = liTag.data("method")
36
+ let url = liTag.data("url")
37
37
  $.ajax({
38
38
  url: url,
39
39
  method: method,
40
- dataType: 'script',
40
+ dataType: "script",
41
41
  success: function() {
42
- if (liTag.hasClass('selected')) {
43
- liTag.removeClass('selected')
44
- liTag.find('.icon--circle-check').addClass('invisible')
45
- liTag.data('method', 'post')
42
+ if (liTag.hasClass("selected")) {
43
+ liTag.removeClass("selected")
44
+ liTag.find(".icon--circle-check").addClass("invisible")
45
+ liTag.data("method", "post")
46
46
  } else {
47
- liTag.addClass('selected')
48
- liTag.find('.icon--circle-check').removeClass('invisible')
49
- liTag.data('method', 'delete')
47
+ liTag.addClass("selected")
48
+ liTag.find(".icon--circle-check").removeClass("invisible")
49
+ liTag.data("method", "delete")
50
50
  }
51
51
  }
52
52
  })
@@ -2,10 +2,10 @@
2
2
 
3
3
  (() => {
4
4
  $("#vote_button").mouseover(function () {
5
- $(this).text($(this).data('replace'));
5
+ $(this).text($(this).data("replace"));
6
6
  });
7
7
 
8
8
  $("#vote_button").mouseout(function () {
9
- $(this).text($(this).data('original'));
9
+ $(this).text($(this).data("original"));
10
10
  });
11
11
  })(this);
@@ -53,7 +53,7 @@ module Decidim
53
53
  body: form.body,
54
54
  category: form.category,
55
55
  scope: form.scope,
56
- feature: form.feature,
56
+ component: form.component,
57
57
  address: form.address,
58
58
  latitude: form.latitude,
59
59
  longitude: form.longitude,
@@ -86,7 +86,7 @@ module Decidim
86
86
  end
87
87
 
88
88
  def attachments_allowed?
89
- form.current_feature.settings.attachments_allowed?
89
+ form.current_component.settings.attachments_allowed?
90
90
  end
91
91
 
92
92
  def process_attachments?
@@ -31,6 +31,8 @@ module Decidim
31
31
 
32
32
  def import_proposals
33
33
  proposals.map do |original_proposal|
34
+ next if proposal_already_copied?(original_proposal, target_component)
35
+
34
36
  origin_attributes = original_proposal.attributes.except(
35
37
  "id",
36
38
  "created_at",
@@ -38,7 +40,7 @@ module Decidim
38
40
  "state",
39
41
  "answer",
40
42
  "answered_at",
41
- "decidim_feature_id",
43
+ "decidim_component_id",
42
44
  "reference",
43
45
  "proposal_votes_count",
44
46
  "proposal_notes_count"
@@ -46,16 +48,16 @@ module Decidim
46
48
 
47
49
  proposal = Decidim::Proposals::Proposal.new(origin_attributes)
48
50
  proposal.category = original_proposal.category
49
- proposal.feature = target_feature
51
+ proposal.component = target_component
50
52
  proposal.save!
51
53
 
52
54
  proposal.link_resources([original_proposal], "copied_from_component")
53
- end
55
+ end.compact
54
56
  end
55
57
 
56
58
  def proposals
57
59
  Decidim::Proposals::Proposal
58
- .where(feature: origin_feature)
60
+ .where(component: origin_component)
59
61
  .where(state: proposal_states)
60
62
  end
61
63
 
@@ -70,12 +72,18 @@ module Decidim
70
72
  @proposal_states
71
73
  end
72
74
 
73
- def origin_feature
74
- @form.origin_feature
75
+ def origin_component
76
+ @form.origin_component
75
77
  end
76
78
 
77
- def target_feature
78
- @form.current_feature
79
+ def target_component
80
+ @form.current_component
81
+ end
82
+
83
+ def proposal_already_copied?(original_proposal, target_component)
84
+ original_proposal.linked_resources(:proposals, "copied_from_component").any? do |proposal|
85
+ proposal.component == target_component
86
+ end
79
87
  end
80
88
  end
81
89
  end
@@ -52,7 +52,7 @@ module Decidim
52
52
  scope: form.scope,
53
53
  author: @current_user,
54
54
  decidim_user_group_id: form.user_group_id,
55
- feature: form.feature,
55
+ component: form.component,
56
56
  address: form.address,
57
57
  latitude: form.latitude,
58
58
  longitude: form.longitude
@@ -84,7 +84,7 @@ module Decidim
84
84
  end
85
85
 
86
86
  def attachments_allowed?
87
- form.current_feature.settings.attachments_allowed?
87
+ form.current_component.settings.attachments_allowed?
88
88
  end
89
89
 
90
90
  def process_attachments?
@@ -92,7 +92,7 @@ module Decidim
92
92
  end
93
93
 
94
94
  def proposal_limit_reached?
95
- proposal_limit = form.current_feature.settings.proposal_limit
95
+ proposal_limit = form.current_component.settings.proposal_limit
96
96
 
97
97
  return false if proposal_limit.zero?
98
98
 
@@ -104,7 +104,7 @@ module Decidim
104
104
  end
105
105
 
106
106
  def user_group
107
- @user_group ||= Decidim::UserGroup.where(organization: organization, id: form.user_group_id).first
107
+ @user_group ||= Decidim::UserGroup.find_by(organization: organization, id: form.user_group_id)
108
108
  end
109
109
 
110
110
  def organization
@@ -112,11 +112,11 @@ module Decidim
112
112
  end
113
113
 
114
114
  def current_user_proposals
115
- Proposal.where(author: @current_user, feature: form.current_feature)
115
+ Proposal.where(author: @current_user, component: form.current_component).except_withdrawn
116
116
  end
117
117
 
118
118
  def user_group_proposals
119
- Proposal.where(user_group: @user_group, feature: form.current_feature)
119
+ Proposal.where(user_group: @user_group, component: form.current_component).except_withdrawn
120
120
  end
121
121
  end
122
122
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Proposals
5
+ # A command with all the business logic when a user destroys a draft proposal.
6
+ class DestroyProposal < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # proposal - The proposal to destroy.
10
+ # current_user - The current user.
11
+ def initialize(proposal, current_user)
12
+ @proposal = proposal
13
+ @current_user = current_user
14
+ end
15
+
16
+ # Executes the command. Broadcasts these events:
17
+ #
18
+ # - :ok when everything is valid and the proposal is deleted.
19
+ # - :invalid if the proposal is not a draft.
20
+ # - :invalid if the proposal's author is not the current user.
21
+ #
22
+ # Returns nothing.
23
+ def call
24
+ return broadcast(:invalid) unless @proposal.draft?
25
+ return broadcast(:invalid) if @proposal.author != @current_user
26
+
27
+ @proposal.destroy!
28
+
29
+ broadcast(:ok, @proposal)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -52,7 +52,7 @@ module Decidim
52
52
  end
53
53
 
54
54
  def proposal_limit_reached?
55
- proposal_limit = form.current_feature.settings.proposal_limit
55
+ proposal_limit = form.current_component.settings.proposal_limit
56
56
 
57
57
  return false if proposal_limit.zero?
58
58
 
@@ -64,7 +64,7 @@ module Decidim
64
64
  end
65
65
 
66
66
  def user_group
67
- @user_group ||= Decidim::UserGroup.where(organization: organization, id: form.user_group_id).first
67
+ @user_group ||= Decidim::UserGroup.find_by(organization: organization, id: form.user_group_id)
68
68
  end
69
69
 
70
70
  def organization
@@ -72,11 +72,11 @@ module Decidim
72
72
  end
73
73
 
74
74
  def current_user_proposals
75
- Proposal.where(author: current_user, feature: form.current_feature).published.where.not(id: proposal.id)
75
+ Proposal.where(author: current_user, component: form.current_component).published.where.not(id: proposal.id)
76
76
  end
77
77
 
78
78
  def user_group_proposals
79
- Proposal.where(user_group: user_group, feature: form.current_feature).published.where.not(id: proposal.id)
79
+ Proposal.where(user_group: user_group, component: form.current_component).published.where.not(id: proposal.id)
80
80
  end
81
81
  end
82
82
  end
@@ -6,9 +6,9 @@ module Decidim
6
6
  # This controller is the abstract class from which all other controllers of
7
7
  # this engine inherit.
8
8
  #
9
- # Note that it inherits from `Decidim::Admin::Features::BaseController`, which
9
+ # Note that it inherits from `Decidim::Admin::Components::BaseController`, which
10
10
  # override its layout and provide all kinds of useful methods.
11
- class ApplicationController < Decidim::Admin::Features::BaseController
11
+ class ApplicationController < Decidim::Admin::Components::BaseController
12
12
  end
13
13
  end
14
14
  end
@@ -32,7 +32,7 @@ module Decidim
32
32
  private
33
33
 
34
34
  def proposal
35
- @proposal ||= Proposal.where(feature: current_feature).find(params[:id])
35
+ @proposal ||= Proposal.where(component: current_component).find(params[:id])
36
36
  end
37
37
  end
38
38
  end
@@ -32,7 +32,7 @@ module Decidim
32
32
  private
33
33
 
34
34
  def proposal
35
- @proposal ||= Proposal.where(feature: current_feature).find(params[:proposal_id])
35
+ @proposal ||= Proposal.where(component: current_component).find(params[:proposal_id])
36
36
  end
37
37
  end
38
38
  end
@@ -64,7 +64,7 @@ module Decidim
64
64
  private
65
65
 
66
66
  def query
67
- @query ||= Proposal.where(feature: current_feature).published.ransack(params[:q])
67
+ @query ||= Proposal.where(component: current_component).published.ransack(params[:q])
68
68
  end
69
69
 
70
70
  def proposals
@@ -72,7 +72,7 @@ module Decidim
72
72
  end
73
73
 
74
74
  def proposal
75
- @proposal ||= Proposal.where(feature: current_feature).find(params[:id])
75
+ @proposal ||= Proposal.where(component: current_component).find(params[:id])
76
76
  end
77
77
 
78
78
  def update_proposals_category_response_successful(response)
@@ -5,22 +5,22 @@ module Decidim
5
5
  module Admin
6
6
  class ProposalsImportsController < Admin::ApplicationController
7
7
  def new
8
- authorize! :manage, current_feature
8
+ authorize! :manage, current_component
9
9
 
10
10
  @form = form(Admin::ProposalsImportForm).instance
11
11
  end
12
12
 
13
13
  def create
14
- authorize! :manage, current_feature
14
+ authorize! :manage, current_component
15
15
 
16
16
  @form = form(Admin::ProposalsImportForm).from_params(params)
17
17
 
18
- authorize! :manage, @form.origin_feature
18
+ authorize! :manage, @form.origin_component
19
19
 
20
20
  Admin::ImportProposals.call(@form) do
21
21
  on(:ok) do |proposals|
22
22
  flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.proposals.admin", number: proposals.length)
23
- redirect_to EngineRouter.admin_proxy(current_feature).root_path
23
+ redirect_to EngineRouter.admin_proxy(current_component).root_path
24
24
  end
25
25
 
26
26
  on(:invalid) do
@@ -5,9 +5,9 @@ module Decidim
5
5
  # This controller is the abstract class from which all other controllers of
6
6
  # this engine inherit.
7
7
  #
8
- # Note that it inherits from `Decidim::Features::BaseController`, which
8
+ # Note that it inherits from `Decidim::Components::BaseController`, which
9
9
  # override its layout and provide all kinds of useful methods.
10
- class ApplicationController < Decidim::Features::BaseController
10
+ class ApplicationController < Decidim::Components::BaseController
11
11
  helper Decidim::Messaging::ConversationHelper
12
12
 
13
13
  helper_method :proposal_limit_reached?
@@ -15,8 +15,8 @@ module Decidim
15
15
  private
16
16
 
17
17
  def proposal_limit
18
- return nil if feature_settings.proposal_limit.zero?
19
- feature_settings.proposal_limit
18
+ return nil if component_settings.proposal_limit.zero?
19
+ component_settings.proposal_limit
20
20
  end
21
21
 
22
22
  def proposal_limit_reached?
@@ -26,7 +26,7 @@ module Decidim
26
26
  end
27
27
 
28
28
  def proposals
29
- Proposal.where(feature: current_feature)
29
+ Proposal.where(component: current_component)
30
30
  end
31
31
  end
32
32
  end