-
Notifications
You must be signed in to change notification settings - Fork 330
Dynamic action links groups
Sergio Cambra edited this page Aug 25, 2014
·
5 revisions
It's possible to add an action which display dynamically a group of actions, adding a controller action which builds the action links group and displays it with ActiveScaffold.display_dynamic_action_group
class TeamsController < ApplicationController
active_scaffold :team do |conf|
....
conf.action_links.member.add 'report', :position => false
....
end
def report
@record = find_if_allowed(params[:id], :read)
end
end
# report.js.erb
<%
links = @record.report_types.map do |report_type|
link_to(report_type.to_label, report_path(@record, report_type))
end
%>
<%= display_dynamic_action_group active_scaffold_config.action_links[:report], links, @record, :class => 'report_submenu' %>