decidim-initiatives 0.20.0 → 0.23.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -0
  3. data/app/assets/images/decidim/gamification/badges/initiatives.svg +1 -87
  4. data/app/assets/images/decidim/initiatives/icon.svg +1 -3
  5. data/app/assets/javascripts/decidim/initiatives/admin/initiatives_types.js.es6 +18 -0
  6. data/app/assets/stylesheet/decidim/initiatives/initiatives-votes.css.scss +0 -1
  7. data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +6 -8
  8. data/app/assets/stylesheet/decidim/initiatives/popularity_item.css.scss +0 -1
  9. data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +0 -3
  10. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -3
  11. data/app/cells/decidim/initiatives/initiative_m_cell.rb +25 -0
  12. data/app/cells/decidim/initiatives_votes/vote/show.erb +12 -9
  13. data/app/cells/decidim/initiatives_votes/vote_cell.rb +7 -0
  14. data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +6 -1
  15. data/app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb +17 -0
  16. data/app/commands/decidim/initiatives/admin/update_initiative.rb +29 -10
  17. data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +6 -1
  18. data/app/commands/decidim/initiatives/attachment_methods.rb +37 -0
  19. data/app/commands/decidim/initiatives/create_initiative.rb +25 -3
  20. data/app/commands/decidim/initiatives/unvote_initiative.rb +4 -10
  21. data/app/commands/decidim/initiatives/vote_initiative.rb +47 -31
  22. data/app/controllers/concerns/decidim/initiatives/admin/filterable.rb +51 -0
  23. data/app/controllers/concerns/decidim/initiatives/orderable.rb +3 -1
  24. data/app/controllers/concerns/decidim/initiatives/single_initiative_type.rb +26 -0
  25. data/app/controllers/decidim/initiatives/admin/answers_controller.rb +2 -3
  26. data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +28 -15
  27. data/app/controllers/decidim/initiatives/create_initiative_controller.rb +36 -6
  28. data/app/controllers/decidim/initiatives/initiative_signatures_controller.rb +19 -23
  29. data/app/controllers/decidim/initiatives/initiative_votes_controller.rb +11 -5
  30. data/app/controllers/decidim/initiatives/initiatives_controller.rb +28 -13
  31. data/app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb +9 -1
  32. data/app/controllers/decidim/initiatives/versions_controller.rb +20 -0
  33. data/app/controllers/decidim/initiatives/{initiative_widgets_controller.rb → widgets_controller.rb} +2 -2
  34. data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +21 -0
  35. data/app/events/decidim/initiatives/admin/support_threshold_reached_event.rb +13 -0
  36. data/app/forms/decidim/initiatives/admin/initiative_form.rb +49 -7
  37. data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +8 -1
  38. data/app/forms/decidim/initiatives/initiative_form.rb +56 -1
  39. data/app/forms/decidim/initiatives/vote_form.rb +133 -76
  40. data/app/helpers/decidim/initiatives/application_helper.rb +104 -0
  41. data/app/helpers/decidim/initiatives/initiative_helper.rb +13 -0
  42. data/app/helpers/decidim/initiatives/initiatives_helper.rb +10 -0
  43. data/app/jobs/decidim/initiatives/export_initiatives_job.rb +25 -0
  44. data/app/mailers/decidim/initiatives/initiatives_mailer.rb +0 -21
  45. data/app/models/concerns/decidim/initiatives/has_area.rb +30 -0
  46. data/app/models/decidim/initiative.rb +184 -44
  47. data/app/models/decidim/initiatives_type.rb +5 -2
  48. data/app/models/decidim/initiatives_type_scope.rb +5 -1
  49. data/app/models/decidim/initiatives_vote.rb +19 -23
  50. data/app/permissions/decidim/initiatives/admin/permissions.rb +19 -8
  51. data/app/permissions/decidim/initiatives/permissions.rb +37 -14
  52. data/app/presenters/decidim/initiatives/initiative_stats_presenter.rb +1 -5
  53. data/app/queries/decidim/initiatives/admin/manageable_initiatives.rb +7 -39
  54. data/app/serializers/decidim/initiatives/initiative_serializer.rb +32 -0
  55. data/app/services/decidim/initiatives/diff_renderer.rb +18 -0
  56. data/app/services/decidim/initiatives/initiative_search.rb +59 -15
  57. data/app/services/decidim/initiatives/status_change_notifier.rb +4 -5
  58. data/app/types/decidim/initiatives/initiative_api_type.rb +26 -0
  59. data/app/types/decidim/initiatives/initiative_committee_member_type.rb +18 -0
  60. data/app/types/decidim/initiatives/initiative_type.rb +42 -0
  61. data/app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb +1 -1
  62. data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +8 -0
  63. data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +59 -14
  64. data/app/views/decidim/initiatives/admin/initiatives/_initiative_attachments.erb +43 -0
  65. data/app/views/decidim/initiatives/admin/initiatives/export_pdf_signatures.pdf.erb +12 -9
  66. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +10 -45
  67. data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +47 -10
  68. data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +28 -25
  69. data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +46 -10
  70. data/app/views/decidim/initiatives/create_initiative/finish.html.erb +17 -10
  71. data/app/views/decidim/initiatives/create_initiative/previous_form.html.erb +2 -1
  72. data/app/views/decidim/initiatives/create_initiative/promotal_committee.html.erb +1 -1
  73. data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +1 -2
  74. data/app/views/decidim/initiatives/create_initiative/show_similar_initiatives.html.erb +1 -1
  75. data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -1
  76. data/app/views/decidim/initiatives/initiative_signatures/update_buttons_and_counters.js.erb +1 -1
  77. data/app/views/decidim/initiatives/initiative_votes/update_buttons_and_counters.js.erb +1 -1
  78. data/app/views/decidim/initiatives/initiatives/_author.html.erb +1 -1
  79. data/app/views/decidim/initiatives/initiatives/_filters.html.erb +16 -28
  80. data/app/views/decidim/initiatives/initiatives/_index_header.html.erb +39 -5
  81. data/app/views/decidim/initiatives/initiatives/_initiatives.html.erb +11 -1
  82. data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +2 -3
  83. data/app/views/decidim/initiatives/initiatives/_progress_bar.html.erb +24 -9
  84. data/app/views/decidim/initiatives/initiatives/_tags.html.erb +3 -0
  85. data/app/views/decidim/initiatives/initiatives/_vote_cabin.html.erb +1 -13
  86. data/app/views/decidim/initiatives/initiatives/index.html.erb +1 -1
  87. data/app/views/decidim/initiatives/initiatives/show.html.erb +2 -3
  88. data/app/views/decidim/initiatives/versions/index.html.erb +8 -0
  89. data/app/views/decidim/initiatives/versions/show.html.erb +10 -0
  90. data/app/views/layouts/decidim/_initiative_creation_header.html.erb +2 -1
  91. data/app/views/layouts/decidim/_initiative_header.html.erb +2 -1
  92. data/app/views/layouts/decidim/_initiative_signature_creation_header.html.erb +1 -1
  93. data/app/views/layouts/decidim/initiative.html.erb +1 -0
  94. data/app/views/layouts/decidim/initiative_creation.html.erb +1 -2
  95. data/app/views/layouts/decidim/initiative_signature_creation.html.erb +2 -2
  96. data/config/locales/am-ET.yml +1 -0
  97. data/config/locales/ar.yml +17 -21
  98. data/config/locales/bg-BG.yml +13 -0
  99. data/config/locales/bg.yml +13 -0
  100. data/config/locales/ca.yml +100 -22
  101. data/config/locales/cs.yml +110 -32
  102. data/config/locales/da-DK.yml +1 -0
  103. data/config/locales/da.yml +1 -0
  104. data/config/locales/de.yml +75 -21
  105. data/config/locales/el-GR.yml +1 -0
  106. data/config/locales/el.yml +525 -0
  107. data/config/locales/en.yml +102 -24
  108. data/config/locales/eo.yml +1 -0
  109. data/config/locales/es-MX.yml +100 -21
  110. data/config/locales/es-PY.yml +100 -21
  111. data/config/locales/es.yml +104 -25
  112. data/config/locales/et-EE.yml +1 -0
  113. data/config/locales/et.yml +1 -0
  114. data/config/locales/eu.yml +4 -21
  115. data/config/locales/fi-plain.yml +99 -21
  116. data/config/locales/fi.yml +117 -39
  117. data/config/locales/fr-CA.yml +557 -0
  118. data/config/locales/fr.yml +101 -23
  119. data/config/locales/ga-IE.yml +1 -0
  120. data/config/locales/gl.yml +4 -21
  121. data/config/locales/hr-HR.yml +1 -0
  122. data/config/locales/hr.yml +1 -0
  123. data/config/locales/hu.yml +30 -24
  124. data/config/locales/id-ID.yml +4 -21
  125. data/config/locales/is-IS.yml +251 -0
  126. data/config/locales/is.yml +251 -0
  127. data/config/locales/it.yml +116 -61
  128. data/config/locales/ja-JP.yml +529 -0
  129. data/config/locales/ja.yml +549 -0
  130. data/config/locales/ko-KR.yml +1 -0
  131. data/config/locales/ko.yml +1 -0
  132. data/config/locales/lt-LT.yml +1 -0
  133. data/config/locales/lt.yml +1 -0
  134. data/config/locales/lv.yml +525 -0
  135. data/config/locales/mt-MT.yml +1 -0
  136. data/config/locales/mt.yml +1 -0
  137. data/config/locales/nl.yml +76 -21
  138. data/config/locales/no.yml +368 -9
  139. data/config/locales/om-ET.yml +1 -0
  140. data/config/locales/pl.yml +260 -189
  141. data/config/locales/pt-BR.yml +5 -22
  142. data/config/locales/pt.yml +231 -179
  143. data/config/locales/ro-RO.yml +533 -0
  144. data/config/locales/ru.yml +4 -21
  145. data/config/locales/sk-SK.yml +468 -0
  146. data/config/locales/sk.yml +458 -0
  147. data/config/locales/sl.yml +24 -0
  148. data/config/locales/so-SO.yml +1 -0
  149. data/config/locales/sr-CS.yml +8 -0
  150. data/config/locales/sv.yml +102 -31
  151. data/config/locales/ti-ER.yml +1 -0
  152. data/config/locales/tr-TR.yml +4 -21
  153. data/config/locales/uk.yml +4 -21
  154. data/config/locales/vi-VN.yml +1 -0
  155. data/config/locales/vi.yml +1 -0
  156. data/config/locales/zh-CN.yml +549 -0
  157. data/config/locales/zh-TW.yml +1 -0
  158. data/db/migrate/20191106144259_add_settings_to_initiatives_types.rb +8 -0
  159. data/db/migrate/20191107134847_add_scopes_to_initiatives_votes.rb +28 -0
  160. data/db/migrate/20191116170841_allow_multiple_initiative_votes_counter_caches.rb +32 -0
  161. data/db/migrate/20191118105634_allow_multiple_offline_votes.rb +34 -0
  162. data/db/migrate/20200320105920_index_foreign_keys_in_decidim_initiatives.rb +8 -0
  163. data/db/migrate/20200320105921_index_foreign_keys_in_decidim_initiatives_votes.rb +8 -0
  164. data/db/migrate/20200417120551_add_custom_signature_end_time_option.rb +7 -0
  165. data/db/migrate/20200424110930_add_attachments_enabled_option.rb +7 -0
  166. data/db/migrate/20200514085422_add_area_to_initiatives.rb +7 -0
  167. data/db/migrate/20200514102631_add_area_enabled_option_to_initiatives.rb +7 -0
  168. data/db/migrate/20200528151456_remove_user_groups_from_initiative_votes.rb +7 -0
  169. data/db/migrate/20200827154214_add_commentable_counter_cache_to_initiatives.rb +9 -0
  170. data/db/seeds/city.jpeg +0 -0
  171. data/db/seeds/city2.jpeg +0 -0
  172. data/lib/decidim/api/initiative_type_interface.rb +13 -0
  173. data/lib/decidim/initiatives/admin_engine.rb +5 -0
  174. data/lib/decidim/initiatives/api.rb +7 -0
  175. data/lib/decidim/initiatives/engine.rb +11 -2
  176. data/lib/decidim/initiatives/participatory_space.rb +18 -1
  177. data/lib/decidim/initiatives/query_extensions.rb +40 -0
  178. data/lib/decidim/initiatives/test/factories.rb +57 -10
  179. data/lib/decidim/initiatives/version.rb +1 -1
  180. data/lib/tasks/decidim_initiatives.rake +1 -3
  181. metadata +95 -22
  182. data/app/views/decidim/initiatives/initiative_widgets/show.html.erb +0 -4
  183. data/app/views/decidim/initiatives/initiatives/_supports.html.erb +0 -22
  184. data/app/views/decidim/initiatives/initiatives/signature_identities.html.erb +0 -42
  185. data/app/views/decidim/initiatives/initiatives_mailer/notify_validating_request.html.erb +0 -3
