<commit_before>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<commit_msg>We set resources action on headless only when params[:_input].<commit_after>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
{'fraction_non_alphanumeric': 0.08341559723593288, 'fraction_numerical': 0.0, 'mean_word_length': 3.078470824949698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2468789', 'n_tokens_mistral': 637, 'n_tokens_neox': 616, 'n_words': 130}