decidim-admin 0.20.0 → 0.23.1.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/app/assets/javascripts/decidim/admin/application.js.es6 +8 -0
  4. data/app/assets/javascripts/decidim/admin/budget_rule_toggler.component.js.es6 +52 -0
  5. data/app/assets/javascripts/decidim/admin/bundle.js +26 -32
  6. data/app/assets/javascripts/decidim/admin/bundle.js.map +1 -1
  7. data/app/assets/javascripts/decidim/admin/choose_language.js +12 -0
  8. data/app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6 +24 -5
  9. data/app/assets/javascripts/decidim/admin/form.js.es6 +24 -10
  10. data/app/assets/javascripts/decidim/admin/gallery.js.es6 +5 -0
  11. data/app/assets/javascripts/decidim/admin/newsletters.js.es6 +12 -0
  12. data/app/assets/javascripts/decidim/admin/officializations.js.es6 +20 -0
  13. data/app/assets/javascripts/decidim/admin/scope_picker_enabler.component.js.es6 +14 -0
  14. data/app/assets/stylesheets/decidim/admin/_decidim.scss +2 -0
  15. data/app/assets/stylesheets/decidim/admin/_variables.scss +2 -2
  16. data/app/assets/stylesheets/decidim/admin/extra/_action-icon.scss +6 -0
  17. data/app/assets/stylesheets/decidim/admin/extra/_cards.scss +11 -0
  18. data/app/assets/stylesheets/decidim/admin/extra/_newsletter-templates-gallery.scss +3 -0
  19. data/app/assets/stylesheets/decidim/admin/extra/_organization-appearance.scss +141 -0
  20. data/app/assets/stylesheets/decidim/admin/extra/_show_email.scss +31 -0
  21. data/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +4 -0
  22. data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +15 -1
  23. data/app/assets/stylesheets/decidim/admin/modules/_callouts.scss +11 -0
  24. data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +13 -2
  25. data/app/assets/stylesheets/decidim/admin/modules/_filters.scss +78 -1
  26. data/app/assets/stylesheets/decidim/admin/modules/_forms.scss +16 -2
  27. data/app/assets/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
  28. data/app/assets/stylesheets/decidim/admin/modules/_layout.scss +1 -1
  29. data/app/assets/stylesheets/decidim/admin/modules/_loading-spinner.scss +19 -0
  30. data/app/assets/stylesheets/decidim/admin/modules/_main-nav.scss +0 -1
  31. data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +5 -1
  32. data/app/assets/stylesheets/decidim/admin/modules/_process-header.scss +0 -1
  33. data/app/assets/stylesheets/decidim/admin/modules/_secondary-nav.scss +5 -2
  34. data/app/assets/stylesheets/decidim/admin/modules/_table-list.scss +23 -7
  35. data/app/assets/stylesheets/decidim/admin/modules/_tabs.scss +7 -0
  36. data/app/assets/stylesheets/decidim/admin/modules/_users_statistics.scss +18 -0
  37. data/app/assets/stylesheets/decidim/admin/utils/_mixins.scss +42 -0
  38. data/app/assets/stylesheets/decidim/admin/utils/_settings.scss +4 -1
  39. data/app/cells/decidim/admin/content_block/show.erb +2 -2
  40. data/app/cells/decidim/admin/results_per_page/show.erb +16 -0
  41. data/app/cells/decidim/admin/results_per_page_cell.rb +14 -0
  42. data/app/commands/decidim/admin/create_attachment.rb +2 -2
  43. data/app/commands/decidim/admin/create_newsletter.rb +34 -9
  44. data/app/commands/decidim/admin/deliver_newsletter.rb +1 -1
  45. data/app/commands/decidim/admin/destroy_share_token.rb +46 -0
  46. data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
  47. data/app/commands/decidim/admin/update_component.rb +27 -3
  48. data/app/commands/decidim/admin/update_content_block.rb +25 -1
  49. data/app/commands/decidim/admin/update_newsletter.rb +31 -9
  50. data/app/commands/decidim/admin/update_organization.rb +15 -1
  51. data/app/commands/decidim/admin/update_organization_appearance.rb +3 -1
  52. data/app/controllers/concerns/decidim/admin/filterable.rb +152 -0
  53. data/app/controllers/concerns/decidim/admin/officializations/filterable.rb +31 -0
  54. data/app/controllers/concerns/decidim/admin/paginable.rb +20 -0
  55. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +8 -2
  56. data/app/controllers/decidim/admin/admin_terms_controller.rb +20 -0
  57. data/app/controllers/decidim/admin/application_controller.rb +3 -0
  58. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +6 -0
  59. data/app/controllers/decidim/admin/components/base_controller.rb +5 -1
  60. data/app/controllers/decidim/admin/components_controller.rb +30 -23
  61. data/app/controllers/decidim/admin/concerns/has_private_users.rb +4 -0
  62. data/app/controllers/decidim/admin/dashboard_controller.rb +33 -1
  63. data/app/controllers/decidim/admin/metrics_controller.rb +22 -0
  64. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +41 -0
  65. data/app/controllers/decidim/admin/newsletters_controller.rb +43 -4
  66. data/app/controllers/decidim/admin/officializations_controller.rb +15 -6
  67. data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -0
  68. data/app/controllers/decidim/admin/organization_controller.rb +4 -3
  69. data/app/controllers/decidim/admin/organization_homepage_content_blocks_controller.rb +2 -1
  70. data/app/controllers/decidim/admin/share_tokens_controller.rb +30 -0
  71. data/app/forms/decidim/admin/attachment_form.rb +3 -0
  72. data/app/forms/decidim/admin/component_form.rb +5 -22
  73. data/app/forms/decidim/admin/newsletter_form.rb +15 -3
  74. data/app/forms/decidim/admin/organization_appearance_form.rb +7 -4
  75. data/app/forms/decidim/admin/organization_form.rb +27 -0
  76. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +14 -0
  77. data/app/forms/decidim/admin/participatory_space_private_user_form.rb +8 -2
  78. data/app/frontend/components/autocomplete.component.test.tsx +2 -1
  79. data/app/frontend/components/autocomplete.component.tsx +29 -0
  80. data/app/helpers/decidim/admin/admin_terms_helper.rb +47 -0
  81. data/app/helpers/decidim/admin/application_helper.rb +2 -0
  82. data/app/helpers/decidim/admin/dashboard_helper.rb +25 -0
  83. data/app/helpers/decidim/admin/filterable_helper.rb +129 -0
  84. data/app/helpers/decidim/admin/icon_link_helper.rb +1 -1
  85. data/app/helpers/decidim/admin/newsletters_helper.rb +20 -0
  86. data/app/helpers/decidim/admin/paginable/per_page_helper.rb +22 -0
  87. data/app/helpers/decidim/admin/resource_scope_helper.rb +43 -0
  88. data/app/helpers/decidim/admin/scopes_helper.rb +6 -0
  89. data/app/helpers/decidim/admin/settings_helper.rb +56 -47
  90. data/app/helpers/decidim/admin/uploader_image_dimensions_helper.rb +30 -0
  91. data/app/helpers/decidim/admin/user_roles_helper.rb +19 -0
  92. data/app/models/decidim/admin/fake_newsletter.rb +49 -0
  93. data/app/permissions/decidim/admin/permissions.rb +30 -7
  94. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +57 -0
  95. data/app/queries/decidim/admin/active_users_counter.rb +35 -0
  96. data/app/queries/decidim/admin/newsletter_recipients.rb +20 -9
  97. data/app/views/decidim/admin/admin_terms/show.html.erb +26 -0
  98. data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
  99. data/app/views/decidim/admin/authorization_workflows/index.html.erb +1 -0
  100. data/app/views/decidim/admin/categories/index.html.erb +1 -1
  101. data/app/views/decidim/admin/components/_component.html.erb +40 -33
  102. data/app/views/decidim/admin/components/_form.html.erb +4 -0
  103. data/app/views/decidim/admin/components/_settings_fields.html.erb +2 -2
  104. data/app/views/decidim/admin/components/index.html.erb +11 -8
  105. data/app/views/decidim/admin/dashboard/show.html.erb +49 -9
  106. data/app/views/decidim/admin/exports/_dropdown.html.erb +6 -2
  107. data/app/views/decidim/admin/impersonatable_users/index.html.erb +2 -2
  108. data/app/views/decidim/admin/metrics/_metrics.html.erb +21 -0
  109. data/app/views/decidim/admin/metrics/index.html.erb +7 -0
  110. data/app/views/decidim/admin/newsletter_templates/index.html.erb +28 -0
  111. data/app/views/decidim/admin/newsletter_templates/show.html.erb +12 -0
  112. data/app/views/decidim/admin/newsletters/_form.html.erb +1 -7
  113. data/app/views/decidim/admin/newsletters/edit.html.erb +1 -1
  114. data/app/views/decidim/admin/newsletters/index.html.erb +9 -3
  115. data/app/views/decidim/admin/newsletters/new.html.erb +1 -1
  116. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +4 -4
  117. data/app/views/decidim/admin/officializations/_show_email_modal.html.erb +31 -0
  118. data/app/views/decidim/admin/officializations/index.html.erb +9 -41
  119. data/app/views/decidim/admin/officializations/show_email.html.erb +2 -0
  120. data/app/views/decidim/admin/organization/_form.html.erb +37 -0
  121. data/app/views/decidim/admin/organization_appearance/_form.html.erb +2 -72
  122. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +23 -0
  123. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +38 -0
  124. data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +46 -0
  125. data/app/views/decidim/admin/resource_permissions/_options_form.html.erb +1 -1
  126. data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +57 -0
  127. data/app/views/decidim/admin/shared/_filters.html.erb +40 -0
  128. data/app/views/decidim/admin/shared/_gallery.html.erb +21 -0
  129. data/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
  130. data/app/views/decidim/admin/user_groups/index.html.erb +4 -4
  131. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +39 -0
  132. data/app/views/layouts/decidim/admin/_application.html.erb +2 -1
  133. data/app/views/layouts/decidim/admin/_header.html.erb +3 -0
  134. data/app/views/layouts/decidim/admin/_title_bar.html.erb +20 -10
  135. data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
  136. data/config/locales/am-ET.yml +1 -0
  137. data/config/locales/ar.yml +57 -49
  138. data/config/locales/bg-BG.yml +16 -0
  139. data/config/locales/bg.yml +135 -0
  140. data/config/locales/ca.yml +130 -50
  141. data/config/locales/cs.yml +184 -104
  142. data/config/locales/da-DK.yml +1 -0
  143. data/config/locales/da.yml +1 -0
  144. data/config/locales/de.yml +145 -47
  145. data/config/locales/el-GR.yml +1 -0
  146. data/config/locales/el.yml +819 -0
  147. data/config/locales/en.yml +127 -48
  148. data/config/locales/eo-UY.yml +0 -1
  149. data/config/locales/eo.yml +51 -0
  150. data/config/locales/es-MX.yml +128 -48
  151. data/config/locales/es-PY.yml +128 -48
  152. data/config/locales/es.yml +128 -48
  153. data/config/locales/et-EE.yml +1 -0
  154. data/config/locales/et.yml +1 -0
  155. data/config/locales/eu.yml +21 -47
  156. data/config/locales/fi-plain.yml +128 -48
  157. data/config/locales/fi.yml +141 -61
  158. data/config/locales/fr-CA.yml +849 -0
  159. data/config/locales/fr.yml +128 -48
  160. data/config/locales/ga-IE.yml +1 -0
  161. data/config/locales/gl.yml +21 -47
  162. data/config/locales/hr-HR.yml +1 -0
  163. data/config/locales/hr.yml +1 -0
  164. data/config/locales/hu.yml +112 -59
  165. data/config/locales/id-ID.yml +21 -47
  166. data/config/locales/is-IS.yml +534 -0
  167. data/config/locales/is.yml +568 -0
  168. data/config/locales/it.yml +133 -83
  169. data/config/locales/ja-JP.yml +855 -0
  170. data/config/locales/ja.yml +849 -0
  171. data/config/locales/ko-KR.yml +1 -0
  172. data/config/locales/ko.yml +1 -0
  173. data/config/locales/lt-LT.yml +1 -0
  174. data/config/locales/lt.yml +1 -0
  175. data/config/locales/lv.yml +799 -0
  176. data/config/locales/mt-MT.yml +1 -0
  177. data/config/locales/mt.yml +1 -0
  178. data/config/locales/nl.yml +103 -48
  179. data/config/locales/no.yml +603 -32
  180. data/config/locales/om-ET.yml +1 -0
  181. data/config/locales/pl.yml +364 -238
  182. data/config/locales/pt-BR.yml +22 -48
  183. data/config/locales/pt.yml +334 -237
  184. data/config/locales/ro-RO.yml +814 -0
  185. data/config/locales/ru.yml +20 -46
  186. data/config/locales/sk-SK.yml +823 -0
  187. data/config/locales/sk.yml +806 -0
  188. data/config/locales/sl.yml +166 -0
  189. data/config/locales/so-SO.yml +1 -0
  190. data/config/locales/sr-CS.yml +590 -0
  191. data/config/locales/sv.yml +134 -55
  192. data/config/locales/ti-ER.yml +1 -0
  193. data/config/locales/tr-TR.yml +21 -47
  194. data/config/locales/uk.yml +19 -48
  195. data/config/locales/vi-VN.yml +1 -0
  196. data/config/locales/vi.yml +1 -0
  197. data/config/locales/zh-CN.yml +849 -0
  198. data/config/locales/zh-TW.yml +1 -0
  199. data/config/routes.rb +20 -3
  200. data/db/migrate/20191118112040_add_accepted_admin_terms_at_field_to_users.rb +7 -0
  201. data/lib/decidim/admin.rb +17 -0
  202. data/lib/decidim/admin/engine.rb +12 -9
  203. data/lib/decidim/admin/form_builder.rb +7 -2
  204. data/lib/decidim/admin/test.rb +2 -0
  205. data/lib/decidim/admin/test/filterable_examples.rb +129 -0
  206. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +1 -1
  207. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +15 -15
  208. data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +22 -0
  209. data/lib/decidim/admin/version.rb +1 -1
  210. data/vendor/assets/javascripts/jquery.serializejson.js +344 -0
  211. metadata +101 -31
  212. data/app/commands/decidim/admin/create_oauth_application.rb +0 -36
  213. data/app/commands/decidim/admin/destroy_oauth_application.rb +0 -39
  214. data/app/commands/decidim/admin/update_oauth_application.rb +0 -39
  215. data/app/controllers/decidim/admin/oauth_applications_controller.rb +0 -90
  216. data/app/forms/decidim/admin/oauth_application_form.rb +0 -32
  217. data/app/views/decidim/admin/oauth_applications/_form.html.erb +0 -19
  218. data/app/views/decidim/admin/oauth_applications/edit.html.erb +0 -13
  219. data/app/views/decidim/admin/oauth_applications/index.html.erb +0 -40
  220. data/app/views/decidim/admin/oauth_applications/new.html.erb +0 -13
  221. data/app/views/decidim/admin/oauth_applications/show.html.erb +0 -27
