decidim-core 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_core_manifest.js +1 -0
  3. data/app/assets/images/decidim/process.svg +10 -0
  4. data/app/assets/javascripts/decidim.js.es6 +2 -0
  5. data/app/assets/javascripts/decidim/editor.js.es6 +2 -2
  6. data/app/assets/javascripts/decidim/filters.js.es6 +1 -1
  7. data/app/assets/javascripts/decidim/form_filter.component.js.es6 +26 -5
  8. data/app/assets/javascripts/decidim/form_filter.component.test.js +1 -18
  9. data/app/assets/javascripts/decidim/foundation.js.es6 +1 -0
  10. data/app/assets/javascripts/decidim/history.js.es6 +35 -0
  11. data/app/assets/javascripts/decidim/orders.js.es6 +28 -0
  12. data/app/assets/stylesheets/decidim/_decidim.scss +1 -0
  13. data/app/assets/stylesheets/decidim/email.css +21 -3
  14. data/app/assets/stylesheets/decidim/extras/_leaflet.scss +4 -2
  15. data/app/assets/stylesheets/decidim/extras/_quill.scss +8 -0
  16. data/app/assets/stylesheets/decidim/extras/_register_form.scss +9 -0
  17. data/app/assets/stylesheets/decidim/modules/_buttons.scss +19 -3
  18. data/app/assets/stylesheets/decidim/utils/_mixins.scss +8 -4
  19. data/app/commands/decidim/authorize_user.rb +9 -4
  20. data/app/commands/decidim/create_omniauth_registration.rb +4 -2
  21. data/app/commands/decidim/create_registration.rb +4 -1
  22. data/app/commands/decidim/invite_user.rb +3 -1
  23. data/app/commands/decidim/update_notifications_settings.rb +31 -0
  24. data/app/constraints/decidim/current_feature.rb +16 -15
  25. data/app/controllers/concerns/decidim/action_authorization.rb +73 -0
  26. data/app/controllers/concerns/decidim/feature_settings.rb +2 -5
  27. data/app/controllers/concerns/decidim/needs_authorization.rb +5 -1
  28. data/app/controllers/concerns/decidim/user_profile.rb +1 -0
  29. data/app/controllers/decidim/application_controller.rb +12 -0
  30. data/app/controllers/decidim/authorizations_controller.rb +10 -12
  31. data/app/controllers/decidim/cookie_policy_controller.rb +15 -0
  32. data/app/controllers/decidim/devise/confirmations_controller.rb +4 -0
  33. data/app/controllers/decidim/devise/invitations_controller.rb +4 -0
  34. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +10 -3
  35. data/app/controllers/decidim/devise/passwords_controller.rb +4 -0
  36. data/app/controllers/decidim/devise/registrations_controller.rb +21 -0
  37. data/app/controllers/decidim/devise/sessions_controller.rb +4 -0
  38. data/app/controllers/decidim/notifications_settings_controller.rb +31 -0
  39. data/app/controllers/decidim/pages_controller.rb +17 -6
  40. data/app/controllers/decidim/participatory_processes_controller.rb +5 -5
  41. data/app/forms/decidim/notifications_settings_form.rb +17 -0
  42. data/app/forms/decidim/registration_form.rb +2 -1
  43. data/app/helpers/decidim/action_authorization_helper.rb +82 -0
  44. data/app/helpers/decidim/application_helper.rb +2 -0
  45. data/app/helpers/decidim/authorization_form_helper.rb +1 -1
  46. data/app/helpers/decidim/cookies_helper.rb +11 -0
  47. data/app/helpers/decidim/decidim_form_helper.rb +18 -0
  48. data/app/helpers/decidim/language_chooser_helper.rb +18 -0
  49. data/app/helpers/decidim/layout_helper.rb +0 -5
  50. data/app/helpers/decidim/localized_locales_helper.rb +1 -1
  51. data/app/helpers/decidim/meta_tags_helper.rb +104 -0
  52. data/app/helpers/decidim/orders_helper.rb +28 -0
  53. data/app/helpers/decidim/resource_helper.rb +46 -6
  54. data/app/mailers/decidim/application_mailer.rb +2 -2
  55. data/app/mailers/decidim/decidim_devise_mailer.rb +0 -1
  56. data/app/mailers/decidim/newsletter_mailer.rb +24 -0
  57. data/app/models/decidim/abilities/everyone.rb +2 -0
  58. data/app/models/decidim/feature.rb +30 -0
  59. data/app/models/decidim/newsletter.rb +24 -0
  60. data/app/models/decidim/organization.rb +2 -0
  61. data/app/models/decidim/user.rb +3 -2
  62. data/app/queries/decidim/highlighted_participatory_processes.rb +10 -0
  63. data/app/queries/decidim/promoted_participatory_processes.rb +9 -0
  64. data/app/queries/decidim/public_participatory_processes.rb +10 -0
  65. data/app/services/decidim/action_authorizer.rb +102 -0
  66. data/app/services/decidim/resource_search.rb +1 -1
  67. data/app/uploaders/decidim/official_image_footer_uploader.rb +12 -0
  68. data/app/uploaders/decidim/official_image_header_uploader.rb +12 -0
  69. data/app/validators/etiquette_validator.rb +42 -0
  70. data/app/views/decidim/account/show.html.erb +1 -1
  71. data/app/views/decidim/authorizations/index.html.erb +4 -4
  72. data/app/views/decidim/authorizations/new.html.erb +2 -2
  73. data/app/views/decidim/cookie_policy/accept.js.erb +3 -0
  74. data/app/views/decidim/devise/confirmations/new.html.erb +3 -1
  75. data/app/views/decidim/devise/invitations/edit.html.erb +1 -1
  76. data/app/views/decidim/devise/omniauth_registrations/new.html.erb +1 -1
  77. data/app/views/decidim/devise/passwords/edit.html.erb +1 -1
  78. data/app/views/decidim/devise/passwords/new.html.erb +3 -1
  79. data/app/views/decidim/devise/registrations/edit.html.erb +2 -1
  80. data/app/views/decidim/devise/registrations/new.html.erb +13 -1
  81. data/app/views/decidim/devise/sessions/new.html.erb +3 -1
  82. data/app/views/decidim/newsletter_mailer/newsletter.html.erb +5 -0
  83. data/app/views/decidim/notifications_settings/show.html.erb +26 -0
  84. data/app/views/decidim/pages/index.html.erb +34 -0
  85. data/app/views/decidim/participatory_process_steps/index.html.erb +1 -1
  86. data/app/views/decidim/participatory_processes/_participatory_process.html.erb +4 -2
  87. data/app/views/decidim/participatory_processes/_promoted_process.html.erb +1 -1
  88. data/app/views/decidim/participatory_processes/index.html.erb +3 -3
  89. data/app/views/decidim/participatory_processes/show.html.erb +30 -9
  90. data/app/views/decidim/shared/_action_authorization_modal.html.erb +55 -0
  91. data/app/views/decidim/shared/_login_modal.html.erb +2 -3
  92. data/app/views/decidim/shared/_orders.html.erb +15 -0
  93. data/app/views/decidim/shared/_share_modal.html.erb +33 -0
  94. data/app/views/devise/mailer/organization_admin_invitation_instructions.html.erb +1 -1
  95. data/app/views/layouts/decidim/_application.html.erb +12 -0
  96. data/app/views/layouts/decidim/_cookie_warning.html.erb +8 -0
  97. data/app/views/layouts/decidim/_footer.html.erb +6 -0
  98. data/app/views/layouts/decidim/_header.html.erb +7 -9
  99. data/app/views/layouts/decidim/_language_chooser.html.erb +3 -3
  100. data/app/views/layouts/decidim/_logo.html.erb +1 -1
  101. data/app/views/layouts/decidim/_mailer_logo.html.erb +31 -0
  102. data/app/views/layouts/decidim/_main_nav.html.erb +11 -0
  103. data/app/views/layouts/decidim/_process_header.html.erb +9 -7
  104. data/app/views/layouts/decidim/_social_media_links.html.erb +39 -0
  105. data/app/views/layouts/decidim/_social_meta.html.erb +8 -8
  106. data/app/views/layouts/decidim/mailer.html.erb +110 -62
  107. data/app/views/layouts/decidim/participatory_process.html.erb +14 -3
  108. data/app/views/layouts/decidim/user_profile.html.erb +1 -0
  109. data/app/views/pages/decidim_page.html.erb +5 -0
  110. data/app/views/pages/home.html.erb +4 -0
  111. data/app/views/pages/home/_extended.html.erb +2 -2
  112. data/app/views/pages/home/_footer_sub_hero.html.erb +12 -0
  113. data/app/views/pages/home/_hero.html.erb +2 -2
  114. data/app/views/pages/home/_highlighted_processes.html.erb +2 -2
  115. data/config/i18n-tasks.yml +6 -2
  116. data/config/initializers/invisible_captcha.rb +10 -0
  117. data/config/initializers/mail_previews.rb +4 -0
  118. data/config/locales/ca.yml +129 -23
  119. data/config/locales/en.yml +98 -13
  120. data/config/locales/es.yml +128 -22
  121. data/config/locales/eu.yml +5 -0
  122. data/config/routes.rb +13 -5
  123. data/db/migrate/20170131134349_add_action_permissions_to_decidim_features.rb +5 -0
  124. data/db/migrate/20170202084913_add_comments_and_replies_notifications_to_users.rb +6 -0
  125. data/db/migrate/20170203150545_add_newsletter_notifications_to_users.rb +5 -0
  126. data/db/migrate/20170206083118_rename_extra_info_on_processes.rb +12 -0
  127. data/db/migrate/20170206142116_add_published_at_to_decidim_features.rb +6 -0
  128. data/db/migrate/20170207091021_add_social_media_handlers_to_organization.rb +8 -0
  129. data/db/migrate/20170207093048_add_organization_logo_and_url.rb +7 -0
  130. data/db/migrate/20170213081133_create_decidim_newsletters.rb +15 -0
  131. data/db/seeds.rb +29 -4
  132. data/lib/decidim/attributes.rb +6 -0
  133. data/lib/decidim/attributes/time_with_zone.rb +13 -0
  134. data/lib/decidim/authorable.rb +2 -2
  135. data/lib/decidim/core.rb +11 -0
  136. data/lib/decidim/core/api.rb +11 -0
  137. data/lib/decidim/core/api/author_interface.rb +11 -0
  138. data/lib/decidim/core/api/localized_string_type.rb +11 -0
  139. data/{app/types/decidim → lib/decidim/core/api}/process_step_type.rb +2 -2
  140. data/{app/types/decidim → lib/decidim/core/api}/process_type.rb +1 -1
  141. data/{app/types/decidim → lib/decidim/core/api}/session_type.rb +0 -0
  142. data/lib/decidim/core/api/translated_field_type.rb +42 -0
  143. data/{app/types/decidim → lib/decidim/core/api}/user_group_type.rb +1 -1
  144. data/{app/types/decidim → lib/decidim/core/api}/user_type.rb +1 -1
  145. data/lib/decidim/core/engine.rb +7 -1
  146. data/lib/decidim/core/test.rb +1 -0
  147. data/lib/decidim/core/test/factories.rb +41 -8
  148. data/lib/decidim/core/test/shared_examples/localised_email.rb +24 -0
  149. data/lib/decidim/core/version.rb +1 -1
  150. data/lib/decidim/feature_manifest.rb +11 -0
  151. data/{app/validators → lib/decidim}/feature_validator.rb +1 -3
  152. data/lib/decidim/features/base_controller.rb +6 -1
  153. data/lib/decidim/form_builder.rb +166 -1
  154. data/lib/decidim/has_feature.rb +2 -1
  155. data/lib/decidim/resourceable.rb +26 -0
  156. data/vendor/assets/javascripts/morphdom.js +679 -0
  157. metadata +174 -49
  158. data/lib/decidim/has_attachment.rb +0 -32
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
- require "active_support/concern"
3
-
4
- module Decidim
5
- # A concern with the features needed when you want a model to be able to create
6
- # links from it to another resource.
7
- module HasAttachments
8
- extend ActiveSupport::Concern
9
-
10
- included do
11
- has_many :attachments,
12
- class_name: Decidim::Attachment,
13
- dependent: :destroy,
14
- inverse_of: :attached_to,
15
- as: :attached_to
16
-
17
- # All the attachments that are photos for this porcess.
18
- #
19
- # Returns an Array<Attachment>
20
- def photos
21
- @photos ||= attachments.select(&:photo?)
22
- end
23
-
24
- # All the attachments that are documents for this porcess.
25
- #
26
- # Returns an Array<Attachment>
27
- def documents
28
- @documents ||= attachments.select(&:document?)
29
- end
30
- end
31
- end
32
- end