Sha256: b3be25e183020367816a02770bb44cbe923ba68cf33fafe42b46c6c6a4634deb

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 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
        add_resources_action("All Entries", {:action => 'index', :id => nil})
      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

2 entries across 2 versions & 1 rubygems

Version Path
typus-3.1.2 lib/typus/controller/headless.rb
typus-3.1.1 lib/typus/controller/headless.rb