decidim-core 0.20.1 → 0.21.0

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

Potentially problematic release.


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

Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/fonts/decidim/Roboto-Regular.eot +0 -0
  3. data/app/assets/fonts/decidim/Roboto-Regular.svg +10520 -0
  4. data/app/assets/fonts/decidim/Roboto-Regular.ttf +0 -0
  5. data/app/assets/fonts/decidim/Roboto-Regular.woff +0 -0
  6. data/app/assets/fonts/decidim/Roboto-Regular.woff2 +0 -0
  7. data/app/assets/images/decidim/brands/google.svg +1 -0
  8. data/app/assets/javascripts/decidim.js.es6 +5 -0
  9. data/app/assets/javascripts/decidim/check_boxes_tree.js.es6 +190 -0
  10. data/app/assets/javascripts/decidim/core/bundle.js +1 -1
  11. data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
  12. data/app/assets/javascripts/decidim/delayed.js.es6 +26 -0
  13. data/app/assets/javascripts/decidim/diff_mode_dropdown.js.es6 +25 -4
  14. data/app/assets/javascripts/decidim/form_filter.component.js.es6 +86 -38
  15. data/app/assets/javascripts/decidim/form_filter.component.test.js +40 -6
  16. data/app/assets/javascripts/decidim/history.js.es6 +16 -1
  17. data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +1 -1
  18. data/app/assets/stylesheets/decidim/_variables.scss +1 -1
  19. data/app/assets/stylesheets/decidim/extras/_results-per-page.scss +0 -1
  20. data/app/assets/stylesheets/decidim/modules/_buttons.scss +76 -3
  21. data/app/assets/stylesheets/decidim/modules/_comments.scss +78 -2
  22. data/app/assets/stylesheets/decidim/modules/_filters.scss +36 -2
  23. data/app/assets/stylesheets/decidim/modules/_layout.scss +13 -0
  24. data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -0
  25. data/app/assets/stylesheets/decidim/modules/_navbar.scss +11 -5
  26. data/app/assets/stylesheets/decidim/modules/_process-stats.scss +53 -0
  27. data/app/assets/stylesheets/decidim/modules/_status-labels.scss +5 -0
  28. data/app/assets/stylesheets/decidim/modules/_tags.scss +7 -1
  29. data/app/assets/stylesheets/decidim/modules/_typography.scss +49 -4
  30. data/app/assets/stylesheets/decidim/utils/_fontface.scss +10 -0
  31. data/app/assets/stylesheets/decidim/utils/_toggle-expand.scss +14 -0
  32. data/app/cells/decidim/activity/show.erb +1 -1
  33. data/app/cells/decidim/author/profile_inline.erb +2 -2
  34. data/app/cells/decidim/diff/attribute.erb +15 -5
  35. data/app/cells/decidim/diff/diff_mode_html.erb +31 -0
  36. data/app/cells/decidim/diff/diff_split.erb +1 -1
  37. data/app/cells/decidim/diff/diff_unified.erb +1 -1
  38. data/app/cells/decidim/diff/show.erb +1 -0
  39. data/app/cells/decidim/diff_cell.rb +21 -8
  40. data/app/cells/decidim/follow_button/show.erb +20 -7
  41. data/app/cells/decidim/navbar_admin_link/show.erb +6 -0
  42. data/app/cells/decidim/navbar_admin_link_cell.rb +43 -0
  43. data/app/cells/decidim/tags_cell.rb +2 -2
  44. data/app/commands/decidim/amendable/accept.rb +9 -4
  45. data/app/commands/decidim/amendable/publish_draft.rb +5 -0
  46. data/app/commands/decidim/amendable/reject.rb +5 -0
  47. data/app/commands/decidim/amendable/withdraw.rb +3 -12
  48. data/app/commands/decidim/create_registration.rb +5 -6
  49. data/app/controllers/concerns/decidim/use_organization_time_zone.rb +32 -0
  50. data/app/controllers/decidim/application_controller.rb +3 -0
  51. data/app/controllers/decidim/components/base_controller.rb +1 -0
  52. data/app/controllers/decidim/data_portability_controller.rb +12 -19
  53. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -1
  54. data/app/controllers/decidim/devise/registrations_controller.rb +1 -0
  55. data/app/controllers/decidim/scopes_controller.rb +41 -7
  56. data/app/forms/decidim/registration_form.rb +5 -0
  57. data/app/functions/decidim/core/component_finder_base.rb +33 -0
  58. data/app/functions/decidim/core/component_list.rb +38 -0
  59. data/app/functions/decidim/core/component_list_base.rb +61 -0
  60. data/app/functions/decidim/core/needs_api_filter_and_order.rb +52 -0
  61. data/app/functions/decidim/core/participatory_space_finder.rb +11 -0
  62. data/app/functions/decidim/core/participatory_space_finder_base.rb +29 -0
  63. data/app/functions/decidim/core/participatory_space_list.rb +11 -0
  64. data/app/functions/decidim/core/participatory_space_list_base.rb +34 -0
  65. data/app/helpers/decidim/amendments_helper.rb +27 -1
  66. data/app/helpers/decidim/application_helper.rb +31 -3
  67. data/app/helpers/decidim/categories_helper.rb +26 -0
  68. data/app/helpers/decidim/check_boxes_tree_helper.rb +115 -0
  69. data/app/helpers/decidim/omniauth_helper.rb +6 -13
  70. data/app/helpers/decidim/resource_versions_helper.rb +29 -0
  71. data/app/helpers/decidim/rich_text_editor_helper.rb +22 -0
  72. data/app/helpers/decidim/sanitize_helper.rb +3 -1
  73. data/app/helpers/decidim/scopes_helper.rb +3 -2
  74. data/app/jobs/decidim/data_portability_export_job.rb +18 -10
  75. data/app/jobs/decidim/export_job.rb +1 -1
  76. data/app/mailers/decidim/export_mailer.rb +9 -5
  77. data/app/models/decidim/omniauth_provider.rb +28 -0
  78. data/app/models/decidim/organization.rb +41 -0
  79. data/app/models/decidim/participatory_space_role_config/admin.rb +8 -0
  80. data/app/models/decidim/participatory_space_role_config/base.rb +31 -0
  81. data/app/models/decidim/participatory_space_role_config/collaborator.rb +8 -0
  82. data/app/models/decidim/participatory_space_role_config/moderator.rb +11 -0
  83. data/app/models/decidim/participatory_space_role_config/null_object.rb +11 -0
  84. data/app/models/decidim/participatory_space_role_config/participatory_space_admin.rb +8 -0
  85. data/app/models/decidim/participatory_space_role_config/valuator.rb +11 -0
  86. data/app/models/decidim/scope.rb +4 -2
  87. data/app/models/decidim/user.rb +19 -3
  88. data/app/presenters/decidim/home_stats_presenter.rb +5 -2
  89. data/app/presenters/decidim/resource_locator_presenter.rb +9 -0
  90. data/app/serializers/decidim/exporters/participatory_space_components_serializer.rb +1 -1
  91. data/app/serializers/decidim/importers/participatory_space_components_importer.rb +14 -5
  92. data/app/services/decidim/data_portability_exporter.rb +72 -0
  93. data/app/services/decidim/resource_search.rb +29 -13
  94. data/app/services/decidim/zip_stream/zip_stream_writer.rb +56 -0
  95. data/app/types/decidim/core/amendment_type.rb +26 -0
  96. data/app/types/decidim/core/area_api_type.rb +16 -0
  97. data/app/types/decidim/core/area_type_type.rb +14 -0
  98. data/app/types/decidim/core/base_input_filter.rb +8 -0
  99. data/app/types/decidim/core/base_input_sort.rb +22 -0
  100. data/app/types/decidim/core/component_input_filter.rb +50 -0
  101. data/app/types/decidim/core/component_input_sort.rb +32 -0
  102. data/app/types/decidim/core/fingerprint_type.rb +15 -0
  103. data/app/types/decidim/core/has_hastaggable_input_filter.rb +15 -0
  104. data/app/types/decidim/core/has_localized_input_filter.rb +21 -0
  105. data/app/types/decidim/core/has_localized_input_sort.rb +21 -0
  106. data/app/types/decidim/core/has_publishable_input_filter.rb +34 -0
  107. data/app/types/decidim/core/has_publishable_input_sort.rb +13 -0
  108. data/app/types/decidim/core/participatory_space_input_filter.rb +26 -0
  109. data/app/types/decidim/core/participatory_space_input_sort.rb +14 -0
  110. data/app/types/decidim/core/participatory_space_link_type.rb +24 -0
  111. data/app/types/decidim/core/trace_version_type.rb +29 -0
  112. data/app/uploaders/decidim/data_portability_uploader.rb +2 -7
  113. data/app/validators/time_zone_validator.rb +10 -0
  114. data/app/views/decidim/amendments/_edit_form_fields.html.erb +5 -13
  115. data/app/views/decidim/amendments/preview_draft.html.erb +1 -1
  116. data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +10 -12
  117. data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +6 -8
  118. data/app/views/decidim/export_mailer/data_portability_export.html.erb +2 -2
  119. data/app/views/decidim/scopes/picker.html.erb +7 -3
  120. data/app/views/decidim/shared/_check_boxes_tree.html.erb +54 -0
  121. data/app/views/decidim/shared/_extended_navigation_bar.html.erb +1 -1
  122. data/app/views/decidim/widgets/show.html.erb +4 -0
  123. data/app/views/layouts/decidim/_admin_links.html.erb +2 -0
  124. data/app/views/layouts/decidim/_wrapper.html.erb +4 -3
  125. data/app/views/layouts/decidim/widget.html.erb +1 -43
  126. data/config/initializers/browser.rb +5 -0
  127. data/config/initializers/devise.rb +0 -22
  128. data/config/initializers/omniauth.rb +50 -0
  129. data/config/locales/ar.yml +6 -3
  130. data/config/locales/ca.yml +15 -6
  131. data/config/locales/cs.yml +12 -3
  132. data/config/locales/de.yml +5 -3
  133. data/config/locales/el-GR.yml +0 -2
  134. data/config/locales/el.yml +153 -0
  135. data/config/locales/en.yml +16 -7
  136. data/config/locales/eo-UY.yml +2 -2
  137. data/config/locales/es-MX.yml +12 -3
  138. data/config/locales/es-PY.yml +12 -3
  139. data/config/locales/es.yml +15 -6
  140. data/config/locales/eu.yml +4 -3
  141. data/config/locales/fi-plain.yml +12 -3
  142. data/config/locales/fi.yml +12 -3
  143. data/config/locales/fr.yml +5 -3
  144. data/config/locales/gl.yml +4 -3
  145. data/config/locales/hu.yml +12 -3
  146. data/config/locales/id-ID.yml +4 -3
  147. data/config/locales/it.yml +11 -3
  148. data/config/locales/nl.yml +8 -3
  149. data/config/locales/no.yml +12 -3
  150. data/config/locales/pl.yml +4 -3
  151. data/config/locales/pt-BR.yml +4 -3
  152. data/config/locales/pt.yml +4 -3
  153. data/config/locales/ru.yml +5 -3
  154. data/config/locales/sv.yml +5 -3
  155. data/config/locales/tr-TR.yml +4 -3
  156. data/config/locales/uk.yml +1 -3
  157. data/db/migrate/20191113092826_add_omniauth_settings_to_decidim_organization.rb +7 -0
  158. data/db/migrate/20191113144432_add_rich_text_editor_in_public_views_to_organizations.rb +10 -0
  159. data/db/migrate/20191118123154_add_admin_terms_of_use_body_field_to_organization.rb +9 -0
  160. data/db/migrate/20200107142226_add_organization_timezone.rb +7 -0
  161. data/db/seeds.rb +2 -1
  162. data/lib/decidim/amendable.rb +7 -4
  163. data/lib/decidim/api/amendable_entity_interface.rb +18 -0
  164. data/lib/decidim/api/amendable_interface.rb +18 -0
  165. data/lib/decidim/api/attachable_interface.rb +1 -1
  166. data/lib/decidim/api/categorizable_interface.rb +1 -1
  167. data/lib/decidim/api/coauthorable_interface.rb +29 -0
  168. data/lib/decidim/api/fingerprint_interface.rb +13 -0
  169. data/lib/decidim/api/participatory_space_interface.rb +9 -9
  170. data/lib/decidim/api/participatory_space_resourceable_interface.rb +21 -0
  171. data/lib/decidim/api/scopable_interface.rb +1 -1
  172. data/lib/decidim/api/timestamps_interface.rb +21 -0
  173. data/lib/decidim/api/traceable_interface.rb +14 -0
  174. data/lib/decidim/coauthorable.rb +9 -2
  175. data/lib/decidim/component_manifest.rb +1 -1
  176. data/lib/decidim/content_processor.rb +4 -2
  177. data/lib/decidim/content_renderers/link_renderer.rb +1 -1
  178. data/lib/decidim/core.rb +3 -3
  179. data/lib/decidim/core/api.rb +7 -0
  180. data/lib/decidim/core/test.rb +1 -0
  181. data/lib/decidim/core/test/factories.rb +16 -0
  182. data/lib/decidim/core/test/shared_examples/amendable_interface_examples.rb +14 -0
  183. data/lib/decidim/core/test/shared_examples/amendable_proposals_interface_examples.rb +50 -0
  184. data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +3 -0
  185. data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +60 -0
  186. data/lib/decidim/core/test/shared_examples/comments_examples.rb +8 -8
  187. data/lib/decidim/core/test/shared_examples/fingerprintable_interface_examples.rb +17 -0
  188. data/lib/decidim/core/test/shared_examples/follows_examples.rb +16 -0
  189. data/lib/decidim/core/test/shared_examples/input_filter_examples.rb +118 -0
  190. data/lib/decidim/core/test/shared_examples/input_sort_examples.rb +105 -0
  191. data/lib/decidim/core/test/shared_examples/participatory_space_resourcable_interface_examples.rb +43 -0
  192. data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +59 -0
  193. data/lib/decidim/core/test/shared_examples/timestamps_interface_examples.rb +21 -0
  194. data/lib/decidim/core/test/shared_examples/traceable_interface_examples.rb +47 -0
  195. data/lib/decidim/core/version.rb +1 -1
  196. data/lib/decidim/deprecations.rb +19 -0
  197. data/lib/decidim/diffy_extension.rb +26 -0
  198. data/lib/decidim/exporters/export_manifest.rb +6 -2
  199. data/lib/decidim/filter_form_builder.rb +25 -7
  200. data/lib/decidim/form_builder.rb +2 -2
  201. data/lib/decidim/has_settings.rb +10 -4
  202. data/lib/decidim/participatory_space_manifest.rb +20 -0
  203. data/lib/decidim/participatory_space_resourceable.rb +35 -1
  204. data/lib/decidim/query_extensions.rb +9 -23
  205. data/lib/decidim/scopable.rb +10 -0
  206. data/lib/tasks/decidim_data_portability_tasks.rake +66 -5
  207. data/lib/tasks/decidim_metrics_tasks.rake +18 -7
  208. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.el.js +14 -0
  209. metadata +142 -16
  210. data/app/models/decidim/participatory_process_user_role.rb +0 -32
  211. data/app/views/layouts/decidim/_edit_link.html.erb +0 -8
  212. data/lib/decidim/data_portability_file_reader.rb +0 -56
  213. data/lib/decidim/data_portability_file_zipper.rb +0 -67
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ FingerprintType = GraphQL::ObjectType.define do
6
+ name "Fingerprint"
7
+ description "A fingerprint object"
8
+
9
+ field :value, !types.String, "The the hash value for the fingerprint"
10
+ field :source, !types.String do
11
+ description "Returns the source String (usually a json) from which the fingerprint is generated."
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ module HasHastaggableInputFilter
6
+ def self.included(child_class)
7
+ child_class.argument :hashtag,
8
+ type: String,
9
+ description: "List result having this hashtag",
10
+ required: false,
11
+ prepare: ->(hashtag, _ctx) { "##{hashtag.sub(/^#/, "")}" }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ module HasLocalizedInputFilter
6
+ def self.included(child_class)
7
+ child_class.argument :locale,
8
+ type: String,
9
+ description: "Specify the locale to use when searching translated fields, otherwise default organization language will be used",
10
+ required: false,
11
+ prepare: ->(locale, ctx) do
12
+ unless ctx[:current_organization].available_locales.include?(locale)
13
+ raise GraphQL::ExecutionError, "#{locale} locale is not used in the organization"
14
+ end
15
+
16
+ locale
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ module HasLocalizedInputSort
6
+ def self.included(child_class)
7
+ child_class.argument :locale,
8
+ type: String,
9
+ description: "Specify the locale to use when ordering translated fields, otherwise default organization language will be used",
10
+ required: false,
11
+ prepare: ->(locale, ctx) do
12
+ unless ctx[:current_organization].available_locales.include?(locale)
13
+ raise GraphQL::ExecutionError, "#{locale} locale is not used in the organization"
14
+ end
15
+
16
+ locale
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ module HasPublishableInputFilter
6
+ def self.included(child_class)
7
+ child_class.argument :published_before,
8
+ type: String,
9
+ description: "List result published **before** (and **excluding**) this date. Expected format `YYYY-MM-DD`",
10
+ required: false,
11
+ prepare: ->(date, _ctx) do
12
+ proc do |model_class|
13
+ model_class.arel_table[:published_at].lt(date_to_iso8601(date, :publishedBefore))
14
+ end
15
+ end
16
+ child_class.argument :published_since,
17
+ type: String,
18
+ description: "List result published after (and **including**) this date. Expected format `YYYY-MM-DD`",
19
+ required: false,
20
+ prepare: ->(date, _ctx) do
21
+ proc do |model_class|
22
+ model_class.arel_table[:published_at].gteq(date_to_iso8601(date, :publishedBefore))
23
+ end
24
+ end
25
+ end
26
+
27
+ def self.date_to_iso8601(date, key)
28
+ Date.iso8601(date)
29
+ rescue StandardError
30
+ raise GraphQL::ExecutionError, "Invalid date format for #{key}"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ module HasPublishableInputSort
6
+ def self.included(child_class)
7
+ child_class.argument :published_at, String, "Sort by date of publication, valid values are ASC or DESC", required: false
8
+ # child_class.argument :created_at, String, "Sort by date of creation, valid values are ASC or DESC", required: false
9
+ # child_class.argument :updated_at, String, "Sort by date of last modification, valid values are ASC or DESC", required: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ class ParticipatorySpaceInputFilter < BaseInputFilter
6
+ include HasPublishableInputFilter
7
+
8
+ graphql_name "ParticipatorySpaceFilter"
9
+ description "A type used for filtering any generic participatory space.
10
+
11
+ Specific participatory spaces (such as Processes or Assemblies) usually implement their own filter adding capabilities accordingly.
12
+
13
+ A typical query would look like:
14
+
15
+
16
+ ```
17
+ {
18
+ participatoryProcesses(filter:{ publishedBefore: \"2020-01-01\" }) {
19
+ id
20
+ }
21
+ }
22
+ ```
23
+ "
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ class ParticipatorySpaceInputSort < BaseInputSort
6
+ include HasPublishableInputSort
7
+
8
+ graphql_name "ParticipatorySpaceSort"
9
+ description "A type used for sorting any generic participatory space"
10
+
11
+ argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ ParticipatorySpaceLinkType = GraphQL::ObjectType.define do
6
+ name "ParticipatorySpaceLink"
7
+ description "A link representation between participatory spaces"
8
+
9
+ field :id, !types.ID, "The id of this participatory space link"
10
+ field :fromType, !types.String, "The origin participatory space type for this participatory space link", property: :from_type
11
+ field :toType, !types.String, "The destination participatory space type for this participatory space link", property: :to_type
12
+ field :name, !types.String, "The name (purpose) of this participatory space link"
13
+ field :participatorySpace, !ParticipatorySpaceInterface do
14
+ description "The linked participatory space (polymorphic)"
15
+ resolve ->(link, _args, _ctx) {
16
+ manifest_name = link.name.partition("included_").last
17
+ object_class = "Decidim::#{manifest_name.classify}"
18
+ return link.to if link.to_type == object_class
19
+ return link.from if link.from_type == object_class
20
+ }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ TraceVersionType = GraphQL::ObjectType.define do
6
+ name "TraceVersion"
7
+ description "A trace version type"
8
+
9
+ field :id, !types.ID, "The ID of the version"
10
+ field :createdAt, Decidim::Core::DateTimeType do
11
+ description "The date and time this version was created"
12
+ property :created_at
13
+ end
14
+ field :editor, Decidim::Core::AuthorInterface do
15
+ description "The editor/author of this version"
16
+ resolve ->(obj, _args, _ctx) {
17
+ author = Decidim.traceability.version_editor(obj)
18
+ author if author.is_a?(Decidim::User) || author.is_a?(Decidim::UserGroup)
19
+ }
20
+ end
21
+ field :changeset, GraphQL::Types::JSON do
22
+ description "Object with the changes in this version"
23
+ resolve ->(obj, _args, _ctx) {
24
+ obj.changeset
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -2,15 +2,10 @@
2
2
 
3
3
  module Decidim
4
4
  # This class deals with saving data portability Zip Files to App
5
- class DataPortabilityUploader < CarrierWave::Uploader::Base
5
+ class DataPortabilityUploader < ApplicationUploader
6
6
  # Override the directory where uploaded files will be stored.
7
- # def store_dir
8
- # default_path = "tmp/data-portability/"
9
- # File.join(Rails.root, default_path)
10
- # end
11
-
12
7
  def store_dir
13
- default_path = "tmp/data-portability/"
8
+ default_path = "uploads/data-portability/"
14
9
 
15
10
  return File.join(Decidim.base_uploads_path, default_path) if Decidim.base_uploads_path.present?
16
11
 
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This validator ensures timezones are valid. This is, supported by ActiveSupport::TimeZone
4
+ class TimeZoneValidator < ActiveModel::EachValidator
5
+ def validate_each(record, attribute, value)
6
+ return if value.blank?
7
+
8
+ record.errors.add(attribute, options[:message] || :invalid_time_zone) unless ActiveSupport::TimeZone[value]
9
+ end
10
+ end
@@ -3,20 +3,12 @@
3
3
  <% key = key.to_sym %>
4
4
  <% if amendable.amendable_fields.include?(key) %>
5
5
 
6
- <% if [:title, :body].include?(key) %>
7
- <div class="field hashtags__container">
8
- <%= emendation_form.form_field_for key,
9
- class: "js-hashtags",
10
- hashtaggable: true,
11
- label: amendments_form_fields_label(key),
12
- value: amendments_form_fields_value(original, key) %>
13
- </div>
14
- <% end %>
6
+ <div class="field hashtags__container">
7
+ <%= amendments_form_field_for(key, emendation_form, original) %>
8
+ </div>
15
9
 
16
- <% if form.object.errors[key].present? %>
17
- <% form.object.errors.full_messages_for(key).each do |message| %>
18
- <small class="form-error is-visible"><%= message %></small>
19
- <% end %>
10
+ <% form.object.errors.full_messages_for(key).each do |message| %>
11
+ <small class="form-error is-visible"><%= message %></small>
20
12
  <% end %>
21
13
 
22
14
  <% end %>
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
 
15
15
  <div class="row column">
16
- <%= simple_format present(emendation).body(links: true, strip_tags: true) %>
16
+ <%= render_emendation_body(emendation) %>
17
17
  </div>
18
18
 
19
19
  <br><%= render partial: "attachments", locals: { attached_to: emendation } %>
@@ -1,17 +1,15 @@
1
- <% if Devise.mappings[:user].omniauthable? && any_social_provider_enabled? %>
1
+ <% if Devise.mappings[:user].omniauthable? && current_organization.enabled_omniauth_providers.any? %>
2
2
  <div class="row">
3
3
  <div class="columns large-4 mediumlarge-6 medium-8 medium-centered">
4
- <%- Decidim::User.omniauth_providers.each do |provider| %>
5
- <% if social_provider_enabled? provider %>
6
- <div class="social-register">
7
- <%= link_to decidim.send("user_#{provider}_omniauth_authorize_path"), class: "button button--social button--#{normalize_provider_name(provider)}", method: :post do %>
8
- <span class="button--social__icon">
9
- <%= oauth_icon provider %>
10
- </span>
11
- <%= t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(provider).titleize) %>
12
- <% end %>
13
- </div>
14
- <% end %>
4
+ <%- current_organization.enabled_omniauth_providers.keys.each do |provider| %>
5
+ <div class="social-register">
6
+ <%= link_to decidim.send("user_#{provider}_omniauth_authorize_path"), class: "button button--social button--#{normalize_provider_name(provider)}", method: :post do %>
7
+ <span class="button--social__icon">
8
+ <%= oauth_icon provider %>
9
+ </span>
10
+ <%= t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(provider).titleize) %>
11
+ <% end %>
12
+ </div>
15
13
  <% end %>