@@ -5,15 +5,22 @@ module Decidim
5
5
  # A class used to find the recipients of the
6
6
  # Newsletter depending on the params of the form
7
7
  class NewsletterRecipients < Rectify::Query
8
- # newsletter - the Newsletter that will be send and needs to be selected the recipients.
8
+ # Syntactic sugar to initialize the class and return the queried objects.
9
+ #
9
10
  # form - params to filter the query
10
- def initialize(newsletter, form)
11
- @newsletter = newsletter
11
+ def self.for(form)
12
+ new(form).query
13
+ end
14
+
15
+ # Initializes the class.
16
+ #
17
+ # form - params to filter the query
18
+ def initialize(form)
12
19
  @form = form
13
20
  end
14
21
 
15
22
  def query
16
- recipients = Decidim::User.where(organization: @newsletter.organization)
23
+ recipients = Decidim::User.where(organization: @form.current_organization)
17
24
  .where.not(newsletter_notifications_at: nil, email: nil, confirmed_at: nil)
18
25
  .not_deleted
19
26
 
@@ -39,7 +46,7 @@ module Decidim
39
46
  def spaces
40
47
  return if @form.participatory_space_types.blank?
41
48
 
42
- @form.participatory_space_types.map do |type|
49
+ @spaces ||= @form.participatory_space_types.map do |type|
43
50
  next if type.ids.blank?
