Sha256: ff3140a38d4849ecbc371969d4b435f24a28365972a0427d82cf2bb7d4e583a3

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

module Admin::Resources::ListHelper

  def list_actions
    resources_actions_for_current_role.map do |body, url, options|
      path = params.dup.merge!(url).compact.cleanup
      link_to Typus::I18n.t(body), path, options
    end.compact.reverse.join(" / ").html_safe
  end

  def resources_actions_for_current_role
    resources_actions.reject do |body, url, options|
      admin_user.cannot?(url[:action], @resource.name)
    end
  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

13 entries across 13 versions & 1 rubygems

Version Path
brainsome_typus-4.0.0.beta13 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta12 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta11 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta10 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta9 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta8 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta7 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta6 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta5 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta4 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta3 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta2 app/helpers/admin/resources/list_helper.rb
brainsome_typus-4.0.0.beta1 app/helpers/admin/resources/list_helper.rb