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
@@ -3,9 +3,9 @@ module Decidim
3
3
  # Main application mailer configuration. Inherit from this to create new
4
4
  # mailers.
5
5
  class ApplicationMailer < ActionMailer::Base
6
- include Roadie::Rails::Automatic
6
+ include LocalisedMailer
7
7
 
8
8
  default from: Decidim.config.mailer_sender
9
- layout "mailer"
9
+ layout "decidim/mailer"
10
10
  end
11
11
  end
@@ -4,7 +4,6 @@ module Decidim
4
4
  # each role and use a localised version.
5
5
  class DecidimDeviseMailer < Devise::Mailer
6
6
  include LocalisedMailer
7
- include Roadie::Rails::Automatic
8
7
 
9
8
  layout "decidim/mailer"
10
9
 
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ class NewsletterMailer < ApplicationMailer
4
+ add_template_helper Decidim::TranslationsHelper
5
+
6
+ def newsletter(user, newsletter)
7
+ @organization = user.organization
8
+ @newsletter = newsletter
9
+
10
+ with_user(user) do
11
+ @subject = parse_interpolations(@newsletter.subject[I18n.locale.to_s], user)
12
+ @body = parse_interpolations(@newsletter.body[I18n.locale.to_s], user)
13
+
14
+ mail(to: "#{user.name} <#{user.email}>", subject: @subject)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def parse_interpolations(content, user)
21
+ content.gsub("%{name}", user.name)
22
+ end
23
+ end
24
+ end
@@ -11,6 +11,8 @@ module Decidim
11
11
  can :read, :public_pages
12
12
  can :manage, :locales
13
13
 
14
+ can :read, Feature, &:published?
15
+
14
16
  can :manage, User do |other|
15
17
  other == user
16
18
  end
@@ -15,6 +15,29 @@ module Decidim
15
15
 
16
16
  after_initialize :default_values
17
17
 
18
+ # Public: Filters the features that are published and, therefore, visible by
19
+ # the end user.
20
+ #
21
+ # Returns an ActiveRecord::Relation.
22
+ def self.published
23
+ where.not(published_at: nil)
24
+ end
25
+
26
+ # Public: Filters the features that are unpublished and, therefore, not visible
27
+ # by the end user.
28
+ #
29
+ # Returns an ActiveRecord::Relation.
30
+ def self.unpublished
31
+ where(published_at: nil)
32
+ end
33
+
34
+ # Public: Finds out wether this feature is published.
35
+ #
36
+ # Returns true if published, false otherwise.
37
+ def published?
38
+ published_at.present?
39
+ end
40
+
18
41
  # Public: Finds the manifest this feature is associated to.
19
42
  #
20
43
  # Returns a FeatureManifest.
@@ -51,6 +74,13 @@ module Decidim
51
74
  end
52
75
  end
53
76
 
77
+ def active_step_settings
78
+ active_step = participatory_process.active_step
79
+ return nil unless active_step
80
+
81
+ step_settings.fetch(active_step.id.to_s)
82
+ end
83
+
54
84
  private
55
85
 
56
86
  def serialize_settings(schema, value)
@@ -0,0 +1,24 @@
1
+ module Decidim
2
+ # This model holds all the data needed to send a newsletter.
3
+ class Newsletter < ApplicationRecord
4
+ belongs_to :author, class_name: User
5
+ belongs_to :organization
6
+
7
+ validates :subject, :body, presence: true
8
+ validate :author_belongs_to_organization
9
+
10
+ # Returns true if this newsletter was already sent.
11
+ #
12
+ # Returns a Boolean.
13
+ def sent?
14
+ sent_at.present?
15
+ end
16
+
17
+ private
18
+
19
+ def author_belongs_to_organization
20
+ return if !author || !organization
21
+ errors.add(:author, :invalid) unless author.organization == organization
22
+ end
23
+ end
24
+ end
@@ -13,6 +13,8 @@ module Decidim
13
13
  validates :name, :host, uniqueness: true
14
14
 
15
15
  mount_uploader :homepage_image, Decidim::HomepageImageUploader
16
+ mount_uploader :official_img_header, Decidim::OfficialImageHeaderUploader
17
+ mount_uploader :official_img_footer, Decidim::OfficialImageFooterUploader
16
18
  mount_uploader :logo, Decidim::OrganizationLogoUploader
