module CustomStartpage::Patches::WelcomeControllerPatch

Public Instance Methods

redirect_to_startpage() click to toggle source
# File lib/custom_startpage/patches/welcome_controller_patch.rb, line 10
def redirect_to_startpage
  return unless startpage_active?

  redirect_to(redirection_options)
end

Private Instance Methods

from_settings(key) click to toggle source
# File lib/custom_startpage/patches/welcome_controller_patch.rb, line 30
def from_settings(key)
  return unless settings[key].present?
  settings[key]
end
redirection_options() click to toggle source
# File lib/custom_startpage/patches/welcome_controller_patch.rb, line 22
def redirection_options
  {
    controller: from_settings("controller"),
    action:     from_settings("action"),
    id:         from_settings("id")
  }
end
settings() click to toggle source
# File lib/custom_startpage/patches/welcome_controller_patch.rb, line 35
def settings
  Setting.plugin_custom_startpage
end
startpage_active?() click to toggle source
# File lib/custom_startpage/patches/welcome_controller_patch.rb, line 18
def startpage_active?
  from_settings("active") && from_settings("controller")
end