use custom layout for devise controllers
This commit is contained in:
@@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
|
|||||||
respond_to :html
|
respond_to :html
|
||||||
|
|
||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
|
layout :set_layout
|
||||||
|
|
||||||
# Prevent CSRF attacks by raising an exception.
|
# Prevent CSRF attacks by raising an exception.
|
||||||
# For APIs, you may want to use :null_session instead.
|
# For APIs, you may want to use :null_session instead.
|
||||||
@@ -22,8 +23,17 @@ class ApplicationController < ActionController::Base
|
|||||||
I18n.locale = session[:locale]
|
I18n.locale = session[:locale]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_layout
|
||||||
|
if devise_controller?
|
||||||
|
"devise"
|
||||||
|
else
|
||||||
|
"application"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def verify_captcha?(resource)
|
def verify_captcha?(resource)
|
||||||
return true unless recaptcha_keys?
|
return true unless recaptcha_keys?
|
||||||
verify_recaptcha(model: resource)
|
verify_recaptcha(model: resource)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
28
app/views/layouts/devise.html.erb
Normal file
28
app/views/layouts/devise.html.erb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<title><%= content_for?(:title) ? yield(:title) : "Participación" %></title>
|
||||||
|
<%= stylesheet_link_tag "application" %>
|
||||||
|
<%= javascript_include_tag "vendor/modernizr" %>
|
||||||
|
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<script src="https://www.google.com/recaptcha/api.js?hl=<%= I18n.locale %>"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<% if notice %>
|
||||||
|
<p class="alert-box success"><%= notice %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if alert %>
|
||||||
|
<p class="alert-box"><%= alert %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user