@@ -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
- initiative.organization.admins.each do |user|
43
- Decidim::Initiatives::InitiativesMailer
44
- .notify_validating_request(initiative, user)
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,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ InitiativeApiType = GraphQL::ObjectType.define do
6
+ name "InitiativeType"
7
+ description "An initiative type"
8
+
9
+ field :id, !types.ID, "The internal ID for this initiative type"
10
+ field :title, Decidim::Core::TranslatedFieldType, "Initiative type name"
11
+ field :description, Decidim::Core::TranslatedFieldType, "This is the initiative type description"
12
+ field :createdAt, Decidim::Core::DateTimeType, "The date this initiative type was created", property: :created_at
13
+ field :updatedAt, Decidim::Core::DateTimeType, "The date this initiative type was updated", property: :updated_at
14
+ field :bannerImage, types.String, "Banner image", property: :banner_image
15
+ field :collectUserExtraFields, types.Boolean, "Collect participant personal data on signature", property: :collect_user_extra_fields
16
+ field :extraFieldsLegalInformation, types.String, "Legal information about the collection of personal data", property: :extra_fields_legal_information
17
+ field :minimumCommitteeMembers, types.Int, "Minimum of committee members", property: :minimum_committee_members
18
+ field :validateSmsCodeOnVotes, types.Boolean, "Add SMS code validation step to signature process", property: :validate_sms_code_on_votes
19
+ field :undoOnlineSignaturesEnabled, types.Boolean, "Enable participants to undo their online signatures", property: :undo_online_signatures_enabled
20
+ field :promotingComitteeEnabled, types.Boolean, "If promoting committee is enabled", property: :promoting_committee_enabled
21
+ field :signatureType, types.String, "Signature type of the initiative", property: :signature_type
22
+
23
+ field :initiatives, !types[Decidim::Initiatives::InitiativeType], "The initiatives that have this type"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # This type represents a initiative committee member.
6
+ InitiativeCommitteeMemberType = GraphQL::ObjectType.define do
7
+ name "InitiativeCommitteeMemberType"
8
+ description "A initiative committee member"
9
+
10
+ field :id, !types.ID, "Internal ID for this member of the committee"
11
+ field :user, Decidim::Core::UserType, "The decidim user for this initiative committee member"
12
+
13
+ field :state, types.Int, "Type of the committee member"
14
+ field :createdAt, Decidim::Core::DateTimeType, "The date this initiative committee member was created", property: :created_at
15
+ field :updatedAt, Decidim::Core::DateTimeType, "The date this initiative committee member was updated", property: :updated_at
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # This type represents a Initiative.
6
+ InitiativeType = GraphQL::ObjectType.define do
7
+ interfaces [
8
+ -> { Decidim::Core::ParticipatorySpaceInterface },
9
+ -> { Decidim::Core::ScopableInterface },
10
+ -> { Decidim::Core::AttachableInterface },
11
+ -> { Decidim::Core::AuthorInterface },
12
+ -> { Decidim::Initiatives::InitiativeTypeInterface }
13
+ ]
14
+
15
+ name "Initiative"
16
+ description "A initiative"
17
+
18
+ field :description, Decidim::Core::TranslatedFieldType, "The description of this initiative."
19
+ field :slug, !types.String
20
+ field :hashtag, types.String, "The hashtag for this initiative"
21
+ field :createdAt, !Decidim::Core::DateTimeType, "The time this initiative was created", property: :created_at
22
+ field :updatedAt, !Decidim::Core::DateTimeType, "The time this initiative was updated", property: :updated_at
23
+ field :publishedAt, !Decidim::Core::DateTimeType, "The time this initiative was published", property: :published_at
24
+ field :reference, !types.String, "Reference prefix for this initiative"
25
+ field :state, types.String, "Current status of the initiative"
26
+ field :signatureType, types.String, "Signature type of the initiative", property: :signature_type
27
+ field :signatureStartDate, !Decidim::Core::DateType, "The signature start date", property: :signature_start_date
28
+ field :signatureEndDate, !Decidim::Core::DateType, "The signature end date", property: :signature_end_date
29
+ field :offlineVotes, types.Int, "The number of offline votes in this initiative", property: :offline_votes
30
+ field :initiativeVotesCount, types.Int, "The number of votes in this initiative", property: :initiative_votes_count
31
+ field :initiativeSupportsCount, types.Int, "The number of supports in this initiative", property: :initiative_supports_count
32
+
33
+ field :author, !Decidim::Core::AuthorInterface, "The initiative author" do
34
+ resolve lambda { |obj, _args, _ctx|
35
+ obj.user_group || obj.author
36
+ }
37
+ end
38
+
39
+ field :committeeMembers, types[Decidim::Initiatives::InitiativeCommitteeMemberType], property: :committee_members
40
+ end
41
+ end
42
+ end
@@ -17,7 +17,7 @@
17
17
  <strong><%= t ".state" %>: </strong> <%= I18n.t(initiative.state, scope: "decidim.initiatives.admin_states") %>
18
18
  </div>
19
19
  <div class="row column">
20
- <strong><%= t ".initiative_votes_count" %>: </strong> <%= initiative.initiative_votes_count %>
20
+ <strong><%= t ".initiative_votes_count" %>: </strong> <%= initiative.online_votes_count %>
21
21
  </div>
22
22
  </div>
23
23
  </div>
@@ -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>
@@ -3,6 +3,28 @@
3
3
  <h2 class="card-title"><%= t ".title" %></h2>
4
4
  </div>
5
5
 
6
+ <div class="card-section">
7
+ <div class="row column">
8
+ <%= form.translated :text_field, :title, autofocus: true, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
9
+ </div>
10
+
11
+ <div class="row column">
12
+ <%= form.translated :editor, :description, toolbar: :full, lines: 8, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
13
+ </div>
14
+
15
+ <div class="row column">
16
+ <div class="columns xlarge-6">
17
+ <%= form.text_field :hashtag, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+
23
+ <div class="card">
24
+ <div class="card-divider">
25
+ <h2 class="card-title"><%= t ".settings" %></h2>
26
+ </div>
27
+
6
28
  <div class="card-section">
7
29
  <div class="row">
8
30
  <div class="columns xlarge-6">
@@ -13,15 +35,8 @@
13
35
  </div>
