Method: Binda::ComponentsHelper#get_sort_index_link

Defined in:
app/helpers/binda/components_helper.rb

Get the sort index link

This helper generate the a link to the page where to sort components, or

a broken link that tells you that you have too many components to go to that page.


9
10
11
12
13
14
15
# File 'app/helpers/binda/components_helper.rb', line 9

def get_sort_index_link
  if @structure.components.length < Component.sort_limit
    link_to "<i class=\"fa fa-random\" aria-hidden=\"true\"></i>Sort #{ @structure.name.humanize.split.map(&:capitalize).join(' ').pluralize }".html_safe, structure_components_sort_index_path, class: 'main-header--link b-btn b-btn-primary'
  else
    link_to "Sort #{ @structure.name.humanize.split.map(&:capitalize).join(' ').pluralize }", '#', class: 'main-header--link b-btn b-btn-primary', onclick: "alert(\"Sorry! It's not possible to sort #{@structure.name.pluralize} anymore. You currently have more than #{Component.sort_limit} #{@structure.name.pluralize} which is the maximum limit.\")"
  end
end