Sha256: 6967eb7133795d6b3f7f6ff7f0e2cca4d69fffac675d8d2b1753ddd963de00ad

Contents?: true

Size: 1.22 KB

Versions: 19

Compression:

Stored size: 1.22 KB

Contents

module ActiveList
  module Rails
    module Integration
      module ActionController
        def self.included(base) #:nodoc:
          base.extend(ClassMethods)
        end

        module ClassMethods
          # Permits to define and generate methods to manage dynamic
          # table ActiveList
          def list(*args, &block)
            options = args.extract_options!
            options[:controller] = self
            args << options
            generator = ActiveList::Generator.new(*args, &block)
            class_eval(generator.controller_method_code, __FILE__, __LINE__)
            ActionView::Base.send(:class_eval, generator.view_method_code, __FILE__, __LINE__)
          end
        end
      end

      module ViewsHelper
        # Calls the generated view helper
        def list(*args, &block)
          options = args.extract_options!
          name = args.shift
          kontroller = controller.class
          begin
            helper_method = "_#{kontroller.controller_name}_#{__method__}_#{name || kontroller.controller_name}_tag".to_sym
            kontroller = kontroller.superclass
          end until respond_to?(helper_method)
          send(helper_method, options, &block)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
active_list-8.1.0 lib/active_list/rails/integration.rb
active_list-7.3.0 lib/active_list/rails/integration.rb
active_list-8.0.0 lib/active_list/rails/integration.rb
active_list-7.2.0 lib/active_list/rails/integration.rb
active_list-7.1.0 lib/active_list/rails/integration.rb
active_list-7.0.0 lib/active_list/rails/integration.rb
active_list-6.10.0 lib/active_list/rails/integration.rb
active_list-6.9.4 lib/active_list/rails/integration.rb
active_list-6.9.3 lib/active_list/rails/integration.rb
active_list-6.9.2 lib/active_list/rails/integration.rb
active_list-6.9.1 lib/active_list/rails/integration.rb
active_list-6.9.0 lib/active_list/rails/integration.rb
active_list-6.8.3 lib/active_list/rails/integration.rb
active_list-6.8.2 lib/active_list/rails/integration.rb
active_list-6.8.1 lib/active_list/rails/integration.rb
active_list-6.8.0 lib/active_list/rails/integration.rb
active_list-6.7.6 lib/active_list/rails/integration.rb
active_list-6.7.5 lib/active_list/rails/integration.rb
active_list-6.7.4 lib/active_list/rails/integration.rb