diff --git a/Gemfile b/Gemfile
index 5b741602e..424f74532 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,7 +10,8 @@ gem 'has_scope', '~> 0.7.2'
gem 'pundit', '~> 2.1.0'
gem 'pg', '~> 1.4'
gem 'json_translate', '~> 4.0.0'
-gem 'devise', '~> 4.7.1'
+gem 'devise', '~> 4.9.1'
+gem 'devise-i18n', '~> 1.11.0'
gem 'http_accept_language', '~> 2.1.1'
gem 'unicorn', '~> 5.5.1'
gem 'kaminari', '~> 1.2.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index a8a42aa55..1a610fc34 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -95,7 +95,7 @@ GEM
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.3)
aws-eventstream (~> 1, >= 1.0.2)
- bcrypt (3.1.16)
+ bcrypt (3.1.18)
bindex (0.8.1)
bootsnap (1.12.0)
msgpack (~> 1.2)
@@ -131,12 +131,14 @@ GEM
crass (1.0.6)
database_cleaner (1.8.5)
date (3.3.3)
- devise (4.7.3)
+ devise (4.9.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
+ devise-i18n (1.11.0)
+ devise (>= 4.9.0)
diff-lcs (1.4.4)
docile (1.3.5)
domain_name (0.5.20190701)
@@ -451,7 +453,8 @@ DEPENDENCIES
capistrano-rbenv (~> 2.1)
capybara (~> 3.29)
database_cleaner (~> 1.8.5)
- devise (~> 4.7.1)
+ devise (~> 4.9.1)
+ devise-i18n (~> 1.11.0)
dotenv-rails (~> 2.7.1)
fabrication (~> 2.20)
faker (~> 2.15)
diff --git a/app/admin/category.rb b/app/admin/category.rb
index ed3b8ca15..9a80ac39d 100644
--- a/app/admin/category.rb
+++ b/app/admin/category.rb
@@ -21,10 +21,7 @@
row :updated_at
row :icon_name
row :name_translations do
- cat.name_translations.map do |locale, translation|
- tag.strong("#{I18n.t("locales.#{locale}", locale: locale)}: ") +
- tag.span(translation)
- end.join(" | ").html_safe
+ render_translations(cat.name_translations)
end
end
end
diff --git a/app/admin/document.rb b/app/admin/document.rb
index 136a6d2cf..55c9d0fa8 100644
--- a/app/admin/document.rb
+++ b/app/admin/document.rb
@@ -1,5 +1,5 @@
ActiveAdmin.register Document do
- permit_params *Document.attribute_names
+ permit_params :label, :title, :content
index do
id_column
@@ -16,16 +16,20 @@
t.documentable
end
row :label
- row :title
- row :content
+ row :title_translations do
+ render_translations(t.title_translations)
+ end
+ row :content_translations do
+ render_translations(t.content_translations, "
")
+ end
end
end
form do |f|
f.inputs do
f.input :label
- f.input :title, as: :string
- f.input :content
+ f.input :title, as: :text
+ f.input :content, as: :text
end
f.actions
end
diff --git a/app/admin/organization.rb b/app/admin/organization.rb
index a8d75a707..825cb1937 100644
--- a/app/admin/organization.rb
+++ b/app/admin/organization.rb
@@ -46,5 +46,6 @@ def destroy
filter :city, as: :select, collection: -> { Organization.pluck(:city).uniq }
filter :neighborhood
- permit_params *Organization.attribute_names
+ permit_params :name, :email, :web, :phone, :city, :neighborhood,
+ :address, :description, :public_opening_times
end
diff --git a/app/admin/post.rb b/app/admin/post.rb
index 5aef7fe3c..43c32daf2 100644
--- a/app/admin/post.rb
+++ b/app/admin/post.rb
@@ -30,7 +30,8 @@
f.actions
end
- permit_params :type, :tag_list, *Post.attribute_names
+ permit_params :type, :tag_list, :title, :category_id, :user_id,
+ :description, :organization_id, :active, :is_group
filter :type, as: :select, collection: -> { Post.subclasses }
filter :id
diff --git a/app/admin/user.rb b/app/admin/user.rb
index ff4690e2b..ada5346ee 100644
--- a/app/admin/user.rb
+++ b/app/admin/user.rb
@@ -77,6 +77,6 @@
end
end
- permit_params *User.attribute_names,
- members_attributes: Member.attribute_names
+ permit_params :username, :email, :phone, :postcode, :gender,
+ members_attributes: [:organization_id, :active, :manager]
end
diff --git a/app/helpers/active_admin_helper.rb b/app/helpers/active_admin_helper.rb
new file mode 100644
index 000000000..8e43496a7
--- /dev/null
+++ b/app/helpers/active_admin_helper.rb
@@ -0,0 +1,8 @@
+module ActiveAdminHelper
+ def render_translations(attribute, joiner = " | ")
+ attribute.map do |locale, translation|
+ tag.strong("#{I18n.t("locales.#{locale}", locale: locale)}: ") +
+ tag.span(translation)
+ end.join(joiner).html_safe
+ end
+end
diff --git a/app/models/document.rb b/app/models/document.rb
index 6cbb0a814..ff42de6c9 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -1,6 +1,8 @@
class Document < ApplicationRecord
belongs_to :documentable, polymorphic: true, optional: true
+ translates :title, :content
+
def self.terms_and_conditions
where(label: "t&c", documentable_id: nil).first
end
diff --git a/app/views/devise/mailer/confirmation_instructions.ca.html.erb b/app/views/devise/mailer/confirmation_instructions.ca.html.erb
deleted file mode 100644
index 3921f3157..000000000
--- a/app/views/devise/mailer/confirmation_instructions.ca.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-
Benvingut <%= @email %>!
- -Confirma el teu compte fent clic en el següent enllaç:
- -<%= link_to 'Confirmar compte', confirmation_url(@resource, :confirmation_token => @token) %>
diff --git a/app/views/devise/mailer/confirmation_instructions.es.html.erb b/app/views/devise/mailer/confirmation_instructions.es.html.erb deleted file mode 100644 index 2343f5619..000000000 --- a/app/views/devise/mailer/confirmation_instructions.es.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -¡Bienvenido <%= @email %>!
- -Confirma tu cuenta haciendo click en el siguiente link:
- -<%= link_to 'Confirmar cuenta', confirmation_url(@resource, :confirmation_token => @token) %>
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb deleted file mode 100644 index 36670f913..000000000 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -Welcome <%= @email %>!
- -You can confirm your account email through the link below:
- -<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %>
diff --git a/app/views/devise/mailer/reset_password_instructions.ca.html.erb b/app/views/devise/mailer/reset_password_instructions.ca.html.erb deleted file mode 100644 index bd2808b2a..000000000 --- a/app/views/devise/mailer/reset_password_instructions.ca.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -Hola <%= @resource.email %>!
- -S'ha sol·licitat el canvi de la teva contrasenya. Pots canviar-la a travès del següent enllaç.
- -<%= link_to 'Canviar contrasenya', edit_password_url(@resource, :reset_password_token => @token) %>
- -Si tu no has sol·licitat el canvi de contrasenya, no facis cas d'aquest correu.
-La teva contrasenya no canviarà fins que no facis clic a l'enllaç.
diff --git a/app/views/devise/mailer/reset_password_instructions.es.html.erb b/app/views/devise/mailer/reset_password_instructions.es.html.erb deleted file mode 100644 index 1f5716d49..000000000 --- a/app/views/devise/mailer/reset_password_instructions.es.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -Hola <%= @resource.email %>!
- -Se ha solicitado el cambio de tu contraseña. Puedes cambiarlo a través del siguiente enlace.
- -<%= link_to 'Cambiar mi contraseña', edit_password_url(@resource, :reset_password_token => @token) %>
- -Si tu no has solicitado un cambio de contraseña ignora este mail.
-Tu password no cambiará hasta que no accedas al link.
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb deleted file mode 100644 index 93de6d05d..000000000 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -Hello <%= @resource.email %>!
- -Someone has requested a link to change your password. You can do this through the link below.
- -<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>
- -If you didn't request this, please ignore this email.
-Your password won't change until you access the link above and create a new one.
diff --git a/app/views/devise/mailer/unlock_instructions.ca.html.erb b/app/views/devise/mailer/unlock_instructions.ca.html.erb deleted file mode 100644 index c1a3ce628..000000000 --- a/app/views/devise/mailer/unlock_instructions.ca.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -Hola <%= @resource.email %>!
- -El teu compte ha estat bloquejat després de diversos intents d'entrada.
- -Per desbloquejar el teu compte accedeix al següent enllaç:
- -<%= link_to 'Desbloquejar compte', unlock_url(@resource, :unlock_token => @token) %>
diff --git a/app/views/devise/mailer/unlock_instructions.es.html.erb b/app/views/devise/mailer/unlock_instructions.es.html.erb deleted file mode 100644 index 607993de4..000000000 --- a/app/views/devise/mailer/unlock_instructions.es.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -¡Hola <%= @resource.email %>!
- -Tu cuenta ha sido bloqueada después de varios intentos fallidos de acceso.
- -Accede al siguiente link para desbloquear tu cuenta:
- -<%= link_to 'Desbloquear mi cuenta', unlock_url(@resource, :unlock_token => @token) %>
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb deleted file mode 100644 index f59615fed..000000000 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -Hello <%= @resource.email %>!
- -Your account has been locked due to an excessive number of unsuccessful sign in attempts.
- -Click the link below to unlock your account:
- -<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %>
diff --git a/app/views/multi_transfers/steps/_set_params.html.erb b/app/views/multi_transfers/steps/_set_params.html.erb index 9b79dc876..bad1aa3df 100644 --- a/app/views/multi_transfers/steps/_set_params.html.erb +++ b/app/views/multi_transfers/steps/_set_params.html.erb @@ -10,9 +10,7 @@ input_html: { value: @transfer_hours, min: 0, - max: 20, - "data-rule-either-hours-minutes-informed" => "true", - "data-rule-range" => "[0,20]" + "data-rule-either-hours-minutes-informed" => "true" } %> <%= f.input :minutes, required: false, diff --git a/app/views/shared/_post.html.erb b/app/views/shared/_post.html.erb index bd56189f6..20fe064a2 100644 --- a/app/views/shared/_post.html.erb +++ b/app/views/shared/_post.html.erb @@ -64,7 +64,7 @@