14
36
  </div>
15
37
 
16
- <div class="row column">
17
- <%= form.translated :text_field, :title, autofocus: true, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
18
- </div>
19
-
20
- <div class="row column">
21
- <%= form.translated :editor, :description, toolbar: :full, lines: 8, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
22
- </div>
23
-
24
38
  <div class="row">
39
+ <% unless single_initiative_type? %>
25
40
  <div class="columns xlarge-6">
26
41
  <%= form.select :type_id,
27
42
  initiative_type_options,
@@ -29,14 +44,14 @@
29
44
  {
30
45
  disabled: !@form.signature_type_updatable?,
31
46
  "data-scope-selector": "initiative_decidim_scope_id",
32
- "data-scope-id": form.object.decidim_scope_id,
47
+ "data-scope-id": form.object.decidim_scope_id.to_s,
33
48
  "data-scope-search-url": decidim_initiatives.initiative_type_scopes_search_url,
34
49
  "data-signature-types-selector": "initiative_signature_type",
35
50
  "data-signature-type": current_initiative.signature_type,
36
51
  "data-signature-types-search-url": decidim_initiatives.initiative_type_signature_types_search_url
37
52
  } %>
38
53
  </div>
39
-
54
+ <% end %>
40
55
  <div class="columns xlarge-6">
