module ActiveScaffold::Helpers::ActionLinkHelpers

All extra helpers that should be included in the View. Also a dumping ground for uncategorized helpers.

Constants

NESTED_PARAMS

params which mustn’t be copying to nested links

Public Instance Methods

add_query_string_to_cached_url(link, url) click to toggle source
# File lib/active_scaffold/helpers/action_link_helpers.rb, line 197
def add_query_string_to_cached_url(link, url)
  query_string, non_nested_query_string = query_string_for_action_links(link)
  nested_params = (!link.nested_link? && non_nested_query_string)
  if query_string || nested_params
    url << (url.include?('?') ? '&' : '?')
    url << query_string if query_string
    url << non_nested_query_string if nested_params
  end
  url
end
column_in_params_conditions?(key) click to toggle source
# File lib/active_scaffold/helpers/action_link_helpers.rb, line 214
def column_in_params_conditions?(key)
  if key.match?(/!$/)
    conditions_from_params[1..-1].any? { |node| node.left.name.to_s == key[0..-2] }
  else
    conditions_from_params[0].include?(key)
  end
end
display_dynamic_action_group(action_link, links, record_or_ul_options = nil, ul_options = nil) click to toggle source
# File lib/active_scaffold/helpers/action_link_helpers.rb, line 23
def display_dynamic_action_group(action_link, links, record_or_ul_options = nil, ul_options = nil)
  ul_options = record_or_ul_options if ul_options.nil? && record_or_ul_options.is_a?(Hash)
  record = record_or_ul_options unless record_or_ul_options.is_a?(Hash)
  html = content_tag :ul, ul_options do
    safe_join(links.map { |link| content_tag :li, link })
  end
  raw "ActiveScaffold.display_dynamic_action_group('#{get_action_link_id action_link, record}', '#{escape_javascript html}');" # rubocop:disable Rails/OutputSafety
end
ignore_param_for_nested?(key) click to toggle source
# File lib/active_scaffold/helpers/action_link_helpers.rb, line 222
def ignore_param_for_nested?(key)
  NESTED_PARAMS.include?(key) || column_in_params_conditions?(key) || (nested? && nested.param_name == key)
end
sti_record?(record) click to toggle source
# File lib/active_scaffold/helpers/action_link_helpers.rb, line 157
def sti_record?(record)
  return unless active_scaffold_config.active_record?
  model = active_scaffold_config.model
  record && model.columns_hash.include?(model.inheritance_column) &&
    record[model.inheritance_column].present? && !record.instance_of?(model)
end