-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Customizing views
Kyle Lamy edited this page Aug 27, 2015
·
5 revisions
To customize the views that doorkeeper uses, you have to generate them into your app.
rails generate doorkeeper:views
This will copy all the views to app/views/doorkeeper
.
Doorkeeper looks first for its views in that subfolder, and if not found it will fall back to its default.
To use your own layouts you can override each layout separately:
In config/application.rb
, add:
config.to_prepare do
# Only Applications list
Doorkeeper::ApplicationsController.layout "my_layout"
# Only Authorization endpoint
Doorkeeper::AuthorizationsController.layout "my_layout"
# Only Authorized Applications
Doorkeeper::AuthorizedApplicationsController.layout "my_layout"
end
Since doorkeeper is an isolated engine, you'll have to prefix main_app
in all routes and helpers that belong to your application:
<% if main_app.user_signed_in? %>
<%= link_to "Sign Out", main_app.destroy_user_session_path, :method => 'delete' %>
<% else %>
<%= link_to "Sign In", main_app.new_user_session_path %>
<% end %>
If you need access to your ApplicationHelper methods, you can include them in config/application.rb
:
config.to_prepare do
# include only the ApplicationHelper module
Doorkeeper::ApplicationController.helper ApplicationHelper
# include all helpers from your application
Doorkeeper::ApplicationController.helper YourApp::Application.helpers
end