41
56
  <%= form.select :decidim_scope_id, [], {}, { disabled: !@form.signature_type_updatable? } %>
42
57
  </div>
@@ -54,11 +69,25 @@
54
69
  </div>
55
70
  <% end %>
56
71
 
57
- <div class="row">
58
- <div class="columns xlarge-6">
59
- <%= form.text_field :hashtag, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
72
+ <% if can_edit_custom_signature_end_date?(current_initiative) %>
73
+ <div class="row column">
74
+ <%= form.date_field :signature_end_date, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
60
75
  </div>
76
+ <% end %>
61
77
 
78
+ <% if current_initiative.area_enabled? %>
79
+ <div class="field">
80
+ <%= form.areas_select :area_id,
81
+ areas_for_select(current_organization),
82
+ {
83
+ selected: current_initiative.decidim_area_id,
84
+ include_blank: current_initiative.decidim_area_id.blank? || current_initiative.created?
85
+ },
86
+ disabled: !@form.area_updatable? %>
87
+ </div>
88
+ <% end %>
89
+
90
+ <div class="row">
62
91
  <div class="columns xlarge-6">
63
92
  <%= form.select :signature_type, [], {}, { disabled: !@form.signature_type_updatable? } %>
64
93
  </div>
@@ -67,11 +96,27 @@
67
96
  <% if current_initiative.accepts_offline_votes? && current_user.admin? %>