44
51
 
45
52
  object_class = "Decidim::#{type.manifest_name.classify}"
@@ -68,20 +75,24 @@ module Decidim
68
75
 
69
76
  participant_ids = []
70
77
  spaces.each do |space|
78
+ next unless defined? space.component_ids
79
+
71
80
  available_components = Decidim.component_manifests.map { |m| m.name.to_s if m.newsletter_participant_entities.present? }.compact
72
81
  Decidim::Component.where(id: space.component_ids, manifest_name: available_components).published.each do |component|
73
82
  Decidim.find_component_manifest(component.manifest_name).try(&:newsletter_participant_entities).flatten.each do |object|
74
83
  klass = Object.const_get(object)
75
- participant_ids << klass.newsletter_participant_ids(component)
84
+ participant_ids |= klass.newsletter_participant_ids(component)
76
85
  end
77
86
  end
78
- next unless defined?(Decidim::Comments)
87
+ end
79
88
 
80
- Decidim::Comments.newsletter_participant_entities.flatten.each do |object|
89
+ if defined?(Decidim::Comments)
90
+ Decidim::Comments.newsletter_participant_entities.each do |object|
81
91
  klass = Object.const_get(object)
82
- participant_ids << klass.newsletter_participant_ids(space)
92
+ participant_ids |= klass.newsletter_participant_ids(spaces.first)
83
93
  end
