decidim-initiatives 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/app/assets/images/decidim/gamification/badges/initiatives.svg +1 -87
- data/app/assets/images/decidim/initiatives/icon.svg +1 -3
- data/app/assets/stylesheet/decidim/initiatives/initiatives-votes.css.scss +0 -1
- data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +0 -8
- data/app/assets/stylesheet/decidim/initiatives/popularity_item.css.scss +0 -1
- data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +0 -3
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -3
- data/app/cells/decidim/initiatives/initiative_m_cell.rb +11 -0
- data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +3 -0
- data/app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb +17 -0
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +29 -10
- data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +3 -0
- data/app/commands/decidim/initiatives/attachment_methods.rb +33 -0
- data/app/commands/decidim/initiatives/create_initiative.rb +23 -1
- data/app/commands/decidim/initiatives/vote_initiative.rb +16 -0
- data/app/controllers/concerns/decidim/initiatives/admin/filterable.rb +18 -4
- data/app/controllers/concerns/decidim/initiatives/orderable.rb +3 -1
- data/app/controllers/concerns/decidim/initiatives/single_initiative_type.rb +26 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +20 -1
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +35 -5
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +17 -3
- data/app/controllers/decidim/initiatives/versions_controller.rb +20 -0
- data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +21 -0
- data/app/events/decidim/initiatives/admin/support_threshold_reached_event.rb +13 -0
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +31 -0
- data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +5 -1
- data/app/forms/decidim/initiatives/initiative_form.rb +34 -0
- data/app/forms/decidim/initiatives/vote_form.rb +3 -1
- data/app/helpers/decidim/initiatives/application_helper.rb +104 -0
- data/app/helpers/decidim/initiatives/initiative_helper.rb +13 -0
- data/app/helpers/decidim/initiatives/initiatives_helper.rb +10 -0
- data/app/jobs/decidim/initiatives/export_initiatives_job.rb +25 -0
- data/app/mailers/decidim/initiatives/initiatives_mailer.rb +0 -21
- data/app/models/concerns/decidim/initiatives/has_area.rb +30 -0
- data/app/models/decidim/initiative.rb +62 -10
- data/app/permissions/decidim/initiatives/admin/permissions.rb +7 -0
- data/app/permissions/decidim/initiatives/permissions.rb +35 -10
- data/app/serializers/decidim/initiatives/initiative_serializer.rb +32 -0
- data/app/services/decidim/initiatives/diff_renderer.rb +18 -0
- data/app/services/decidim/initiatives/initiative_search.rb +59 -15
- data/app/services/decidim/initiatives/status_change_notifier.rb +4 -5
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +8 -0
- data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +24 -1
- data/app/views/decidim/initiatives/admin/initiatives/_initiative_attachments.erb +43 -0
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +8 -3
- data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +12 -0
- data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +44 -10
- data/app/views/decidim/initiatives/create_initiative/finish.html.erb +17 -10
- data/app/views/decidim/initiatives/create_initiative/previous_form.html.erb +2 -1
- data/app/views/decidim/initiatives/create_initiative/promotal_committee.html.erb +1 -1
- data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +1 -2
- data/app/views/decidim/initiatives/create_initiative/show_similar_initiatives.html.erb +1 -1
- data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -0
- data/app/views/decidim/initiatives/initiatives/_author.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_filters.html.erb +16 -28
- data/app/views/decidim/initiatives/initiatives/_index_header.html.erb +3 -3
- data/app/views/decidim/initiatives/initiatives/_initiatives.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +2 -3
- data/app/views/decidim/initiatives/initiatives/_tags.html.erb +3 -0
- data/app/views/decidim/initiatives/initiatives/index.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/show.html.erb +1 -0
- data/app/views/decidim/initiatives/versions/index.html.erb +8 -0
- data/app/views/decidim/initiatives/versions/show.html.erb +10 -0
- data/app/views/layouts/decidim/_initiative_creation_header.html.erb +2 -1
- data/app/views/layouts/decidim/_initiative_header.html.erb +2 -1
- data/app/views/layouts/decidim/_initiative_signature_creation_header.html.erb +1 -1
- data/app/views/layouts/decidim/initiative_creation.html.erb +1 -2
- data/app/views/layouts/decidim/initiative_signature_creation.html.erb +2 -2
- data/config/locales/ar.yml +12 -19
- data/config/locales/bg-BG.yml +13 -0
- data/config/locales/ca.yml +79 -17
- data/config/locales/cs.yml +88 -26
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/de.yml +67 -16
- data/config/locales/el.yml +528 -0
- data/config/locales/en.yml +82 -20
- data/config/locales/es-MX.yml +79 -17
- data/config/locales/es-PY.yml +79 -17
- data/config/locales/es.yml +81 -19
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/eu.yml +4 -7
- data/config/locales/fi-plain.yml +79 -17
- data/config/locales/fi.yml +97 -35
- data/config/locales/fr-CA.yml +529 -0
- data/config/locales/fr.yml +66 -16
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +4 -7
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hu.yml +21 -18
- data/config/locales/id-ID.yml +4 -7
- data/config/locales/is-IS.yml +4 -7
- data/config/locales/it.yml +105 -57
- data/config/locales/ja-JP.yml +535 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lv-LV.yml +529 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/nl.yml +66 -16
- data/config/locales/no.yml +14 -29
- data/config/locales/pl.yml +241 -176
- data/config/locales/pt-BR.yml +5 -8
- data/config/locales/pt.yml +227 -176
- data/config/locales/ro-RO.yml +532 -0
- data/config/locales/ru.yml +4 -7
- data/config/locales/sk-SK.yml +468 -0
- data/config/locales/sk.yml +462 -0
- data/config/locales/sl.yml +18 -0
- data/config/locales/sr-CS.yml +8 -0
- data/config/locales/sv.yml +77 -26
- data/config/locales/tr-TR.yml +4 -7
- data/config/locales/uk.yml +4 -7
- data/db/migrate/20200320105920_index_foreign_keys_in_decidim_initiatives.rb +8 -0
- data/db/migrate/20200320105921_index_foreign_keys_in_decidim_initiatives_votes.rb +8 -0
- data/db/migrate/20200417120551_add_custom_signature_end_time_option.rb +7 -0
- data/db/migrate/20200424110930_add_attachments_enabled_option.rb +7 -0
- data/db/migrate/20200514085422_add_area_to_initiatives.rb +7 -0
- data/db/migrate/20200514102631_add_area_enabled_option_to_initiatives.rb +7 -0
- data/db/seeds/city2.jpeg +0 -0
- data/lib/decidim/initiatives/admin_engine.rb +4 -0
- data/lib/decidim/initiatives/engine.rb +1 -0
- data/lib/decidim/initiatives/participatory_space.rb +9 -1
- data/lib/decidim/initiatives/test/factories.rb +30 -1
- data/lib/decidim/initiatives/version.rb +1 -1
- metadata +55 -15
- data/app/views/decidim/initiatives/initiatives_mailer/notify_validating_request.html.erb +0 -3
@@ -18,16 +18,18 @@ module Decidim
|
|
18
18
|
list_public_initiatives?
|
19
19
|
read_public_initiative?
|
20
20
|
search_initiative_types_and_scopes?
|
21
|
+
request_membership?
|
21
22
|
|
22
23
|
return permission_action unless user
|
23
24
|
|
24
25
|
create_initiative?
|
25
|
-
request_membership?
|
26
26
|
|
27
27
|
vote_initiative?
|
28
28
|
sign_initiative?
|
29
29
|
unvote_initiative?
|
30
30
|
|
31
|
+
initiative_attachment?
|
32
|
+
|
31
33
|
permission_action
|
32
34
|
end
|
33
35
|
|
@@ -37,6 +39,10 @@ module Decidim
|
|
37
39
|
@initiative ||= context.fetch(:initiative, nil) || context.fetch(:current_participatory_space, nil)
|
38
40
|
end
|
39
41
|
|
42
|
+
def initiative_type
|
43
|
+
@initiative_type ||= context[:initiative_type]
|
44
|
+
end
|
45
|
+
|
40
46
|
def list_public_initiatives?
|
41
47
|
allow! if permission_action.subject == :initiative &&
|
42
48
|
permission_action.action == :list
|
@@ -78,16 +84,28 @@ module Decidim
|
|
78
84
|
return unless permission_action.subject == :initiative &&
|
79
85
|
permission_action.action == :request_membership
|
80
86
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
toggle_allow(can_request_membership?)
|
88
|
+
end
|
89
|
+
|
90
|
+
def can_request_membership?
|
91
|
+
return access_request_without_user? if user.blank?
|
92
|
+
|
93
|
+
access_request_membership?
|
94
|
+
end
|
89
95
|
|
90
|
-
|
96
|
+
def access_request_without_user?
|
97
|
+
!initiative.published? && initiative.promoting_committee_enabled? || Decidim::Initiatives.do_not_require_authorization
|
98
|
+
end
|
99
|
+
|
100
|
+
def access_request_membership?
|
101
|
+
!initiative.published? &&
|
102
|
+
initiative.promoting_committee_enabled? &&
|
103
|
+
!initiative.has_authorship?(user) &&
|
104
|
+
(
|
105
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
106
|
+
UserAuthorizations.for(user).any? ||
|
107
|
+
Decidim::UserGroups::ManageableUserGroups.for(user).verified.any?
|
108
|
+
)
|
91
109
|
end
|
92
110
|
|
93
111
|
def has_initiatives?
|
@@ -131,6 +149,13 @@ module Decidim
|
|
131
149
|
toggle_allow(can_unvote)
|
132
150
|
end
|
133
151
|
|
152
|
+
def initiative_attachment?
|
153
|
+
return unless permission_action.action == :add_attachment &&
|
154
|
+
permission_action.subject == :initiative
|
155
|
+
|
156
|
+
toggle_allow(initiative_type.attachments_enabled?)
|
157
|
+
end
|
158
|
+
|
134
159
|
def public_report_content_action?
|
135
160
|
return unless permission_action.action == :create &&
|
136
161
|
permission_action.subject == :moderation
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
class InitiativeSerializer < Decidim::Exporters::Serializer
|
6
|
+
# Serializes an inititative
|
7
|
+
def serialize
|
8
|
+
{
|
9
|
+
id: resource.id,
|
10
|
+
title: resource.title,
|
11
|
+
description: resource.description,
|
12
|
+
state: resource.state,
|
13
|
+
created_at: resource.created_at,
|
14
|
+
published_at: resource.published_at,
|
15
|
+
signature_end_date: resource.signature_end_date,
|
16
|
+
signature_type: resource.signature_type,
|
17
|
+
signatures: resource.supports_count,
|
18
|
+
scope: {
|
19
|
+
name: resource.scope&.name
|
20
|
+
},
|
21
|
+
type: {
|
22
|
+
title: resource.type&.title
|
23
|
+
},
|
24
|
+
authors: {
|
25
|
+
id: resource.author_users.map(&:id),
|
26
|
+
name: resource.author_users.map(&:name)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
class DiffRenderer < BaseDiffRenderer
|
6
|
+
private
|
7
|
+
|
8
|
+
# Lists which attributes will be diffable and how they should be rendered.
|
9
|
+
def attribute_types
|
10
|
+
{
|
11
|
+
description: :i18n_html,
|
12
|
+
title: :i18n,
|
13
|
+
state: :string
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -16,7 +16,9 @@ module Decidim
|
|
16
16
|
def base_query
|
17
17
|
Decidim::Initiative
|
18
18
|
.includes(scoped_type: [:scope])
|
19
|
+
.joins("JOIN decidim_users ON decidim_users.id = decidim_initiatives.decidim_author_id")
|
19
20
|
.where(organization: options[:organization])
|
21
|
+
.published
|
20
22
|
end
|
21
23
|
|
22
24
|
# Handle the search_text filter
|
@@ -29,22 +31,38 @@ module Decidim
|
|
29
31
|
"%#{search_text}%"
|
30
32
|
)
|
31
33
|
)
|
34
|
+
.or(
|
35
|
+
query.where(
|
36
|
+
"cast(decidim_initiatives.id as text) ILIKE ?", "%#{search_text}%"
|
37
|
+
)
|
38
|
+
)
|
39
|
+
.or(
|
40
|
+
query.where(
|
41
|
+
"decidim_users.name ILIKE ? OR decidim_users.nickname ILIKE ?", "%#{search_text}%", "%#{search_text}%"
|
42
|
+
)
|
43
|
+
)
|
32
44
|
end
|
33
45
|
|
34
46
|
# Handle the state filter
|
35
47
|
def search_state
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
48
|
+
accepted = state.member?("accepted") ? query.accepted : nil
|
49
|
+
rejected = state.member?("rejected") ? query.rejected : nil
|
50
|
+
answered = state.member?("answered") ? query.answered : nil
|
51
|
+
open = state.member?("open") ? query.open : nil
|
52
|
+
closed = state.member?("closed") ? query.closed : nil
|
53
|
+
|
54
|
+
query
|
55
|
+
.where(id: accepted)
|
56
|
+
.or(query.where(id: rejected))
|
57
|
+
.or(query.where(id: answered))
|
58
|
+
.or(query.where(id: open))
|
59
|
+
.or(query.where(id: closed))
|
42
60
|
end
|
43
61
|
|
44
|
-
def
|
45
|
-
return query if
|
62
|
+
def search_type_id
|
63
|
+
return query if type_ids.include?("all")
|
46
64
|
|
47
|
-
types = InitiativesTypeScope.where(decidim_initiatives_types_id:
|
65
|
+
types = InitiativesTypeScope.where(decidim_initiatives_types_id: type_ids).pluck(:id)
|
48
66
|
|
49
67
|
query.where(scoped_type: types)
|
50
68
|
end
|
@@ -58,13 +76,39 @@ module Decidim
|
|
58
76
|
end
|
59
77
|
|
60
78
|
def search_scope_id
|
61
|
-
return if
|
79
|
+
return query if scope_ids.include?("all")
|
62
80
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
81
|
+
clean_scope_ids = scope_ids
|
82
|
+
|
83
|
+
conditions = []
|
84
|
+
conditions << "decidim_initiatives_type_scopes.decidim_scopes_id IS NULL" if clean_scope_ids.delete("global")
|
85
|
+
conditions.concat(["? = ANY(decidim_scopes.part_of)"] * clean_scope_ids.count) if clean_scope_ids.any?
|
86
|
+
|
87
|
+
query.joins(:scoped_type).references(:decidim_scopes).where(conditions.join(" OR "), *clean_scope_ids.map(&:to_i))
|
88
|
+
end
|
89
|
+
|
90
|
+
def search_area_id
|
91
|
+
return query if area_ids.include?("all")
|
92
|
+
|
93
|
+
query.where(decidim_area_id: area_ids)
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
# Private: Returns an array with checked type ids.
|
99
|
+
def type_ids
|
100
|
+
[type_id].flatten
|
101
|
+
end
|
102
|
+
|
103
|
+
# Private: Returns an array with checked scope ids.
|
104
|
+
def scope_ids
|
105
|
+
[scope_id].flatten
|
106
|
+
end
|
107
|
+
|
108
|
+
# Private: Returns an array with checked area ids, handling area_types which are coded as its
|
109
|
+
# areas ids joined by _.
|
110
|
+
def area_ids
|
111
|
+
area_id.map { |id| id.split("_") }.flatten.uniq
|
68
112
|
end
|
69
113
|
end
|
70
114
|
end
|
@@ -38,12 +38,11 @@ module Decidim
|
|
38
38
|
.deliver_later
|
39
39
|
end
|
40
40
|
|
41
|
+
# Does nothing
|
41
42
|
def notify_validating_initiative
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
.deliver_later
|
46
|
-
end
|
43
|
+
# It has been moved into SendInitiativeToTechnicalValidation command as a standard notification
|
44
|
+
# It would be great to move the functionality of this class, which is invoked on Initiative#after_save,
|
45
|
+
# to the corresponding commands to follow the architecture of Decidim.
|
47
46
|
end
|
48
47
|
|
49
48
|
def notify_validating_result
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<span class="exports dropdown tiny button button--simple" data-toggle="export-dropdown"><%= t "actions.export", scope: "decidim.admin" %></span>
|
2
|
+
<div class="dropdown-pane" id="export-dropdown" data-dropdown data-position=bottom data-alignment=right data-auto-focus="true" data-close-on-click="true">
|
3
|
+
<ul class="vertical menu add-components">
|
4
|
+
<% %w{CSV JSON}.each do |format| %>
|
5
|
+
<li class="exports--format--<%= format.downcase %> exports--initiatives"><%= link_to t("decidim.admin.exports.export_as", name: t("decidim.initiatives.admin.exports.initiatives"), export_format: format.upcase), export_initiatives_path(format: format) %></li>
|
6
|
+
<% end %>
|
7
|
+
</ul>
|
8
|
+
</div>
|
@@ -22,6 +22,7 @@
|
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<div class="row">
|
25
|
+
<% unless single_initiative_type? %>
|
25
26
|
<div class="columns xlarge-6">
|
26
27
|
<%= form.select :type_id,
|
27
28
|
initiative_type_options,
|
@@ -36,7 +37,7 @@
|
|
36
37
|
"data-signature-types-search-url": decidim_initiatives.initiative_type_signature_types_search_url
|
37
38
|
} %>
|
38
39
|
</div>
|
39
|
-
|
40
|
+
<% end %>
|
40
41
|
<div class="columns xlarge-6">
|
41
42
|
<%= form.select :decidim_scope_id, [], {}, { disabled: !@form.signature_type_updatable? } %>
|
42
43
|
</div>
|
@@ -54,6 +55,24 @@
|
|
54
55
|
</div>
|
55
56
|
<% end %>
|
56
57
|
|
58
|
+
<% if can_edit_custom_signature_end_date?(current_initiative) %>
|
59
|
+
<div class="row column">
|
60
|
+
<%= form.date_field :signature_end_date, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
|
61
|
+
</div>
|
62
|
+
<% end %>
|
63
|
+
|
64
|
+
<% if current_initiative.area_enabled? %>
|
65
|
+
<div class="field">
|
66
|
+
<%= form.areas_select :area_id,
|
67
|
+
areas_for_select(current_organization),
|
68
|
+
{
|
69
|
+
selected: current_initiative.decidim_area_id,
|
70
|
+
include_blank: current_initiative.decidim_area_id.blank? || current_initiative.created?
|
71
|
+
},
|
72
|
+
disabled: !@form.area_updatable? %>
|
73
|
+
</div>
|
74
|
+
<% end %>
|
75
|
+
|
57
76
|
<div class="row">
|
58
77
|
<div class="columns xlarge-6">
|
59
78
|
<%= form.text_field :hashtag, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
|
@@ -71,6 +90,10 @@
|
|
71
90
|
</div>
|
72
91
|
</div>
|
73
92
|
<% end %>
|
93
|
+
|
94
|
+
<% if allowed_to?(:read, :attachment, initiative: current_participatory_space) %>
|
95
|
+
<%= render partial: "initiative_attachments", locals: { current_initiative: current_initiative, current_participatory_space: current_participatory_space } %>
|
96
|
+
<% end %>
|
74
97
|
</div>
|
75
98
|
</div>
|
76
99
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="row column">
|
2
|
+
<div class="columns xlarge-12">
|
3
|
+
<% if current_initiative.documents.any? %>
|
4
|
+
<div class="row column">
|
5
|
+
<strong><%= t ".documents" %>:</strong>
|
6
|
+
<ul id="documents">
|
7
|
+
<% current_initiative.documents.each do |document| %>
|
8
|
+
<li>
|
9
|
+
<%= link_to translated_attribute(document.title), document.url %>
|
10
|
+
<small><%= document.file_type %> <%= number_to_human_size(document.file_size) %></small>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if current_initiative.photos.any? %>
|
18
|
+
<div class="row column">
|
19
|
+
<strong><%= t(".photos") %>:</strong>
|
20
|
+
<div id="photos" class="gallery row">
|
21
|
+
<% current_initiative.photos.each do |photo| %>
|
22
|
+
<%= link_to photo.big_url, target: "_blank", rel: "noopener" do %>
|
23
|
+
<%= image_tag photo.thumbnail_url, class: "thumbnail", alt: strip_tags(translated_attribute(photo.title)) %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
<div class="columns xlarge-12">
|
31
|
+
<% if allowed_to?(:update, :initiative, initiative: current_initiative) %>
|
32
|
+
<%= aria_selected_link_to t(".edit"),
|
33
|
+
decidim_admin_initiatives.initiative_attachments_path(current_participatory_space),
|
34
|
+
class: "button" %>
|
35
|
+
<%= aria_selected_link_to t(".new"),
|
36
|
+
decidim_admin_initiatives.new_initiative_attachment_path(current_participatory_space),
|
37
|
+
class: "button" %>
|
38
|
+
<% else %>
|
39
|
+
<%= link_to t(".edit"), "#", class: "button muted disabled" %>
|
40
|
+
<%= link_to t(".new"), "#", class: "button muted disabled" %>
|
41
|
+
<% end %>
|
42
|
+
</div>
|
43
|
+
</div>
|
@@ -2,9 +2,12 @@
|
|
2
2
|
<div class="card-divider">
|
3
3
|
<h2 class="card-title">
|
4
4
|
<%= t "decidim.admin.titles.initiatives" %>
|
5
|
+
<div class="button--title">
|
6
|
+
<%= render partial: "decidim/initiatives/admin/exports/dropdown" if allowed_to? :export, :initiatives %>
|
7
|
+
</div>
|
5
8
|
</h2>
|
6
9
|
</div>
|
7
|
-
<%= admin_filter_selector %>
|
10
|
+
<%= admin_filter_selector(:initiatives) %>
|
8
11
|
<div class="card-section">
|
9
12
|
<div class="table-scroll">
|
10
13
|
<table class="table-list">
|
@@ -13,8 +16,9 @@
|
|
13
16
|
<th><%= t("models.initiatives.fields.id", scope: "decidim.admin") %></th>
|
14
17
|
<th><%= t("models.initiatives.fields.title", scope: "decidim.admin") %></th>
|
15
18
|
<th><%= t("models.initiatives.fields.state", scope: "decidim.admin") %></th>
|
16
|
-
<th><%= t("models.initiatives.fields.supports_count", scope: "decidim.admin") %></th>
|
19
|
+
<th><%= sort_link(query, :supports_count, t("models.initiatives.fields.supports_count", scope: "decidim.admin"), default_order: :desc) %></th>
|
17
20
|
<th><%= sort_link(query, :created_at, t("models.initiatives.fields.created_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
21
|
+
<th><%= sort_link(query, :published_at, t("models.initiatives.fields.published_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
18
22
|
<th class="actions"><%= t ".actions_title" %></th>
|
19
23
|
</tr>
|
20
24
|
</thead>
|
@@ -33,6 +37,7 @@
|
|
33
37
|
<td><%= humanize_admin_state initiative.state %></td>
|
34
38
|
<td><%= initiative.supports_count %>/<%= initiative.scoped_type.supports_required %></td>
|
35
39
|
<td><%= l initiative.created_at, format: :short %></td>
|
40
|
+
<td><%= initiative.published_at? ? l(initiative.published_at, format: :short) : "" %></td>
|
36
41
|
<td class="table-list__actions">
|
37
42
|
<% if allowed_to? :preview, :initiative, initiative: initiative %>
|
38
43
|
<%= icon_link_to "eye",
|
@@ -52,7 +57,7 @@
|
|
52
57
|
<% if allowed_to?(:answer, :initiative, initiative: initiative) %>
|
53
58
|
<%= icon_link_to "comment-square", edit_initiative_answer_path(initiative.slug), t("actions.answer", scope: "decidim.initiatives"), class: "action-icon action-icon--answer" %>
|
54
59
|
<% else %>
|
55
|
-
<%= icon "comment-square", scope: "decidim.admin", class: "action-icon action-icon--disabled" %>
|
60
|
+
<%= icon "comment-square", scope: "decidim.admin", class: "action-icon action-icon--disabled", role: "img", "aria-hidden": true %>
|
56
61
|
<% end %>
|
57
62
|
|
58
63
|
<% if allowed_to? :read, :initiative, initiative: initiative %>
|
@@ -16,10 +16,22 @@
|
|
16
16
|
<%= form.select :signature_type, form.object.signature_type_options %>
|
17
17
|
</div>
|
18
18
|
|
19
|
+
<div class="row column">
|
20
|
+
<%= form.check_box :attachments_enabled %>
|
21
|
+
</div>
|
22
|
+
|
19
23
|
<div class="row column">
|
20
24
|
<%= form.check_box :undo_online_signatures_enabled %>
|
21
25
|
</div>
|
22
26
|
|
27
|
+
<div class="row column">
|
28
|
+
<%= form.check_box :custom_signature_end_date_enabled %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="row column">
|
32
|
+
<%= form.check_box :area_enabled %>
|
33
|
+
</div>
|
34
|
+
|
23
35
|
<div class="row column" id="promoting-committee-details">
|
24
36
|
<%= form.check_box :promoting_committee_enabled %>
|
25
37
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% content_for :back_link do %>
|
2
2
|
<%= link_to :back do %>
|
3
|
-
<%= icon "chevron-left", class: "icon--small" %>
|
3
|
+
<%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
|
4
4
|
<%= t(".back") %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
@@ -19,14 +19,15 @@
|
|
19
19
|
<div class="card">
|
20
20
|
<div class="card__content">
|
21
21
|
<%= decidim_form_for(@form, url: next_wizard_path, method: :put, html: { class: "form new_initiative_form" }) do |f| %>
|
22
|
+
<%= form_required_explanation %>
|
22
23
|
<%= f.hidden_field :type_id %>
|
23
24
|
<div class=section>
|
24
|
-
|
25
|
-
<
|
26
|
-
|
25
|
+
<% unless single_initiative_type? %>
|
26
|
+
<div class="field">
|
27
|
+
<label for="type_description"><%= t ".initiative_type" %></label>
|
27
28
|
<%= text_field_tag :type_description, strip_tags(translated_attribute(initiative_type.title)), readonly: true %>
|
28
|
-
</
|
29
|
-
|
29
|
+
</div>
|
30
|
+
<% end %>
|
30
31
|
|
31
32
|
<div class="field">
|
32
33
|
<%= f.text_field :title, autofocus: true, required: true %>
|
@@ -50,18 +51,51 @@
|
|
50
51
|
<% else %>
|
51
52
|
<div class="field">
|
52
53
|
<%= f.select :scope_id,
|
53
|
-
|
54
|
-
|
54
|
+
scopes.map { |scope| [translated_attribute(scope.scope_name), scope&.scope&.id] },
|
55
|
+
include_blank: t(".select_scope") %>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
<% if initiative_type.custom_signature_end_date_enabled? %>
|
60
|
+
<div class="field">
|
61
|
+
<%= f.date_field :signature_end_date %>
|
62
|
+
</div>
|
63
|
+
<% end %>
|
64
|
+
|
65
|
+
<% if initiative_type.area_enabled? %>
|
66
|
+
<div class="field">
|
67
|
+
<%= f.areas_select :area_id, areas_for_select(current_organization), prompt: t(".select_area") %>
|
55
68
|
</div>
|
56
69
|
<% end %>
|
57
70
|
|
58
71
|
<% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
|
59
72
|
<div class="field">
|
60
73
|
<%= f.select :decidim_user_group_id,
|
61
|
-
Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map{ |g| [g.name, g.id] },
|
62
|
-
|
74
|
+
Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map { |g| [g.name, g.id] },
|
75
|
+
include_blank: current_user.name %>
|
63
76
|
</div>
|
64
77
|
<% end %>
|
78
|
+
|
79
|
+
<fieldset>
|
80
|
+
<legend><%= t("attachment_legend", scope: "decidim.proposals.proposals.edit") %></legend>
|
81
|
+
<%= f.fields_for :attachment, @form.attachment do |nested_form| %>
|
82
|
+
<div class="field">
|
83
|
+
<%= nested_form.text_field :title %>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div class="field">
|
87
|
+
<%= nested_form.upload :file, optional: false %>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<% if @form.errors[:attachment].present? %>
|
91
|
+
<% @form.errors[:attachment].each do |message| %>
|
92
|
+
<small class="form-error is-visible">
|
93
|
+
<%= message %>
|
94
|
+
</small>
|
95
|
+
<% end %>
|
96
|
+
<% end %>
|
97
|
+
<% end %>
|
98
|
+
</fieldset>
|
65
99
|
</div>
|
66
100
|
<div class="actions">
|
67
101
|
<%= f.submit t(".continue"), class: "button expanded", data: { disable_with: true } %>
|