16
14
  <%- if current_organization.sign_in_enabled? %>
17
15
  <span class="register__separator">
@@ -1,17 +1,15 @@
1
- <% if Devise.mappings[:user].omniauthable? && any_social_provider_enabled? %>
1
+ <% if Devise.mappings[:user].omniauthable? && current_organization.enabled_omniauth_providers.any? %>
2
2
  <div class="row">
3
3
  <div class="columns medium-8 medium-centered">
4
4
  <span class="register__separator">
5
5
  <span class="register__separator__text"><%= t("or", scope: "decidim.devise.shared.omniauth_buttons") %></span>
6
6
  </span>
7
7
  <div class="text-center">
8
- <%- Decidim::User.omniauth_providers.each do |provider| %>
9
- <% if social_provider_enabled? provider %>
10
- <%= link_to decidim.send("user_#{provider}_omniauth_authorize_path"), class: "button button--social button--#{normalize_provider_name(provider)} button--social--mini", method: :post do %>
11
- <span class="button--social__icon">
12
- <%= oauth_icon provider %>
13
- </span>
14
- <% end %>
8
+ <%- current_organization.enabled_omniauth_providers.keys.each do |provider| %>
9
+ <%= link_to decidim.send("user_#{provider}_omniauth_authorize_path"), class: "button button--social button--#{normalize_provider_name(provider)} button--social--mini", method: :post do %>
10
+ <span class="button--social__icon">
11
+ <%= oauth_icon provider %>
12
+ </span>
15
13
  <% end %>