84
94
  end
95
+
85
96
  participant_ids.flatten.compact.uniq
86
97
  end
87
98
  end
@@ -0,0 +1,26 @@
1
+ <%= cell("decidim/announcement", admin_terms_announcement_args ) %>
2
+
3
+ <article class="card">
4
+ <div class="card-section grid-x grid-margin-x">
5
+ <div class="cell medium-12">
6
+
7
+ <div class="content">
8
+ <%= admin_terms_of_use_body %>
9
+ </div>
10
+ </div>
11
+
12
+ <% unless current_user.admin_terms_accepted? %>
13
+ <h4 class="cell medium-12 text-center">
14
+ <%= t("decidim.admin.admin_terms_of_use.actions.title") %>
15
+ </h4>
16
+
17
+ <div class="cell medium-6 small-order-2 medium-order-1 text-center">
18
+ <%= button_to_refuse_admin_terms %>
19
+ </div>
20
+
21
+ <div class="cell medium-6 small-order-1 medium-order-2 text-center">
22
+ <%= button_to_accept_admin_terms %>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ </article>
@@ -34,7 +34,7 @@
34
34
  <%= icon_link_to "circle-x", polymorphic_path([collection_for, attachment_collection]), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
35
35
  <% else %>
36
36
  <span class="action-icon" title="<%= t("attachment_collections.index.attachment_collection_used", scope: "decidim.admin") %>" data-tooltip="true" data-disable-hover="false">
37
- <%= icon "circle-x", class: "action-icon action-icon--disabled" %>
37
+ <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
38
38
  </span>
39
39
  <% end %>
40
40
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <div class="card">
2
+ <%= cell("decidim/verifications/revocations", @authorizations) %>
2
3
  <div class="card-divider">
3
4
  <h2 class="card-title">
4
5
  <%= t("decidim.admin.titles.authorization_workflows") %>
@@ -34,7 +34,7 @@
34
34
  <%= icon_link_to "circle-x", category_path(current_participatory_space, category), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
35
35
  <% else %>
36
36
  <span class="action-icon" title="<%= t("categories.index.category_used", scope: "decidim.admin") %>" data-tooltip="true" data-disable-hover="false">
37
- <%= icon "circle-x", class: "action-icon action-icon--disabled" %>
37
+ <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
38
38
  </span>
39
39
  <% end %>
40
40
  <% end %>
@@ -1,39 +1,46 @@
1
- <tr class="component-<%= component.id %>">
2
- <td>
3
- <%= link_to main_component_path(component), target: "_blank" do %>
4
- <%= translated_attribute component.name %>
5
- <% end %>
6
- </td>
7
- <td>
8
- <%= t "decidim.components.#{component.manifest.name}.name" %>
9
- </td>
10
- <td class="table-list__actions">
11
- <% if component.manifest.admin_engine %>
12
- <%= icon_link_to "pencil", manage_component_path(component), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
13
- <% end %>
1
+ <% if user_role_config.component_is_accessible?(component.manifest_name) %>
2
+ <tr class="component-<%= component.id %>">
3
+ <td>
4
+ <%= link_to main_component_path(component), target: "_blank" do %>
5
+ <%= translated_attribute component.name %>
6
+ <% end %>
7
+ </td>
8
+ <td>
9
+ <%= t "decidim.components.#{component.manifest.name}.name" %>
10
+ </td>
11
+ <%= td_resource_scope_for(component.scope) %>
12
+ <td class="table-list__actions">
13
+ <% if component.manifest.admin_engine %>
14
+ <%= icon_link_to "pencil", manage_component_path(component), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
15
+ <% end %>
16
+
17
+ <% if allowed_to?(:update, :component, component: component) %>
18
+ <% if component.published? %>
19
+ <%= icon_link_to "x", url_for(action: :unpublish, id: component, controller: "components"), t("actions.unpublish", scope: "decidim.admin"), class: "action-icon--unpublish", method: :put %>
20
+ <% else %>
21
+ <%= icon_link_to "check", url_for(action: :publish, id: component, controller: "components"), t("actions.publish", scope: "decidim.admin"), class: "action-icon--publish", method: :put %>
22
+ <% end %>
23
+ <% end %>
14
24
 
