-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add override to rails_admin show_in_game action that will navigate to…
… the correct path when viewing a Team
- Loading branch information
Kyle Fagan
committed
Feb 23, 2019
1 parent
2a9eca5
commit e47cf34
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
require 'rails_admin/config/actions' | ||
require 'rails_admin/config/actions/show_in_app' | ||
|
||
module RailsAdmin | ||
module Config | ||
module Actions | ||
class ShowInApp < RailsAdmin::Config::Actions::Base | ||
RailsAdmin::Config::Actions.register(self) | ||
|
||
register_instance_option :controller do | ||
proc do | ||
if @object.is_a?(Team) | ||
redirect_to main_app.url_for(controller: '/teams', action: 'summary', id: @object.id) | ||
else | ||
redirect_to main_app.url_for(@object) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |