Sha256: bb12f4e411ac49ba31f352974adf8ff0e0626ae9c84262320f0a35bbed0fd528

Contents?: true

Size: 983 Bytes

Versions: 8

Compression:

Stored size: 983 Bytes

Contents

module Typus
  module Controller
    module Headless

      def self.included(base)
        base.before_filter :set_resources_action_for_headless_on_index, :only => [:index, :trash]
        base.before_filter :set_resources_action_for_headless, :only => [:new, :create, :edit, :show]
        base.helper_method :headless_mode?
        base.layout :headless_layout
      end

      def set_resources_action_for_headless_on_index
        add_resources_action("Add New", {:action => "new"})
      end
      private :set_resources_action_for_headless_on_index

      def set_resources_action_for_headless
        if params[:_input]
          add_resources_action("All Entries", {:action => 'index', :id => nil})
        end
      end
      private :set_resources_action_for_headless

      def headless_layout
        headless_mode? ? "admin/headless" : "admin/base"
      end
      private :headless_layout

      def headless_mode?
        params[:_popup]
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
typus-3.1.10 lib/typus/controller/headless.rb
typus-3.1.9 lib/typus/controller/headless.rb
typus-3.1.8 lib/typus/controller/headless.rb
typus-3.1.7 lib/typus/controller/headless.rb
typus-3.1.6 lib/typus/controller/headless.rb
typus-3.1.5 lib/typus/controller/headless.rb
typus-3.1.4 lib/typus/controller/headless.rb
typus-3.1.3 lib/typus/controller/headless.rb