15
- <% if allowed_to?(:update, :component, component: component) %>
16
- <% if component.published? %>
17
- <%= icon_link_to "x", url_for(action: :unpublish, id: component, controller: "components"), t("actions.unpublish", scope: "decidim.admin"), class: "action-icon--unpublish", method: :put %>
18
- <% else %>
19
- <%= icon_link_to "check", url_for(action: :publish, id: component, controller: "components"), t("actions.publish", scope: "decidim.admin"), class: "action-icon--publish", method: :put %>
25
+ <% if allowed_to? :update, :component, component: component %>
26
+ <%= icon_link_to "cog", url_for(action: :edit, id: component, controller: "components"), t("actions.configure", scope: "decidim.admin"), class: "action-icon--configure" %>
20
27
  <% end %>
21
- <% end %>
22
28
 
23
- <% if allowed_to? :update, :component, component: component %>
24
- <%= icon_link_to "cog", url_for(action: :edit, id: component, controller: "components"), t("actions.configure", scope: "decidim.admin"), class: "action-icon--configure" %>
25
- <% end %>
29
+ <% if allowed_to? :update, :component, component: component %>
30
+ <% if component.manifest.actions.empty? %>
31
+ <%= icon "key", class: "action-icon action-icon--disabled" %>
32
+ <% else %>
33
+ <%= icon_link_to "key", url_for(action: :edit, component_id: component, controller: "component_permissions"), t("actions.permissions", scope: "decidim.admin"), class: "action-icon--permissions" %>
34
+ <% end %>
35
+ <% end %>
26
36
 
27
- <% if allowed_to? :update, :component, component: component %>
28
- <% if component.manifest.actions.empty? %>
29
- <%= icon "key", class: "action-icon action-icon--disabled" %>
30
- <% else %>
31
- <%= icon_link_to "key", url_for(action: :edit, component_id: component, controller: "component_permissions"), t("actions.permissions", scope: "decidim.admin"), class: "action-icon--permissions" %>
37
+ <% if allowed_to? :share, :component, component: component %>
38
+ <%= icon_link_to "share", url_for(action: :share, id: component, controller: "components"), t("actions.share", scope: "decidim.admin"), class: "action-icon--share", target: "_blank" %>
32
39
  <% end %>
33
- <% end %>
34
40
 
35
- <% if allowed_to? :destroy, :component, component: component %>
36
- <%= icon_link_to "circle-x", url_for(action: :destroy, id: component, controller: "components"), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete %>
37
- <% end %>
38
- </td>
39
- </tr>
41
+ <% if allowed_to? :destroy, :component, component: component %>
42
+ <%= icon_link_to "circle-x", url_for(action: :destroy, id: component, controller: "components"), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete %>
43
+ <% end %>
44
+ </td>
45
+ </tr>
46
+ <% end %>
@@ -77,6 +77,10 @@
77
77
  </div>
78
78
  </fieldset>
79
79
  <% end %>
80
+
81
+ <% unless component.published? %>
82
+ <%= render partial: "decidim/admin/share_tokens/share_tokens", locals: { share_tokens: form.object.share_tokens } %>
83
+ <% end %>
80
84
  </div>
81
85
  </div>
82
86
  </div>
@@ -3,8 +3,8 @@
3
3
  form,
4
4
  settings_attribute,
5
5
  field_name,
6
- label: t("decidim.components.#{manifest.name}.settings.#{settings_name}.#{field_name}"),
6
+ "decidim.components.#{manifest.name}.settings.#{settings_name}",
7
7
  tabs_prefix: tabs_prefix,
8
- help_text: help_text_for_component_setting(field_name, settings_name, manifest.name)
8
+ readonly: settings_attribute.readonly?(component: @component)
9
9
  ) %>
10
10
  <% end %>
@@ -2,14 +2,16 @@
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
4
  <%= t("components.title", scope: "decidim.admin") %>
5
- <button class="dropdown tiny button button--title" data-toggle="add-component-dropdown"><%= t "components.index.add", scope: "decidim.admin" %></button>
6
- <div class="dropdown-pane" id="add-component-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
7
- <ul class="vertical menu add-components">
8
- <% @manifests.each do |manifest| %>
9
- <li><%= link_to t("#{manifest.name}.name", scope: "decidim.components"), new_component_path(type: manifest.name), class: manifest.name %></li>
10
- <% end %>
11
- </ul>
12
- </div>
5
+ <% if allowed_to?(:create, :component) %>
6
+ <button class="dropdown tiny button button--title" data-toggle="add-component-dropdown"><%= t "components.index.add", scope: "decidim.admin" %></button>
7
+ <div class="dropdown-pane" id="add-component-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
8
+ <ul class="vertical menu add-components">
9
+ <% @manifests.each do |manifest| %>
10
+ <li><%= link_to t("#{manifest.name}.name", scope: "decidim.components"), new_component_path(type: manifest.name), class: manifest.name %></li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
14
+ <% end %>
13
15
  </h2>