16
14
  <% end %>
17
15
  </div>
@@ -1,2 +1,2 @@
1
- <%= t(".click_button", date: l(Decidim.data_portability_expiry_time.from_now, format: :decidim_short) ).html_safe %><br>
2
- <%= link_to t(".download"), download_file_data_portability_url(host: @organization.host, token: @token), class: "button expanded hollow button--sc" %>
1
+ <%= t(".click_button", password: @password, date: l(Decidim.data_portability_expiry_time.from_now, format: :decidim_short) ).html_safe %><br>
2
+ <%= link_to t(".download"), download_file_data_portability_url(host: @organization.host, filename: @filename), class: "button expanded hollow button--sc" %>
@@ -5,17 +5,21 @@
5
5
  <li><a href="<%= scopes_picker_path(**context) %>"><%= t("decidim.scopes.global") %></a></li>
6
6
  <% end %>
7
7
  <% parent_scopes.each do |scope| %>
8
- <li><a href="<%= scopes_picker_path(current: scope.id, **context) %>"><%= translated_attribute(scope.name) %></a></li>
8
+ <li><a href="<%= scopes_picker_path(current: scope.id, max_depth: max_depth&.id, **context) %>"><%= translated_attribute(scope.name) %></a></li>
9
9
  <% end %>
10
10
  </ul>