17
19
  mount_uploader :favicon, Decidim::OrganizationFaviconUploader
18
20
 
@@ -14,13 +14,14 @@ module Decidim
14
14
  has_many :user_groups, through: :memberships, class_name: Decidim::UserGroup, foreign_key: :decidim_user_group_id
15
15
  has_many :memberships, class_name: Decidim::UserGroupMembership, foreign_key: :decidim_user_id
16
16
 
17
- ROLES = %w(admin moderator official).freeze
17
+ ROLES = %w(admin moderator collaborator official).freeze
18
18
 
19
19
  validates :organization, :name, presence: true
20
20
  validates :locale, inclusion: { in: I18n.available_locales.map(&:to_s) }, allow_blank: true
21
21
  validates :tos_agreement, acceptance: true, allow_nil: false, on: :create
22
- validate :all_roles_are_valid
23
22
  validates :avatar, file_size: { less_than_or_equal_to: 5.megabytes }
23
+ validates :email, uniqueness: { scope: :organization }
24
+ validate :all_roles_are_valid
24
25
  mount_uploader :avatar, Decidim::AvatarUploader
25
26
 
26
27
  # Public: Allows customizing the invitation instruction email content when
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # This query adds some scopes so the processes are ready to be showed in a
4
+ # public view.
5
+ class HighlightedParticipatoryProcesses < Rectify::Query
6
+ def query
7
+ Decidim::ParticipatoryProcess.order("promoted DESC").includes(:active_step).order("decidim_participatory_process_steps.end_date ASC").limit(8)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # This query filters processes so only promoted ones are returned.
4
+ class PromotedParticipatoryProcesses < Rectify::Query
5
+ def query
6
+ Decidim::ParticipatoryProcess.promoted
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # This query adds some scopes so the processes are ready to be showed in a
4
+ # public view.
5
+ class PublicParticipatoryProcesses < Rectify::Query
6
+ def query
7
+ Decidim::ParticipatoryProcess.order("promoted DESC").includes(:active_step).order("decidim_participatory_process_steps.end_date ASC")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # This class is used to authorize a user against an action in the context of a
4
+ # feature.
5
+ class ActionAuthorizer
6
+ include Wisper::Publisher
7
+
8
+ # Initializes the ActionAuthorizer.
9
+ #
10
+ # user - The user to authorize against.
11
+ # feature - The feature to authenticate against.
12
+ # action - The action to authenticate.
13
+ def initialize(user, feature, action)
14
+ @user = user
15
+ @feature = feature
16
+ @action = action.to_s if action
17
+ end
18
+
19
+ # Public: Broadcasts different events given the status of the authentication.
20
+ #
21
+ # Broadcasts:
22
+ # failed - When no valid authorization can be found.
23
+ # unauthorized - When an authorization was found, but didn't match the credentials.
24
+ # incomplete - An authorization was found, but lacks some required fields. User
25
+ # should re-authenticate.
26
+ #
27
+ # Returns nil.
28
+ def authorize
29
+ raise AuthorizationError, "Missing data" unless feature && action
30
+
31
+ return status(:ok) unless authorization_handler_name
32
+
33
+ return status(:missing, handler: authorization_handler_name) unless authorization
34
+ return status(:invalid, handler: authorization_handler_name, fields: unmatched_fields) if unmatched_fields.any?
35
+ return status(:incomplete, handler: authorization_handler_name, fields: missing_fields) if missing_fields.any?
36
+
37
+ status(:ok)
38
+ end
39
+
40
+ private
41
+
42
+ def status(status_code, data = {})
43
+ AuthorizationStatus.new(status_code, authorization_handler_name, data)
44
+ end
45
+
46
+ attr_reader :user, :feature, :action
47
+
48
+ def authorization
49
+ return nil unless user
50
+ return nil unless permission["authorization_handler_name"]
51
+
52
+ @authorization ||= user.authorizations.to_a.find do |authorization|
53
+ authorization.name == permission.fetch("authorization_handler_name")
54
+ end
55
+ end
56
+
57
+ def unmatched_fields
58
+ (permission_options.keys & authorization.metadata.to_h.keys).each_with_object({}) do |field, unmatched|
59
+ unmatched[field] = permission_options[field] if authorization.metadata[field] != permission_options[field]
60
+ unmatched
61
+ end
62
+ end
63
+
64
+ def missing_fields
65
+ permission_options.keys.each_with_object([]) do |field, missing|
66
+ missing << field if authorization.metadata[field].blank?
67
+ missing
68
+ end
69
+ end
70
+
71
+ def permission_options
72
+ permission["options"] || {}
73
+ end
74
+
75
+ def authorization_handler_name
76
+ permission&.fetch("authorization_handler_name", nil)
77
+ end
78
+
79
+ def permission
80
+ return nil unless feature
81
+ return nil unless action
82
+
83
+ @permission ||= feature.permissions&.fetch(action, nil)
84
+ end
85
+
86
+ class AuthorizationStatus
87
+ attr_reader :code, :handler_name, :data
88
+
89
+ def initialize(code, handler_name, data)
90
+ @code = code.to_sym
91
+ @handler_name = handler_name
92
+ @data = data.symbolize_keys
93
+ end
94
+
95
+ def ok?
96
+ @code == :ok
97
+ end
98
+ end
99
+
100
+ class AuthorizationError < StandardError; end
101
+ end
102
+ end
@@ -5,7 +5,7 @@ module Decidim
5
5
  class ResourceSearch < Searchlight::Search
