Method: Cms::ContentBlockHelper#block_row_tag

Defined in:
app/helpers/cms/content_block_helper.rb

#block_row_tag(block) ⇒ Object

Prints the <tr> for each block. Adds classes based on:

  • Name/id of the block

  • If a block is published/draft

  • If the user can edit/publish it



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/cms/content_block_helper.rb', line 11

def block_row_tag(block)
  cname = class_name_for(block)
  can_modify = current_user.able_to_modify?(block)

  options = {
      :id => "#{cname}_#{block.id}",
      :class => cname
  }
  options[:class] += block.class.publishable? && !block.published? ? ' draft' : ' published'
  options[:class] += ' non-editable' unless can_modify && current_user.able_to?(:edit_content)
  options[:class] += ' non-publishable' unless can_modify && current_user.able_to?(:publish_content)
  tag "tr", options, true
end