decidim-initiatives 0.28.2 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/cells/decidim/initiatives_votes/vote_cell.rb +1 -3
- data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +9 -58
- data/app/commands/decidim/initiatives/admin/create_initiative_type_scope.rb +5 -43
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +25 -42
- data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +3 -4
- data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +11 -61
- data/app/commands/decidim/initiatives/admin/update_initiative_type_scope.rb +2 -33
- data/app/commands/decidim/initiatives/admin/update_initiatives_settings.rb +2 -35
- data/app/commands/decidim/initiatives/create_initiative.rb +5 -6
- data/app/commands/decidim/initiatives/spawn_committee_request.rb +3 -4
- data/app/commands/decidim/initiatives/update_initiative.rb +3 -3
- data/app/commands/decidim/initiatives/validate_sms_code.rb +3 -3
- data/app/controllers/concerns/decidim/initiatives/needs_initiative.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/answers_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +7 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_settings_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_type_scopes_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/application_controller.rb +5 -2
- data/app/controllers/decidim/initiatives/committee_requests_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +1 -1
- data/app/events/decidim/initiatives/approve_membership_request_event.rb +9 -29
- data/app/events/decidim/initiatives/create_initiative_event.rb +17 -36
- data/app/events/decidim/initiatives/revoke_membership_request_event.rb +10 -33
- data/app/events/decidim/initiatives/spawn_committee_request_event.rb +10 -33
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +2 -2
- data/app/forms/decidim/initiatives/initiative_form.rb +11 -1
- data/app/forms/decidim/initiatives/vote_form.rb +2 -2
- data/app/helpers/decidim/initiatives/initiative_helper.rb +0 -74
- data/app/helpers/decidim/initiatives/initiatives_helper.rb +0 -7
- data/app/models/decidim/initiative.rb +1 -1
- data/app/packs/src/decidim/initiatives/admin/invite_users.js +1 -1
- data/app/serializers/decidim/initiatives/initiative_serializer.rb +1 -1
- data/app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +74 -68
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/_form.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +1 -1
- data/app/views/decidim/initiatives/committee_requests/new.html.erb +1 -2
- data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_new_initiative_button.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_vote_button.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/print.html.erb +2 -2
- data/app/views/decidim/initiatives/initiatives/show.html.erb +1 -2
- data/app/views/layouts/decidim/_initiative_header.html.erb +5 -5
- data/app/views/layouts/decidim/initiative.html.erb +1 -1
- data/config/initializers/wicked_pdf.rb +5 -5
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +1 -3
- data/config/locales/ca.yml +5 -2
- data/config/locales/cs.yml +4 -2
- data/config/locales/de.yml +6 -3
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +6 -3
- data/config/locales/es-MX.yml +5 -2
- data/config/locales/es-PY.yml +5 -2
- data/config/locales/es.yml +5 -2
- data/config/locales/eu.yml +6 -3
- data/config/locales/fi-plain.yml +5 -2
- data/config/locales/fi.yml +5 -2
- data/config/locales/fr-CA.yml +1 -3
- data/config/locales/fr.yml +1 -3
- data/config/locales/gl.yml +0 -1
- data/config/locales/he-IL.yml +0 -6
- data/config/locales/hu.yml +0 -3
- data/config/locales/id-ID.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/locales/ja.yml +6 -3
- data/config/locales/lt.yml +0 -3
- data/config/locales/lv.yml +0 -1
- data/config/locales/nl.yml +0 -1
- data/config/locales/no.yml +0 -1
- data/config/locales/pl.yml +5 -2
- data/config/locales/pt-BR.yml +0 -2
- data/config/locales/pt.yml +0 -1
- data/config/locales/ro-RO.yml +0 -1
- data/config/locales/ru.yml +0 -1
- data/config/locales/sk.yml +0 -1
- data/config/locales/sv.yml +0 -1
- data/config/locales/tr-TR.yml +0 -1
- data/config/locales/uk.yml +0 -1
- data/config/locales/zh-CN.yml +0 -1
- data/config/locales/zh-TW.yml +0 -3
- data/decidim-initiatives.gemspec +1 -1
- data/lib/decidim/api/initiative_api_type.rb +1 -1
- data/lib/decidim/initiatives/engine.rb +1 -0
- data/lib/decidim/initiatives/menu.rb +12 -1
- data/lib/decidim/initiatives/seeds.rb +89 -64
- data/lib/decidim/initiatives/version.rb +1 -1
- data/lib/decidim/initiatives.rb +0 -12
- data/lib/tasks/decidim_initiatives.rake +3 -3
- data/lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake +9 -11
- metadata +17 -19
- data/app/forms/decidim/initiatives/previous_form.rb +0 -24
- data/app/queries/decidim/initiatives/similar_initiatives.rb +0 -54
@@ -48,10 +48,10 @@ module Decidim
|
|
48
48
|
enforce_permission_to :update, :initiative_type_scope, initiative_type_scope: current_initiative_type_scope
|
49
49
|
@form = initiative_type_scope_form.from_params(params)
|
50
50
|
|
51
|
-
UpdateInitiativeTypeScope.call(
|
51
|
+
UpdateInitiativeTypeScope.call(@form, current_initiative_type_scope) do
|
52
52
|
on(:ok) do
|
53
53
|
flash[:notice] = I18n.t("decidim.initiatives.admin.initiatives_type_scopes.update.success")
|
54
|
-
redirect_to edit_initiatives_type_path(
|
54
|
+
redirect_to edit_initiatives_type_path(resource.type)
|
55
55
|
end
|
56
56
|
|
57
57
|
on(:invalid) do
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
enforce_permission_to :create, :initiative_type
|
33
33
|
@form = initiative_type_form.from_params(params)
|
34
34
|
|
35
|
-
CreateInitiativeType.call(@form
|
35
|
+
CreateInitiativeType.call(@form) do
|
36
36
|
on(:ok) do |initiative_type|
|
37
37
|
flash[:notice] = I18n.t("decidim.initiatives.admin.initiatives_types.create.success")
|
38
38
|
redirect_to edit_initiatives_type_path(initiative_type)
|
@@ -60,7 +60,7 @@ module Decidim
|
|
60
60
|
@form = initiative_type_form
|
61
61
|
.from_params(params, initiative_type: current_initiative_type)
|
62
62
|
|
63
|
-
UpdateInitiativeType.call(
|
63
|
+
UpdateInitiativeType.call(@form, current_initiative_type) do
|
64
64
|
on(:ok) do
|
65
65
|
flash[:notice] = I18n.t("decidim.initiatives.admin.initiatives_types.update.success")
|
66
66
|
redirect_to edit_initiatives_type_path(current_initiative_type)
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
|
-
# The main
|
5
|
+
# The main application controller for initiatives
|
6
|
+
#
|
7
|
+
# This controller is the abstract class from which all other controllers of
|
8
|
+
# this engine inherit.
|
6
9
|
class ApplicationController < Decidim::ApplicationController
|
7
10
|
include NeedsPermission
|
8
11
|
register_permissions(::Decidim::Initiatives::ApplicationController,
|
@@ -11,7 +14,7 @@ module Decidim
|
|
11
14
|
::Decidim::Permissions)
|
12
15
|
|
13
16
|
before_action do
|
14
|
-
if Decidim::InitiativesType.joins(:scopes).where(organization: current_organization).
|
17
|
+
if Decidim::InitiativesType.joins(:scopes).where(organization: current_organization).none?
|
15
18
|
flash[:alert] = t("index.uninitialized", scope: "decidim.initiatives")
|
16
19
|
redirect_to(decidim.root_path)
|
17
20
|
end
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
form = Decidim::Initiatives::CommitteeMemberForm
|
22
22
|
.from_params(initiative_id: current_initiative.id, user_id: current_user.id, state: "requested")
|
23
23
|
|
24
|
-
SpawnCommitteeRequest.call(form
|
24
|
+
SpawnCommitteeRequest.call(form) do
|
25
25
|
on(:ok) do
|
26
26
|
redirect_to initiatives_path, flash: {
|
27
27
|
notice: I18n.t(
|
@@ -57,7 +57,7 @@ module Decidim
|
|
57
57
|
def store_data
|
58
58
|
@form = form(Decidim::Initiatives::InitiativeForm).from_params(params, { initiative_type: })
|
59
59
|
|
60
|
-
CreateInitiative.call(@form
|
60
|
+
CreateInitiative.call(@form) do
|
61
61
|
on(:ok) do |initiative|
|
62
62
|
session[:initiative_id] = initiative.id
|
63
63
|
|
@@ -93,7 +93,7 @@ module Decidim
|
|
93
93
|
@form = form(Decidim::Initiatives::InitiativeForm)
|
94
94
|
.from_params(params, initiative_type: current_initiative.type, initiative: current_initiative)
|
95
95
|
|
96
|
-
UpdateInitiative.call(current_initiative, @form
|
96
|
+
UpdateInitiative.call(current_initiative, @form) do
|
97
97
|
on(:ok) do |initiative|
|
98
98
|
flash[:notice] = I18n.t("success", scope: "decidim.initiatives.update")
|
99
99
|
redirect_to initiative_path(initiative)
|
@@ -3,39 +3,19 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
class ApproveMembershipRequestEvent < Decidim::Events::SimpleEvent
|
6
|
-
def
|
7
|
-
I18n.t(
|
8
|
-
"decidim.initiatives.events.approve_membership_request.email_subject",
|
9
|
-
author_nickname:
|
10
|
-
)
|
11
|
-
end
|
6
|
+
def i18n_scope = "decidim.initiatives.events.approve_membership_request"
|
12
7
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
resource_title:,
|
17
|
-
resource_url:,
|
8
|
+
def i18n_options
|
9
|
+
{
|
10
|
+
author_nickname:,
|
18
11
|
author_profile_url:,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
def email_outro
|
24
|
-
I18n.t(
|
25
|
-
"decidim.initiatives.events.approve_membership_request.email_outro",
|
26
|
-
resource_title:,
|
27
|
-
resource_url:
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
def notification_title
|
32
|
-
I18n.t(
|
33
|
-
"decidim.initiatives.events.approve_membership_request.notification_title",
|
12
|
+
participatory_space_title:,
|
13
|
+
participatory_space_url:,
|
14
|
+
resource_path:,
|
34
15
|
resource_title:,
|
35
16
|
resource_url:,
|
36
|
-
|
37
|
-
|
38
|
-
).html_safe
|
17
|
+
scope: i18n_scope
|
18
|
+
}
|
39
19
|
end
|
40
20
|
|
41
21
|
private
|
@@ -2,49 +2,30 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
|
-
class CreateInitiativeEvent < Decidim::Events::
|
6
|
-
|
7
|
-
include Decidim::Events::NotificationEvent
|
5
|
+
class CreateInitiativeEvent < Decidim::Events::SimpleEvent
|
6
|
+
def i18n_scope = "decidim.initiatives.events.create_initiative_event"
|
8
7
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
8
|
+
def i18n_options
|
9
|
+
{
|
10
|
+
author_name:,
|
11
|
+
author_nickname:,
|
12
|
+
author_path:,
|
13
|
+
participatory_space_title:,
|
14
|
+
participatory_space_url:,
|
15
|
+
resource_path:,
|
12
16
|
resource_title:,
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
resource_url:,
|
18
|
+
scope: i18n_scope
|
19
|
+
}
|
16
20
|
end
|
17
21
|
|
18
|
-
|
19
|
-
I18n.t(
|
20
|
-
"decidim.initiatives.events.create_initiative_event.email_intro",
|
21
|
-
resource_title:,
|
22
|
-
author_nickname: author.nickname,
|
23
|
-
author_name: author.name
|
24
|
-
)
|
25
|
-
end
|
22
|
+
private
|
26
23
|
|
27
|
-
def
|
28
|
-
I18n.t(
|
29
|
-
"decidim.initiatives.events.create_initiative_event.email_outro",
|
30
|
-
resource_title:,
|
31
|
-
author_nickname: author.nickname,
|
32
|
-
author_name: author.name
|
33
|
-
)
|
34
|
-
end
|
24
|
+
def author_nickname = author.nickname
|
35
25
|
|
36
|
-
def
|
37
|
-
I18n.t(
|
38
|
-
"decidim.initiatives.events.create_initiative_event.notification_title",
|
39
|
-
resource_title:,
|
40
|
-
resource_path:,
|
41
|
-
author_nickname: author.nickname,
|
42
|
-
author_name: author.name,
|
43
|
-
author_path: author.profile_path
|
44
|
-
).html_safe
|
45
|
-
end
|
26
|
+
def author_name = author.name
|
46
27
|
|
47
|
-
|
28
|
+
def author_path = author.profile_path
|
48
29
|
|
49
30
|
def author
|
50
31
|
@author ||= Decidim::UserPresenter.new(resource.author)
|
@@ -2,43 +2,20 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
|
-
class RevokeMembershipRequestEvent < Decidim::Events::
|
6
|
-
|
7
|
-
include Decidim::Events::NotificationEvent
|
5
|
+
class RevokeMembershipRequestEvent < Decidim::Events::SimpleEvent
|
6
|
+
def i18n_scope = "decidim.initiatives.events.revoke_membership_request"
|
8
7
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
author_nickname:
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def email_intro
|
17
|
-
I18n.t(
|
18
|
-
"decidim.initiatives.events.revoke_membership_request.email_intro",
|
19
|
-
resource_title:,
|
20
|
-
resource_url:,
|
8
|
+
def i18n_options
|
9
|
+
{
|
10
|
+
author_nickname:,
|
21
11
|
author_profile_url:,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def email_outro
|
27
|
-
I18n.t(
|
28
|
-
"decidim.initiatives.events.revoke_membership_request.email_outro",
|
29
|
-
resource_title:,
|
30
|
-
resource_url:
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
def notification_title
|
35
|
-
I18n.t(
|
36
|
-
"decidim.initiatives.events.revoke_membership_request.notification_title",
|
12
|
+
participatory_space_title:,
|
13
|
+
participatory_space_url:,
|
14
|
+
resource_path:,
|
37
15
|
resource_title:,
|
38
16
|
resource_url:,
|
39
|
-
|
40
|
-
|
41
|
-
).html_safe
|
17
|
+
scope: i18n_scope
|
18
|
+
}
|
42
19
|
end
|
43
20
|
|
44
21
|
private
|
@@ -2,43 +2,20 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
|
-
class SpawnCommitteeRequestEvent < Decidim::Events::
|
6
|
-
|
7
|
-
include Decidim::Events::NotificationEvent
|
5
|
+
class SpawnCommitteeRequestEvent < Decidim::Events::SimpleEvent
|
6
|
+
def i18n_scope = "decidim.initiatives.events.spawn_committee_request_event"
|
8
7
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
applicant_nickname:
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def email_intro
|
17
|
-
I18n.t(
|
18
|
-
"decidim.initiatives.events.spawn_committee_request_event.email_intro",
|
19
|
-
resource_title:,
|
20
|
-
resource_url:,
|
8
|
+
def i18n_options
|
9
|
+
{
|
10
|
+
applicant_nickname:,
|
21
11
|
applicant_profile_url:,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def email_outro
|
27
|
-
I18n.t(
|
28
|
-
"decidim.initiatives.events.spawn_committee_request_event.email_outro",
|
29
|
-
resource_title:,
|
30
|
-
resource_url:
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
def notification_title
|
35
|
-
I18n.t(
|
36
|
-
"decidim.initiatives.events.spawn_committee_request_event.notification_title",
|
12
|
+
participatory_space_title:,
|
13
|
+
participatory_space_url:,
|
14
|
+
resource_path:,
|
37
15
|
resource_title:,
|
38
16
|
resource_url:,
|
39
|
-
|
40
|
-
|
41
|
-
).html_safe
|
17
|
+
scope: i18n_scope
|
18
|
+
}
|
42
19
|
end
|
43
20
|
|
44
21
|
private
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
def map_model(model)
|
42
42
|
self.type_id = model.type.id
|
43
43
|
self.decidim_scope_id = model.scope&.id
|
44
|
-
self.offline_votes = offline_votes.empty? ?
|
44
|
+
self.offline_votes = offline_votes.empty? ? zero_offline_votes_with_scopes_names(model) : offline_votes_with_scopes_names(model)
|
45
45
|
end
|
46
46
|
|
47
47
|
def signature_type_updatable?
|
@@ -72,7 +72,7 @@ module Decidim
|
|
72
72
|
private
|
73
73
|
|
74
74
|
# Private: set the in-person signatures to zero for every scope
|
75
|
-
def
|
75
|
+
def zero_offline_votes_with_scopes_names(model)
|
76
76
|
model.votable_initiative_type_scopes.each_with_object({}) do |initiative_scope_type, all_votes|
|
77
77
|
all_votes[initiative_scope_type.decidim_scopes_id || "global"] = [0, initiative_scope_type.scope_name]
|
78
78
|
end
|
@@ -3,12 +3,15 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
# A form object used to collect the data for a new initiative.
|
6
|
-
class InitiativeForm <
|
6
|
+
class InitiativeForm < Form
|
7
7
|
include TranslatableAttributes
|
8
8
|
include AttachmentAttributes
|
9
9
|
|
10
10
|
mimic :initiative
|
11
11
|
|
12
|
+
attribute :title, String
|
13
|
+
attribute :description, String
|
14
|
+
attribute :type_id, Integer
|
12
15
|
attribute :area_id, Integer
|
13
16
|
attribute :decidim_user_group_id, Integer
|
14
17
|
attribute :signature_type, String
|
@@ -21,6 +24,9 @@ module Decidim
|
|
21
24
|
attachments_attribute :photos
|
22
25
|
attachments_attribute :documents
|
23
26
|
|
27
|
+
validates :title, :description, presence: true
|
28
|
+
validates :title, length: { maximum: 150 }
|
29
|
+
validates :type_id, presence: true
|
24
30
|
validates :signature_type, presence: true
|
25
31
|
validates :area, presence: true, if: ->(form) { form.area_id.present? }
|
26
32
|
validate :notify_missing_attachment_if_errored
|
@@ -39,6 +45,10 @@ module Decidim
|
|
39
45
|
self.description = translated_attribute(model.description)
|
40
46
|
end
|
41
47
|
|
48
|
+
def type
|
49
|
+
@type ||= type_id ? Decidim::InitiativesType.find(type_id) : context.initiative.type
|
50
|
+
end
|
51
|
+
|
42
52
|
def signature_type_updatable?
|
43
53
|
state == "created" || state.nil?
|
44
54
|
end
|
@@ -93,8 +93,8 @@ module Decidim
|
|
93
93
|
# Public: Builds a list of Decidim::Scopes where the user could have a
|
94
94
|
# valid authorization.
|
95
95
|
#
|
96
|
-
# If the
|
97
|
-
# all the scopes in the
|
96
|
+
# If the initiative is set with a global scope (meaning the scope is nil),
|
97
|
+
# all the scopes in the organization are valid.
|
98
98
|
#
|
99
99
|
# Returns an array of Decidim::Scopes.
|
100
100
|
def authorized_scope_candidates
|
@@ -7,18 +7,6 @@ module Decidim
|
|
7
7
|
include Decidim::SanitizeHelper
|
8
8
|
include Decidim::ResourceVersionsHelper
|
9
9
|
|
10
|
-
# Public: The css class applied based on the initiative state to
|
11
|
-
# the initiative badge.
|
12
|
-
#
|
13
|
-
# initiative - Decidim::Initiative
|
14
|
-
#
|
15
|
-
# Returns a String.
|
16
|
-
def state_badge_css_class(initiative)
|
17
|
-
return "success" if initiative.accepted?
|
18
|
-
|
19
|
-
"warning"
|
20
|
-
end
|
21
|
-
|
22
10
|
def metadata_badge_css_class(initiative)
|
23
11
|
case initiative
|
24
12
|
when "accepted", "published"
|
@@ -32,17 +20,6 @@ module Decidim
|
|
32
20
|
end
|
33
21
|
end
|
34
22
|
|
35
|
-
# Public: The state of an initiative in a way a human can understand.
|
36
|
-
#
|
37
|
-
# initiative - Decidim::Initiative.
|
38
|
-
#
|
39
|
-
# Returns a String.
|
40
|
-
def humanize_state(initiative)
|
41
|
-
I18n.t(initiative.accepted? ? "accepted" : "expired",
|
42
|
-
scope: "decidim.initiatives.states",
|
43
|
-
default: :expired)
|
44
|
-
end
|
45
|
-
|
46
23
|
# Public: The state of an initiative from an administration perspective in
|
47
24
|
# a way that a human can understand.
|
48
25
|
#
|
@@ -53,51 +30,6 @@ module Decidim
|
|
53
30
|
I18n.t(state, scope: "decidim.initiatives.admin_states", default: :created)
|
54
31
|
end
|
55
32
|
|
56
|
-
def popularity_tag(initiative)
|
57
|
-
content_tag(:div, class: "extra__popularity popularity #{popularity_class(initiative)}".strip) do
|
58
|
-
5.times do
|
59
|
-
concat(content_tag(:span, class: "popularity__item") do
|
60
|
-
# empty block
|
61
|
-
end)
|
62
|
-
end
|
63
|
-
|
64
|
-
concat(content_tag(:span, class: "popularity__desc") do
|
65
|
-
I18n.t("decidim.initiatives.initiatives.vote_cabin.supports_required",
|
66
|
-
total_supports: initiative.scoped_type.supports_required)
|
67
|
-
end)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def popularity_class(initiative)
|
72
|
-
return "popularity--level1" if popularity_level1?(initiative)
|
73
|
-
return "popularity--level2" if popularity_level2?(initiative)
|
74
|
-
return "popularity--level3" if popularity_level3?(initiative)
|
75
|
-
return "popularity--level4" if popularity_level4?(initiative)
|
76
|
-
return "popularity--level5" if popularity_level5?(initiative)
|
77
|
-
|
78
|
-
""
|
79
|
-
end
|
80
|
-
|
81
|
-
def popularity_level1?(initiative)
|
82
|
-
initiative.percentage.positive? && initiative.percentage < 40
|
83
|
-
end
|
84
|
-
|
85
|
-
def popularity_level2?(initiative)
|
86
|
-
initiative.percentage >= 40 && initiative.percentage < 60
|
87
|
-
end
|
88
|
-
|
89
|
-
def popularity_level3?(initiative)
|
90
|
-
initiative.percentage >= 60 && initiative.percentage < 80
|
91
|
-
end
|
92
|
-
|
93
|
-
def popularity_level4?(initiative)
|
94
|
-
initiative.percentage >= 80 && initiative.percentage < 100
|
95
|
-
end
|
96
|
-
|
97
|
-
def popularity_level5?(initiative)
|
98
|
-
initiative.percentage >= 100
|
99
|
-
end
|
100
|
-
|
101
33
|
def authorized_create_modal_button(type, html_options, &)
|
102
34
|
tag = "button"
|
103
35
|
html_options ||= {}
|
@@ -142,12 +74,6 @@ module Decidim
|
|
142
74
|
initiative.created? || initiative.validating?
|
143
75
|
end
|
144
76
|
|
145
|
-
def can_edit_area?(initiative)
|
146
|
-
return false unless initiative.area_enabled?
|
147
|
-
|
148
|
-
initiative.created? || initiative.validating?
|
149
|
-
end
|
150
|
-
|
151
77
|
def render_committee_tooltip
|
152
78
|
with_tooltip t("decidim.initiatives.create_initiative.share_committee_link.invite_to_committee_help"), class: "left" do
|
153
79
|
icon "file-copy-line"
|
@@ -19,13 +19,6 @@ module Decidim
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
# Creates a unique namespace for a filter form to prevent dupliacte IDs in
|
23
|
-
# the DOM when multiple filter forms are rendered with the same fields (e.g.
|
24
|
-
# for desktop and mobile).
|
25
|
-
def filter_form_namespace
|
26
|
-
"filters_#{SecureRandom.uuid}"
|
27
|
-
end
|
28
|
-
|
29
22
|
# i18n-tasks-use t('decidim.initiatives.initiatives.filters.state')
|
30
23
|
# i18n-tasks-use t('decidim.initiatives.initiatives.filters.scope')
|
31
24
|
# i18n-tasks-use t('decidim.initiatives.initiatives.filters.type')
|
@@ -269,7 +269,7 @@ module Decidim
|
|
269
269
|
update(published_at: nil, state: "discarded")
|
270
270
|
end
|
271
271
|
|
272
|
-
# Public: Returns
|
272
|
+
# Public: Returns whether the signature interval is already defined or not.
|
273
273
|
def has_signature_interval_defined?
|
274
274
|
signature_end_date.present? && signature_start_date.present?
|
275
275
|
end
|
@@ -5,7 +5,7 @@ $(() => {
|
|
5
5
|
|
6
6
|
if (inviteUsersButton !== null) {
|
7
7
|
inviteUsersButton.addEventListener("click", function (event) {
|
8
|
-
let link = document.querySelector("
|
8
|
+
let link = document.querySelector("div[data-committee_link]"),
|
9
9
|
range = document.createRange();
|
10
10
|
|
11
11
|
event.preventDefault();
|
@@ -12,7 +12,7 @@
|
|
12
12
|
</div>
|
13
13
|
|
14
14
|
<div class="row column">
|
15
|
-
<div
|
15
|
+
<div data-committee_link>
|
16
16
|
<%= decidim_initiatives.new_initiative_committee_request_url(current_initiative) %>
|
17
17
|
<%= icon_link_to "clipboard-line", "#", t(".invite_to_committee_help"), class: "card--list__data__icon invite-users-link" %>
|
18
18
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<span class="exports button button__sm button__secondary
|
1
|
+
<span class="exports button button__sm button__secondary" data-toggle="<%= dropdown_id(collection_ids) %>">
|
2
2
|
<% if collection_ids.present? %>
|
3
3
|
<%= t("actions.export-selection", scope: "decidim.admin") %>
|
4
4
|
<% else %>
|