68
97
  <div class="row">
69
98
  <div class="columns xlarge-6">
70
- <%= form.number_field :offline_votes, min: 1 %>
99
+ <% @form.offline_votes.each do |scope_id, (votes, scope_name)| %>
100
+ <%= label_tag "initiative_offline_votes_#{scope_id}", t("activemodel.attributes.initiative.offline_votes_for_scope", scope_name: translated_attribute(scope_name)) %>
101
+ <%= number_field_tag "initiative[offline_votes][#{scope_id}]", votes, min: 0, id: "initiative_offline_votes_#{scope_id}" %>
102
+ <% end %>
71
103
  </div>
72
104
  </div>
73
105
  <% end %>
74
106
  </div>
75
107
  </div>
108
+ <div class="card">
109
+ <div class="card-divider">
110
+ <h2 class="card-title"><%= t ".attachments" %></h2>
111
+ </div>
112
+
113
+ <div class="card-section">
114
+ <div class="row">
115
+ <% if allowed_to?(:read, :attachment, initiative: current_participatory_space) %>
116
+ <%= render partial: "initiative_attachments", locals: { current_initiative: current_initiative, current_participatory_space: current_participatory_space } %>
117
+ <% end %>
118
+ </div>
119
+ </div>
120
+ </div>
76
121
 
77
122
  <%= javascript_include_tag "decidim/initiatives/scoped_type" %>
@@ -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>
@@ -41,33 +41,36 @@
41
41
  <br>
42
42
  <div class="initiatives-votes-table" style="width: 100%; display: block; border: 1pt solid black;">
43
43
  <div class="initiatives-votes-table-header" style="background-color: lightgray; display: inline-block; width: 100%; font-size: 12pt; font-weight: bold; border-bottom: 1pt solid black;">
44
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
44
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
45
45
  <%= t("models.initiatives_votes.fields.initiative_id", scope: "decidim.admin") %>
46
46
  </div>
47
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
47
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
48
48
  <%= t("models.initiatives_votes.fields.initiative_title", scope: "decidim.admin") %>
49
49
  </div>
50
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
50
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
51
51
  <%= t("models.initiatives_votes.fields.name_and_surname", scope: "decidim.admin") %>
52
52
  </div>
53
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
53
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
54
54
  <%= t("models.initiatives_votes.fields.document_number", scope: "decidim.admin") %>
55
55
  </div>
56
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
56
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
57
57
  <%= t("models.initiatives_votes.fields.date_of_birth", scope: "decidim.admin") %>
58
58
  </div>
