Sha256: 476e15ba253ea4054f4ce6e0719224a70ec94466b7401aec3e0d9de971a902b2

Contents?: true

Size: 928 Bytes

Versions: 12

Compression:

Stored size: 928 Bytes

Contents

module Admin::Resources::ListHelper

  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

  def build_actions(&block)
    render "helpers/admin/resources/actions", :block => block
  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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
typus-3.1.0.rc18 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc17 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc16 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc15 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc14 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc13 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc12 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc11 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc10 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc9 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc8 app/helpers/admin/resources/list_helper.rb
typus-3.1.0.rc7 app/helpers/admin/resources/list_helper.rb