Question

Using Rails 3.1.0, with Active Scaffold (from the git repo). My controllers have code that look like this:

active_scaffold :template do |config|
  config.create.link.inline = false
  config.actions = [:list, :search, :create, :delete]
  config.columns = [
     :name, 
     :description
    ]
  config.list.sorting = { :created_at => :desc }
end

Theoretically, this means that the "create new" link at the top of the active scaffold list should be rendered without a data-remote call, but it is still being rendered like that:

<a href="/admin/templates/new" class="new" data-remote="true" id="as_admin__templates-new--link">Create New</a>

We're also overriding _action_group.html.erb with the following, but I've deleted the file for testing and it has no effect. Here's the code in the override:

<% record ||= nil
   start_level_0_tag ||= ''
   end_level_0_tag ||= ''%>
<% action_links.traverse(controller, traverse_options) do |parent, link, options| -%>
  <% if (options[:node] == :finished_traversing) -%>
    <%= "</ul>#{(options[:level] == 0 ? "</div>#{end_level_0_tag}": '</li>')}".html_safe %>
  <% elsif (options[:node] == :start_traversing) -%>
        <% html_classes = []
           html_classes << 'hover_click' if hover_via_click? %>
  <% if options[:level] == 0 %>
           <% html_classes << 'action_group' %>
     <%= "#{start_level_0_tag}<div class=\"#{html_classes.join(' ')}\" #{"onclick=\"\"" if hover_via_click?}> #{content_tag(:div, as_(parent.name), :class => (parent.name.to_s).downcase)}<ul>".html_safe %>
  <% else %>
           <% html_classes << 'top' if options[:first_action] %>
     <%= "<li #{"class=\"#{html_classes.join(' ')}\"" unless html_classes.empty?} #{"onclick=\"\"" if hover_via_click?}>#{content_tag(:div, as_(parent.name), :class => (parent.name.to_s).downcase)}<ul>".html_safe %>
  <% end %>
  <% else -%>
    <% if options[:level] == 0 %>
      <%= "#{start_level_0_tag}#{render_group_action_link(link, url_options, options, record)}#{end_level_0_tag}".html_safe %>
    <% else %>
      <%= content_tag('li', render_group_action_link(link, url_options, options, record), options[:first_action] ? {:class => 'top'}: {}) %>
    <% end %>
  <% end -%>
<% end -%>

This is happening everywhere that I try to set the config.create.link.inline. Is there some overriding setting somewhere that I need to look for?

Was it helpful?

Solution

Do:

config.create.link.page = true

Relevant bits to reach this conclusion in helpers/view_helpers.rb and data_structures/action_link.rb.

Because there are 3 mutually exclusive properties (page, inline, popup), setting one to false does not affect the other (analyze the control flow), only setting one to true sets the other two to false.

"Read the source, Luke"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top