Module: Portfolio::SitesHelper
- Included in:
- Admin::ApiController
- Defined in:
- app/helpers/portfolio/sites_helper.rb
Instance Method Summary collapse
- #items_to_show(site) ⇒ Object
- #render_markdown(text) ⇒ Object
- #unless_blank(attribute, name) ⇒ Object
Instance Method Details
#items_to_show(site) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/portfolio/sites_helper.rb', line 14 def items_to_show site Portfolio::SiteItem.subclasses.each do |klass| return true if klass.where(site: site).published.count > 0 end return false end |
#render_markdown(text) ⇒ Object
3 4 5 6 7 8 |
# File 'app/helpers/portfolio/sites_helper.rb', line 3 def render_markdown text # TODO: move this construction to an initializer renderer = Redcarpet::Render::HTML.new(hard_wrap: true) markdown = Redcarpet::Markdown.new(renderer, autolink: true, tables: true) markdown.render text.to_s end |
#unless_blank(attribute, name) ⇒ Object
10 11 12 |
# File 'app/helpers/portfolio/sites_helper.rb', line 10 def unless_blank attribute, name attribute.blank? ? "<Empty #{name}>" : attribute end |