6
6
  # Initialize the Searchlight::Search base class with the options provided.
7
7
  #
8
- # scope - The scope used to create the base query
8
+ # scope - The scope used to create the base query
9
9
  # options - A hash of options to modify the search. These options will be
10
10
  # converted to methods by SearchLight so they can be used on filter #
11
11
  # methods. (Default {})
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # This class deals with uploading hero images to ParticipatoryProcesses.
4
+ class OfficialImageFooterUploader < ImageUploader
5
+ include CarrierWave::MiniMagick
6
+ process resize_to_limit: [300, 90]
7
+
8
+ def max_image_height_or_width
9
+ 300
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # This class deals with uploading hero images to ParticipatoryProcesses.
4
+ class OfficialImageHeaderUploader < ImageUploader
5
+ include CarrierWave::MiniMagick
6
+ process resize_to_limit: [80, 80]
7
+
8
+ def max_image_height_or_width
9
+ 300
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ # This validator takes care of ensuring the validated content is
4
+ # respectful, doesn't use caps, and overall is meaningful.
5
+ class EtiquetteValidator < ActiveModel::EachValidator
6
+ def validate_each(record, attribute, value)
7
+ return if value.blank?
8
+
9
+ validate_caps(record, attribute, value)
10
+ validate_marks(record, attribute, value)
11
+ validate_long_words(record, attribute, value)
12
+ validate_caps_first(record, attribute, value)
13
+ validate_length(record, attribute, value)
14
+ end
15
+
16
+ private
17
+
18
+ def validate_caps(record, attribute, value)
19
+ return if value.scan(/[A-Z]/).length < value.length / 3
20
+ record.errors.add(attribute, options[:message] || :too_much_caps)
21
+ end
22
+
23
+ def validate_marks(record, attribute, value)
24
+ return if value.scan(/[!?¡¿]{2,}/).empty?
25
+ record.errors.add(attribute, options[:message] || :too_many_marks)
26
+ end
27
+
28
+ def validate_long_words(record, attribute, value)
29
+ return if value.scan(/[A-z]{30,}/).empty?
30
+ record.errors.add(attribute, options[:message] || :long_words)
31
+ end
32
+
33
+ def validate_caps_first(record, attribute, value)
34
+ return if value.scan(/^[a-z]{1}/).empty?
35
+ record.errors.add(attribute, options[:message] || :must_start_with_caps)
36
+ end
37
+
38
+ def validate_length(record, attribute, value)
39
+ return if value.length > 15
40
+ record.errors.add(attribute, options[:message] || :too_short)
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  <div class="row">
2
- <%= form_for(@account, url: account_path, method: :put, class: "user-form") do |f| %>
2
+ <%= decidim_form_for(@account, url: account_path, method: :put, class: "user-form") do |f| %>
3
3
  <div class="columns large-4">
4
4
  <%= image_tag current_user.avatar.big.url, width: "100%" %>
5
5
  <%= f.file_field :avatar, label: false %>
@@ -8,14 +8,14 @@
8
8
  <%= icon "lock-unlocked", class: "card--list__icon" %>
9
9
  <div>
10
10
  <h5 class="card--list__heading">
11
- <%= t(authorization.name, scope: "decidim.authorization_handlers") %>
11
+ <%= t("#{authorization.name}.name", scope: "decidim.authorization_handlers") %>
12
12
  </h5>
13
13
  <span class="text-small"><%= l(authorization.created_at, format: :long) %></span>
14
14
  </div>
15
15
  </div>
16
16
  <div class="card--list__data">
17
- <%= link_to authorization, method: :delete, class: "card--list__data__icon", data: { confirm: t(".authorization_confirm_destroy") } do %>
18
- <%= icon "circle-x" %>
17
+ <%= link_to new_authorization_path(handler: authorization.name), class: "card--list__data__icon" do %>
18
+ <%= icon "reload" %>
19
19
  <% end %>
20
20
  </div>
21
21
  </div>
@@ -32,7 +32,7 @@
32
32
  </a>
33
33
  <div>
34
34
  <h5 class="card--list__heading">
35
- <%= link_to t(handler.handler_name, scope: "decidim.authorization_handlers"), new_authorization_path(handler: handler.handler_name) %>
35
+ <%= link_to t("#{handler.handler_name}.name", scope: "decidim.authorization_handlers"), new_authorization_path(handler: handler.handler_name) %>
36
36
  </h5>
37
37
  </div>
38
38
  </div>
@@ -2,7 +2,7 @@
2
2
  <div class="row collapse">
3
3
  <div class="row collapse">
4
4
  <div class="columns large-8 large-centered text-center page-title">
5
- <h1><%= t(".authorize_with", authorizer: t(handler.handler_name, scope: "decidim.authorization_handlers")) %></h1>
5
+ <h1><%= t(".authorize_with", authorizer: t("#{handler.handler_name}.name", scope: "decidim.authorization_handlers")) %></h1>
6
6
  </div>
7
7
  </div>
8
8
 
@@ -10,7 +10,7 @@
10
10
  <div class="columns large-6 medium-centered">
11
11
  <div class="card">
12
12
  <div class="card__content">
13
- <%= authorization_form_for(handler) do |form| %>
13
+ <%= authorization_form_for(handler, url: authorizations_path(redirect_url: params[:redirect_url])) do |form| %>
14
14
  <%= form.error_for(:base) %>
15
15
 
16
16
  <% if lookup_context.exists?(handler.to_partial_path, [], true) %>
@@ -0,0 +1,3 @@
1
+ const $cookieWarning = $('.cookie-warning');
2
+
3
+ $cookieWarning.hide();
@@ -1,3 +1,5 @@
1
+ <% add_decidim_page_title(t("devise.confirmations.new.resend_confirmation_instructions")) %>
2
+
1
3
  <main class="wrapper">
2
4
  <div class="row collapse">
3
5
  <div class="row collapse">
@@ -10,7 +12,7 @@
10
12
  <div class="columns medium-7 large-5 medium-centered">
11
13
  <div class="card">
12
14
  <div class="card__content">
13
- <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: "register-form new_user" }) do |f| %>
15
+ <%= decidim_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: "register-form new_user" }) do |f| %>
14
16
  <%= devise_error_messages! %>
15
17
 
16
18
  <div class="field">
@@ -10,7 +10,7 @@
10
10
  <div class="columns medium-7 large-5 medium-centered">
11
11
  <div class="card">
12
12
  <div class="card__content">
13
- <%= form_for resource, as: resource_name, url: invitation_path(resource_name, invite_redirect: params[:invite_redirect]), html: { method: :put, class: "register-form new_user" } do |f| %>
13
+ <%= decidim_form_for resource, as: resource_name, url: invitation_path(resource_name, invite_redirect: params[:invite_redirect]), html: { method: :put, class: "register-form new_user" } do |f| %>
14
14
  <%= f.hidden_field :invitation_token %>
15
15
 
16
16
  <% if f.object.class.require_password_on_accepting %>