11
11
  </div>
12
12
 
13
13
  <div class="scope-picker picker-content">
14
14
  <div class="picker-scrollable-content">
15
- <% if scopes.any? %>
15
+ <% if scopes&.any? %>
16
16
  <ul>
17
17
  <% scopes.each do |scope| %>
18
- <li><a href="<%= scopes_picker_path(current: scope.id, **context) %>"><%= translated_attribute(scope.name) %></a></li>
18
+ <li>
19
+ <a href="<%= scopes_picker_path(current: scope.id, max_depth: max_depth&.id, **context) %>">
20
+ <%= translated_attribute(scope.name) %>
21
+ </a>
22
+ </li>
19
23
  <% end %>
20
24
  </ul>
21
25
  <% end %>
@@ -0,0 +1,54 @@
1
+ <% if collection.leaf %>
2
+ <% data_checkboxes_tree_id = "#{check_boxes_tree_id}-#{collection.leaf.value}" %>
3
+ <% hide_node = (hide_node.present? and hide_node == "true") ? true : false %>
4
+ <% is_root_check_box = (collection.leaf.value == "") ? true : false %>
5
+ <% if is_root_check_box %>
6
+ <%= hidden_field_tag "#{form.object_name}[#{attribute}][]", "" %>
7
+ <% else %>
8
+ <div class="filters__has-subfilters">
9
+ <% end %>
10
+ <%= form.check_box attribute,
11
+ check_boxes_tree_options(
12
+ collection.leaf.value,
13
+ collection.leaf.label,
14
+ {
15
+ "data-checkboxes-tree": data_checkboxes_tree_id,
16
+ is_root_check_box: is_root_check_box
17
+ }),
18
+ collection.leaf.value.to_s, nil %>
19
+
20
+ <% unless is_root_check_box %>
21
+ <% if collection.node.present? %>
22
+ <button type="button" aria-label="show/hide" data-toggle="<%= data_checkboxes_tree_id %> <%= data_checkboxes_tree_id %>-trigger">
23
+ <span id="<%= data_checkboxes_tree_id %>-trigger" data-toggler=".filters__is-open">
24
+ <span class="filters__icon-is-closed" aria-hidden="true"><%= icon "chevron-bottom" %></span>
25
+ <span class="filters__icon-is-open" aria-hidden="true"><%= icon "chevron-top" %></span>
26
+ </span>
27
+ </button>
28
+ <% end %>
29
+ </div>
30
+ <% end %>
31
+
32
+ <% if collection.node.present? %>
33
+ <div id="<%= data_checkboxes_tree_id %>" class="filters__subfilters <%= "hide" if hide_node %>" <%= %{data-toggler=.hide} unless is_root_check_box %>>
34
+ <% collection.node.each do |item| %>
35
+ <% if item.tree_node? %>
36
+ <%= render "decidim/shared/check_boxes_tree",
37
+ form: form,
38
+ attribute: attribute,
39
+ collection: item,
40
+ check_boxes_tree_id: "#{check_boxes_tree_id}-#{item.leaf.value}",
41
+ hide_node: "true",
42
+ options: options %>
43
+ <% else %>
44
+ <%= form.check_box attribute,
45
+ check_boxes_tree_options(
46
+ item.value,
47
+ item.label
48
+ ),
49
+ item.value, nil %>
50
+ <% end %>
51
+ <% end %>
52
+ </div>
53
+ <% end %>
54
+ <% end %>
@@ -8,7 +8,7 @@
8
8
  <%= default_item[:name] %>
9
9
  </div>
10
10
  </button>
11
- <div class="row column process-nav__content" id="process-nav-content" data-toggler=".is-active">
11
+ <div class="row column process-nav__content <%= browser.mobile? ? "is-active" : "" %>" id="process-nav-content" data-toggler=".is-active">
12
12
  <ul>
13
13
  <% items.each_with_index do |item, index| %>
14
14
  <li class="<%= "is-active" if item[:active] %> <%= "hide-for-medium" if index > max_items %>">
@@ -0,0 +1,4 @@
1
+ <% content_for(:header, "false") %>
2
+ <% content_for(:title, translated_attribute(model.title)) %>
3
+
4
+ <%= card_for model, context: { show_space: true } %>