Sha256: cf8d0ccfe2b675e3451a615014104d43d4af74a85d8a34b345bb007209dc7ba0
Contents?: true
Size: 819 Bytes
Versions: 2
Compression:
Stored size: 819 Bytes
Contents
module RedisSnippets module SnippetsHelper def snippet_content(snippet_name) RedisSnippets::Snippets.send(snippet_name) end # Return true if snippet has content. def snippet_has_content?(snippet_name) !RedisSnippets::Snippets.send(snippet_name).blank? end def snippet(snippet_name, classes=nil) return '' if controller.status == 404 content = snippet_content(snippet_name) return '' if content.blank? build_snippet(content, snippet_class_list(snippet_name, classes)) end def snippet_class_list(snippet_name, classes) ['snippet', classes || snippet_name.to_s].compact.join(' ').html_safe end def build_snippet(content, classes) content_tag(:div, content.html_safe, :class => classes) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis_snippets-0.0.4 | app/helpers/redis_snippets/snippets_helper.rb |
redis_snippets-0.0.3 | app/helpers/redis_snippets/snippets_helper.rb |