Sha256: ec94ab755d5c7e56f38e69dd2080e020a8d6a12de26d0e2b94f05c2365e3feb2

Contents?: true

Size: 572 Bytes

Versions: 43

Compression:

Stored size: 572 Bytes

Contents

module Releaf::ActionController::Views
  extend ActiveSupport::Concern

  included do
    helper_method :active_view
  end

  # Returns action > view translation hash
  # @return Hash
  def action_views
    {
      new: :edit,
      update: :edit,
      create: :edit,
    }
  end

  # Returns generic view name for given action
  # @return String
  def action_view(name_of_action)
    action_views[name_of_action.to_sym] || name_of_action
  end

  # Returns generic view name for current action
  # @return String
  def active_view
    action_view(action_name)
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
releaf-core-1.0.5 app/lib/releaf/action_controller/views.rb
releaf-core-1.0.4 app/lib/releaf/action_controller/views.rb
releaf-core-1.0.3 app/lib/releaf/action_controller/views.rb