59
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
59
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
60
60
  <%= t("models.initiatives_votes.fields.postal_code", scope: "decidim.admin") %>
61
61
  </div>
62
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
62
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
63
63
  <%= t("models.initiatives_votes.fields.time_and_date", scope: "decidim.admin") %>
64
64
  </div>
65
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
65
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
66
66
  <%= t("models.initiatives_votes.fields.timestamp", scope: "decidim.admin") %>
67
67
  </div>
68
- <div class="initiatives-votes-table-cell w11" style="width: 10.8%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
68
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
69
69
  <%= t("models.initiatives_votes.fields.hash", scope: "decidim.admin") %>
70
70
  </div>
71
+ <div class="initiatives-votes-table-cell w11" style="width: 9.4%; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;">
72
+ <%= t("models.initiatives_votes.fields.scope", scope: "decidim.admin") %>
73
+ </div>
71
74
  </div>
72
75
  <% @votes.each do |vote| %>
73
76
  <%= cell "decidim/initiatives_votes/vote", vote %>
@@ -1,50 +1,13 @@
1
- <div class="filters row">
2
- <div class="column medium-3">
3
- <span class="dropdown-menu-inverted_label"><%= t(".filter_by") %> :</span>
4
- <ul class="dropdown menu dropdown-inverted" data-dropdown-menu data-close-on-click-inside="false">
5
- <li class="is-dropdown-submenu-parent">
6
- <a href="#">
7
- <% if @state.present? %>
8
- <%= t(".filter.#{@state}") %>
9
- <% else %>
10
- <%= t(".filter.all") %>
11
- <% end %>
12
- </a>
13
- <ul class="menu is-dropdown-submenu">
14
- <li><%= link_to t(".filter.created"), url_for(state: "created", q: @query) %></li>
15
- <li><%= link_to t(".filter.validating"), url_for(state: "validating", q: @query) %></li>
16
- <li><%= link_to t(".filter.discarded"), url_for(state: "discarded", q: @query) %></li>
17
- <li><%= link_to t(".filter.published"), url_for(state: "published", q: @query) %></li>
18
- <li><%= link_to t(".filter.rejected"), url_for(state: "rejected", q: @query) %></li>
19
- <li><%= link_to t(".filter.accepted"), url_for(state: "accepted", q: @query) %></li>
20
- <li><%= link_to t(".filter.all"), url_for(q: @query) %></li>
21
- </ul>
22
- </li>
23
- </ul>
24
- </div>
25
- <div class="column medium-4">
26
- <%= form_tag "", method: :get do %>
27
- <div class="filters__search">
28
- <div class="input-group">
29
- <%= search_field_tag :q, @query,label: false, class: "input-group-field", placeholder: t(".search") %>
30
- <%= hidden_field_tag :state, @state %>
31
- <div class="input-group-button">
32
- <button type="submit" class="button button--muted">
33
- <%= icon "magnifying-glass", aria_label: t(".search") %>
34
- </button>
35
- </div>
36
- </div>
37
- </div>
38
- <% end %>
39
- </div>
40
- </div>
41
-
42
- <div class="card" id="initiatives">
1
+ <div class="card with-overflow" id="initiatives">
43
2
  <div class="card-divider">
44
3
  <h2 class="card-title">
45
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>
46
8
  </h2>
47
9
  </div>
10
+ <%= admin_filter_selector(:initiatives) %>
48
11
  <div class="card-section">
49
12
  <div class="table-scroll">
50
13
  <table class="table-list">
@@ -53,8 +16,9 @@
53
16
  <th><%= t("models.initiatives.fields.id", scope: "decidim.admin") %></th>
54
17
  <th><%= t("models.initiatives.fields.title", scope: "decidim.admin") %></th>
55
18
  <th><%= t("models.initiatives.fields.state", scope: "decidim.admin") %></th>
56
- <th><%= t("models.initiatives.fields.supports_count", scope: "decidim.admin") %></th>
57
- <th><%= t("models.initiatives.fields.created_at", scope: "decidim.admin") %></th>
19
+ <th><%= sort_link(query, :supports_count, t("models.initiatives.fields.supports_count", scope: "decidim.admin"), default_order: :desc) %></th>
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>
58
22
  <th class="actions"><%= t ".actions_title" %></th>
