Sha256: 6f2442738294c7e881b4fa9c953f25866b51bb844dd87f2ee2079ba97f1abb06

Contents?: true

Size: 937 Bytes

Versions: 15

Compression:

Stored size: 937 Bytes

Contents

module Admin
  module ListHelper

    def resources_actions
      @resources_actions ||= []
    end

    def list_actions
      resources_actions.map do |body, url, options|
        if admin_user.can?(url[:action], @resource.name)
          path = params.dup.merge!(url).compact.cleanup
          link_to Typus::I18n.t(body), path, options
        end
      end.compact.join(" / ").html_safe
    end

    #--
    # If partial `list` exists we will use it. This partial will have available
    # the `@items` so we can do whatever we want there. Notice that pagination
    # is still available.
    #++
    def build_list(model, fields, items, resource = @resource.to_resource, link_options = {}, association = nil, association_name = nil)
      render "admin/#{resource}/list", :items => items
    rescue ActionView::MissingTemplate
      build_table(model, fields, items, link_options, association, association_name)
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
typus-3.0.12 app/helpers/admin/list_helper.rb
typus-3.0.11 app/helpers/admin/list_helper.rb
typus-3.0.11.rc5 app/helpers/admin/list_helper.rb
typus-3.0.11.rc4 app/helpers/admin/list_helper.rb
typus-3.0.11.rc3 app/helpers/admin/list_helper.rb
typus-3.1.0.rc6 app/helpers/admin/list_helper.rb
typus-3.1.0.rc5 app/helpers/admin/list_helper.rb
typus-3.1.0.rc4 app/helpers/admin/list_helper.rb
typus-3.1.0.rc3 app/helpers/admin/list_helper.rb
typus-3.1.0.rc2 app/helpers/admin/list_helper.rb
typus-3.0.11.rc2 app/helpers/admin/list_helper.rb
typus-3.0.11.rc1 app/helpers/admin/list_helper.rb
typus-3.1.0.rc1 app/helpers/admin/list_helper.rb
typus-3.0.10 app/helpers/admin/list_helper.rb
typus-3.0.9 app/helpers/admin/list_helper.rb