Last active
December 13, 2015 17:09
-
-
Save teaforthecat/4945831 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wraps third..+ paragraphs in div.more_content | |
# first two paragraphs are left in tack | |
def read_more_content html | |
first, second, *rest = Nokogiri::HTML::fragment(html).children | |
out = first.to_s + second.to_s | |
if rest.present? | |
out << "\n\n<div class=\"more_content\">" | |
out << rest.map(&:to_s).reduce(:+) | |
out << "</div>" | |
end | |
out | |
end | |
def bip object, attr, args={} | |
path = admin_bip_path(object, model: object.class.to_s.parameterize) | |
best_in_place object, attr, args.merge(path: path) | |
end | |
def pjax_section_link resource, section, classes=nil | |
link_to(section.humanize.upcase, | |
send("#{resource.class.to_s.downcase}_section_path", resource, | |
section: section), | |
class: "pjax #{classes}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment