diff --git a/Gemfile b/Gemfile
index 6e470119..96e892b9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,4 +11,4 @@ group :development do
gem 'omniauth-twitter'
end
-gem 'devise', '>= 4.8.0'
+gem 'devise', '>= 4.9.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 737aa02c..48933fe7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -46,7 +46,7 @@ GEM
crass (1.0.6)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
- devise (4.8.1)
+ devise (4.9.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
@@ -194,7 +194,7 @@ PLATFORMS
DEPENDENCIES
activemodel
- devise (>= 4.8.0)
+ devise (>= 4.9.0)
i18n-spec (~> 0.6.0)
jeweler!
localeapp
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb
index 07e65b78..a2926990 100644
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/devise/registrations/edit.html.erb
@@ -1,4 +1,4 @@
-
<%= t('.title', resource: resource.model_name.human) %>
+<%= t('.title', resource: resource_name.to_s.humanize) %>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
@@ -38,6 +38,6 @@
<%= t('.cancel_my_account') %>
-<%= t('.unhappy') %> <%= button_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %>
+<%= t('.unhappy') %> <%= button_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure'), turbo_confirm: t('.are_you_sure') }, method: :delete %>
<%= link_to t('devise.shared.links.back'), :back %>
diff --git a/app/views/devise/shared/_error_messages.html.erb b/app/views/devise/shared/_error_messages.html.erb
index ba7ab887..cabfe307 100644
--- a/app/views/devise/shared/_error_messages.html.erb
+++ b/app/views/devise/shared/_error_messages.html.erb
@@ -1,5 +1,5 @@
<% if resource.errors.any? %>
-
+
<%= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb
index d11c0611..3f1b909b 100644
--- a/app/views/devise/shared/_links.html.erb
+++ b/app/views/devise/shared/_links.html.erb
@@ -20,6 +20,6 @@
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
- <%= link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), method: :post %>
+ <%= button_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), data: { turbo: false } %>
<% end %>
<% end %>
diff --git a/devise-i18n.gemspec b/devise-i18n.gemspec
index afe1299f..2da39d77 100644
--- a/devise-i18n.gemspec
+++ b/devise-i18n.gemspec
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Christopher Dell".freeze, "mcasimir".freeze, "Jason Barnabe".freeze]
- s.date = "2023-02-15"
+ s.date = "2023-02-19"
s.description = "Translations for the devise gem".freeze
s.email = "chris@tigrish.com".freeze
s.extra_rdoc_files = [
@@ -127,7 +127,7 @@ Gem::Specification.new do |s|
s.specification_version = 4
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q.freeze, [">= 4.8.0"])
+ s.add_runtime_dependency(%q.freeze, [">= 4.9.0"])
s.add_development_dependency(%q.freeze, [">= 2.8.0"])
s.add_development_dependency(%q.freeze, [">= 0"])
s.add_development_dependency(%q.freeze, [">= 0"])
@@ -137,7 +137,7 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q.freeze, [">= 0"])
s.add_development_dependency(%q.freeze, [">= 0"])
else
- s.add_dependency(%q.freeze, [">= 4.8.0"])
+ s.add_dependency(%q.freeze, [">= 4.9.0"])
s.add_dependency(%q.freeze, [">= 2.8.0"])
s.add_dependency(%q.freeze, [">= 0"])
s.add_dependency(%q.freeze, [">= 0"])
@@ -148,7 +148,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q.freeze, [">= 0"])
end
else
- s.add_dependency(%q.freeze, [">= 4.8.0"])
+ s.add_dependency(%q.freeze, [">= 4.9.0"])
s.add_dependency(%q.freeze, [">= 2.8.0"])
s.add_dependency(%q.freeze, [">= 0"])
s.add_dependency(%q.freeze, [">= 0"])
diff --git a/lib/generators/devise/templates/simple_form_for/registrations/edit.html.erb b/lib/generators/devise/templates/simple_form_for/registrations/edit.html.erb
index eb650590..086fe44d 100644
--- a/lib/generators/devise/templates/simple_form_for/registrations/edit.html.erb
+++ b/lib/generators/devise/templates/simple_form_for/registrations/edit.html.erb
@@ -1,4 +1,4 @@
-<%= t(".title", resource: resource.model_name.human) %>
+<%= t(".title", resource: resource_name.to_s.humanize) %>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>
@@ -30,6 +30,6 @@
<%= t(".cancel_my_account") %>
-<%= t(".unhappy") %> <%= link_to t(".cancel_my_account"), registration_path(resource_name), data: { confirm: t(".are_you_sure") }, method: :delete %>
+<%= t(".unhappy") %> <%= button_to t(".cancel_my_account"), registration_path(resource_name), data: { confirm: t(".are_you_sure"), turbo_confirm: t(".are_you_sure") }, method: :delete %>
<%= link_to t("devise.shared.links.back"), :back %>
diff --git a/spec/support/devise_i18n_views_app.rb b/spec/support/devise_i18n_views_app.rb
index 74bcf074..f882599f 100644
--- a/spec/support/devise_i18n_views_app.rb
+++ b/spec/support/devise_i18n_views_app.rb
@@ -25,12 +25,22 @@ def remember_me
def reset_password_token
end
- def model_name
+ def self.model_name
ActiveModel::Name.new(self.class)
end
+ def model_name
+ self.class.model_name
+ end
+
def errors
- ActiveModel::Errors.new(self)
+ errors = ActiveModel::Errors.new(self)
+ errors.add(:base, :invalid)
+ errors
+ end
+
+ def self.human_attribute_name(attribute, options = {})
+ attribute
end
end
USER = User.new