59
23
  </tr>
60
24
  </thead>
@@ -73,6 +37,7 @@
73
37
  <td><%= humanize_admin_state initiative.state %></td>
74
38
  <td><%= initiative.supports_count %>/<%= initiative.scoped_type.supports_required %></td>
75
39
  <td><%= l initiative.created_at, format: :short %></td>
40
+ <td><%= initiative.published_at? ? l(initiative.published_at, format: :short) : "" %></td>
76
41
  <td class="table-list__actions">
77
42
  <% if allowed_to? :preview, :initiative, initiative: initiative %>
78
43
  <%= icon_link_to "eye",
@@ -92,7 +57,7 @@
92
57
  <% if allowed_to?(:answer, :initiative, initiative: initiative) %>
93
58
  <%= icon_link_to "comment-square", edit_initiative_answer_path(initiative.slug), t("actions.answer", scope: "decidim.initiatives"), class: "action-icon action-icon--answer" %>
94
59
  <% else %>
95
- <%= 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 %>
96
61
  <% end %>
97
62
 
98
63
  <% if allowed_to? :read, :initiative, initiative: initiative %>
@@ -12,14 +12,50 @@
12
12
  <%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
13
13
  </div>
14
14
 
15
+ <div class="row">
16
+ <div class="columns xlarge-6">
17
+ <%= form.upload :banner_image %>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+
23
+ <div class="card">
24
+ <div class="card-divider">
25
+ <h2 class="card-title"><%= t ".options" %></h2>
26
+ </div>
27
+
28
+ <div class="card-section">
15
29
  <div class="row column">
16
30
  <%= form.select :signature_type, form.object.signature_type_options %>
17
31
  </div>
18
32
 
33
+ <div class="row column">
34
+ <%= form.check_box :attachments_enabled %>
35
+ </div>
36
+
19
37
  <div class="row column">
20
38
  <%= form.check_box :undo_online_signatures_enabled %>
21
39
  </div>
22
40
 
41
+ <div class="row column">
42
+ <%= form.check_box :custom_signature_end_date_enabled %>
43
+ </div>
44
+
45
+ <div class="row column">
46
+ <%= form.check_box :area_enabled %>
47
+ </div>
48
+
49
+ <div class="row column">
50
+ <%= form.check_box :child_scope_threshold_enabled %>
51
+ <p class="help-text"><%== t(".child_scope_threshold_enabled_help") %></p>
52
+ </div>
53
+
54
+ <div class="row column">
55
+ <%= form.check_box :only_global_scope_enabled %>
56
+ <p class="help-text"><%== t(".only_global_scope_enabled_help") %></p>
57
+ </div>
58
+
23
59
  <div class="row column" id="promoting-committee-details">
24
60
  <%= form.check_box :promoting_committee_enabled %>
25
61
 
@@ -35,13 +71,15 @@
35
71
  <div class="row column">
36
72
  <%= form.translated :editor, :extra_fields_legal_information %>
37
73
  </div>
74
+ </div>
75
+ </div>
38
76
 
39
- <% if current_organization.available_authorizations.include? "sms" %>
40
- <div class="row column">
41
- <%= form.check_box :validate_sms_code_on_votes %>
42
- </div>
43
- <% end %>
77
+ <div class="card">
78
+ <div class="card-divider">
79
+ <h2 class="card-title"><%= t ".authorizations" %></h2>
80
+ </div>
44
81
 
82
+ <div class="card-section">
45
83
  <div class="row column">
46
84
  <%=
47
85
  form.select(
@@ -52,12 +90,11 @@
52
90
  %>
53
91
  </div>
54
92
 
55
- <div class="row">
56
- <div class="columns xlarge-6">
57
- <%= form.upload :banner_image %>
93
+ <% if current_organization.available_authorizations.include? "sms" %>
94
+ <div class="row column">
95
+ <%= form.check_box :validate_sms_code_on_votes %>
58
96
  </div>
59
- </div>
60
-
97
+ <% end %>
61
98
  </div>
62
99
  </div>
63
100