14
16
  </div>
15
17
 
@@ -19,6 +21,7 @@
19
21
  <thead>
20
22
  <th><%= t(".headers.name") %></th>
21
23
  <th><%= t(".headers.type") %></th>
24
+ <%= th_resource_scope_label(t(".headers.scope")) %>
22
25
  <th><%= t(".headers.actions") %></th>
23
26
  </thead>
24
27
 
@@ -1,16 +1,56 @@
1
+
1
2
  <h2 class="card-title">
2
3
  <%= t "decidim.admin.titles.dashboard" %>
3
4
  </h2>
5
+
4
6
  <div class="content">
5
7
  <p><%= t ".welcome" %></p>
6
- <% if allowed_to? :read, :admin_log %>
7
- <div class="row">
8
- <h3 class="card-title">
9
- </h3>
10
- <%= render partial: "decidim/admin/logs/logs_list", locals: { logs: latest_action_logs } %>
11
- <% if latest_action_logs.any? %>
12
- <div class="text-center"><%= link_to t(".view_more_logs"), logs_path %></div>
13
- <% end %>
14
- </div>
8
+
9
+ <% unless current_user.admin_terms_accepted? %>
10
+ <%= cell("decidim/announcement", admin_terms_announcement_args ) %>
11
+ <% end %>
12
+
13
+ <div class="grid-x grid-margin-x">
14
+ <% if current_user.admin? && current_user.organization&.id == current_organization.id %>
15
+ <div class="cell small-12 medium-6 large-4">
16
+ <%= render(
17
+ partial: "decidim/admin/users_statistics/users_count",
18
+ locals: {
19
+ result: users_counter
20
+ }
21
+ ) %>
22
+ </div>
23
+ <% end %>
24
+ </div>
25
+
26
+ <div class="grid-x grid-margin-x">
27
+ <% if allowed_to? :read, :metrics %>
28
+ <div class="cell small-6">
29
+ <%= render(
30
+ partial: "decidim/admin/metrics/metrics",
31
+ locals: {
32
+ metrics_presenter: metrics_presenter,
33
+ show_link_to_more: true
34
+ }
35
+ ) %>
36
+ </div>
37
+ <% end %>
38
+
39
+ <% if allowed_to? :read, :admin_log %>
40
+ <div class="cell small-6">
41
+ <%= render partial: "decidim/admin/logs/logs_list", locals: { logs: latest_action_logs } %>
42
+ <% if latest_action_logs.any? %>
43
+ <div class="text-center"><%= link_to t(".view_more_logs"), logs_path %></div>
44
+ <% end %>
45
+ </div>
46
+ <% end %>
47
+ </div>
48
+
49
+ <% if current_user.admin_terms_accepted? %>
50
+ <p class="text-right">
51
+ <small>
52
+ <%= link_to( t("title", scope: "decidim.admin.admin_terms_of_use"), admin_terms_show_path) %>
53
+ </small>
54
+ </p>
15
55
  <% end %>
16
56
  </div>
@@ -2,8 +2,12 @@
2
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
3
  <ul class="vertical menu add-components">
4
4
  <% component.manifest.export_manifests.each do |manifest| %>
5
- <% %w{CSV JSON Excel}.each do |format| %>
6
- <li class="exports--format--<%= format.downcase %> exports--<%= manifest.name %>"><%= link_to t("decidim.admin.exports.export_as", name: t("decidim.#{component.manifest.name}.admin.exports.#{manifest.name}"), export_format: format.upcase), exports_path(component, id: manifest.name, format: format), method: :post %></li>
5
+ <% manifest.formats.each do |format| %>
6
+ <li class="exports--format--<%= format.downcase %> exports--<%= manifest.name %>">
7
+ <%= link_to t("decidim.admin.exports.export_as", name: t("decidim.#{component.manifest.name}.admin.exports.#{manifest.name}"), export_format: t("decidim.admin.exports.formats.#{format}")),
8
+ exports_path(component, id: manifest.name, format: format),
9
+ method: :post %>
10
+ </li>
7
11
  <% end %>
8
12
  <% end %>
9
13
  </ul>
@@ -33,8 +33,8 @@
33
33
  <%= search_field_tag :q, @query,label: false, class: "input-group-field", placeholder: t(".search") %>
34
34
  <%= hidden_field_tag :state, @state %>
