Skip to content

Instantly share code, notes, and snippets.

@bassettsj
Created November 12, 2013 20:55
Show Gist options
  • Select an option

  • Save bassettsj/7438518 to your computer and use it in GitHub Desktop.

Select an option

Save bassettsj/7438518 to your computer and use it in GitHub Desktop.
module ApplicationHelper
# Only things with theoretically near universal potential use should go here.
def thumbnail_for(core_record)
if core_record.thumbnail
return core_record.thumbnail
else
return core_record.canonical.class.to_s
end
end
# Generates an array of link/li tags that should breadcrumb back to the Root Collection
def breadcrumb_to_root(set, breadcrumb = [])
if breadcrumb.empty?
breadcrumb << content_tag(:li, set.title, class: 'active')
if current_user.can? :edit, set
# Want to add a new breadcrump to add a collection or upload here
end
end
if set.parent.nil?
return breadcrumb.reverse
else
# This is a giant kludge, for some reason neu:1 gets an id param tacked on if done the regular way
if set.parent.id.eql?('neu:1')
breadcrumb << content_tag(:li, link_to(set.parent.title, community_path(set.parent.identifier)))
else
breadcrumb << content_tag(:li, link_to(set.parent.title, set.parent))
end
breadcrumb_to_root(set.parent, breadcrumb)
end
end
end
@bassettsj

Copy link
Copy Markdown
Author
<li>
              <a href="#" id="addToSet" data-pid="neu:1" data-original-title="" title=""><i class="icon-plus-sign-alt"></i> Add</a><div class="popover fade right in" style="top: 115px; left: 499.5px; display: block;"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content">

          <a href="/collections/new?department_parent=neu%3A1" class="btn btn-mini">New Collection</a>
          <a href="/departments/new?department_parent=neu%3A1" class="btn btn-mini">New Department</a>
        </div></div>
            </li>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment