Module: Admin::Resources::ListHelper

Defined in:
app/helpers/admin/resources/list_helper.rb

Instance Method Summary collapse

Instance Method Details

#build_actions(&block) ⇒ Object



16
17
18
# File 'app/helpers/admin/resources/list_helper.rb', line 16

def build_actions(&block)
  render "helpers/admin/resources/actions", :block => block
end

#build_list(model, fields, items, resource = @resource.to_resource, link_options = {}, association = nil, association_name = nil) ⇒ Object

– 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. ++



25
26
27
28
29
# File 'app/helpers/admin/resources/list_helper.rb', line 25

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

#list_actionsObject



3
4
5
6
7
8
# File 'app/helpers/admin/resources/list_helper.rb', line 3

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.join(" / ").html_safe
end

#resources_actions_for_current_roleObject



10
11
12
13
14
# File 'app/helpers/admin/resources/list_helper.rb', line 10

def resources_actions_for_current_role
  resources_actions.reject do |body, url, options|
    admin_user.cannot?(url[:action], @resource.name)
  end
end