35
35
  <div class="input-group-button">
36
- <button type="submit" class="button button--muted">
37
- <%= icon "magnifying-glass", aria_label: t(".search") %>
36
+ <button type="submit" class="button">
37
+ <%= icon "magnifying-glass", aria_label: t(".search"), role: "img" %>
38
38
  </button>
39
39
  </div>
40
40
  </div>
@@ -0,0 +1,21 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t "decidim.admin.titles.metrics" %>
5
+ </h2>
6
+ </div>
7
+
8
+ <div class="grid-y grid-padding-y">
9
+ <div class="cell grid-x grid-padding-x">
10
+ <%= metrics_presenter.highlighted %>
11
+ </div>
12
+
13
+ <div class="cell grid-x grid-padding-x">
14
+ <%= metrics_presenter.not_highlighted %>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <% if show_link_to_more %>
20
+ <div class="text-center"><%= link_to t(".see_more_metrics"), metrics_path %></div>
21
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= render(
2
+ partial: "decidim/admin/metrics/metrics",
3
+ locals: {
4
+ metrics_presenter: metrics_presenter,
5
+ show_link_to_more: false
6
+ }
7
+ ) %>
@@ -0,0 +1,28 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t ".title" %>
5
+ </h2>
6
+ </div>
7
+
8
+ <div class="card-section">
9
+ <div class="grid-x grid-margin-x card-grid">
10
+ <% templates.each do |newsletter_template| %>
11
+ <div class="cell small-6">
12
+ <div class="card card--mini" id="<%= newsletter_template.name %>">
13
+ <iframe src="<%= preview_newsletter_template_path(newsletter_template.name) %>" class="email-preview newsletter-template-preview">
14
+ </iframe>
15
+
16
+ <div class="card-footer">
17
+ <h2 class="card-title">
18
+ <%= t newsletter_template.public_name_key %>
19
+ <%= link_to(t(".preview_template"), newsletter_template_path(newsletter_template.name), class: "button tiny button--title") %>
20
+ <%= link_to(t(".use_template"), new_newsletter_template_newsletter_path(newsletter_template.name), class: "button tiny button--title") %>
21
+ </h2>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <% end %>
26
+ </div>
27
+ </div>
28
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= t ".preview", template_name: t(template_manifest.public_name_key) %></h2>
4
+ </div>
5
+ <div class="card-section">
6
+ <iframe src="<%= preview_newsletter_template_path(template_manifest.name) %>" class="email-preview">
7
+ </iframe>
8
+ </div>
9
+ </div>
10
+ <div class="button--double form-general-submit">
11
+ <%= link_to(t(".use_template"), new_newsletter_template_newsletter_path(template_manifest.name), class: "button") %>
12
+ </div>
@@ -2,10 +2,4 @@
2
2
  <%= form.translated :text_field, :subject %>
3
3
  </div>
4
4
 
5
- <div class="row column">
6
- <%= form.translated :editor, :body, toolbar: "basic-no-video" %>
7
- </div>
8
-
9
- <div class="row column">
10
- <%= t(".interpolations_hint") %>
11
- </div>
5
+ <%= cell content_block.settings_form_cell, form, content_block: content_block %>
@@ -1,4 +1,4 @@
1
- <%= decidim_form_for(@form, html: { class: "form edit_newsletter" }) do |f| %>
1
+ <%= decidim_form_for(@form, html: { class: "form edit_newsletter" }, url: newsletter_path(newsletter)) do |f| %>
2
2
  <div class="card">
3
3
  <div class="card-divider">
4
4
  <h2 class="card-title"><%= t ".title" %></h2>
@@ -2,10 +2,16 @@
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
4
  <%= t ".title" %>
5
- <% if allowed_to? :create, :newsletter %>
6
- <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.newsletter.name", scope: "decidim.admin").downcase), ["new", "newsletter"], class: "button tiny button--title new" %>
7
- <% end %>
8
5
  </h2>
6
+ <div class="card-title">
7
+ <div class="text-right">
8
+ <strong class="subscribed_title"><%= t("newsletters.index.subscribed_count", scope: "decidim.admin") %></strong>
9
+ <span class="subscribed_count"><%= recipients_count_query %></span>
10
+ <% if allowed_to? :create, :newsletter %>
11
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.newsletter.name", scope: "decidim.admin").downcase), ["newsletter_templates"], class: "button tiny button--title new" %>
12
+ <% end %>
13
+ </div>
14
+ </div>
9
15
  </div>
10
16
  <div class="card-section">
11
17
  <div class="table-scroll">