Module: ContentBlockHelper

Defined in:
app/helpers/content_block_helper.rb

Instance Method Summary collapse

Instance Method Details

#editable_content_block(content_block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/content_block_helper.rb', line 3

def editable_content_block(content_block)
  return raw(content_block.value) unless can? :update, content_block
  capture do
    concat (:div, id: dom_id(content_block, 'preview')) { 
      concat raw(content_block.value) 
      concat button_tag "Edit", class: "btn btn-primary", data: {
        behavior: 'reveal-editor', target: '#' + dom_id(content_block, 'edit')
      }
    } 
    concat form_for([sufia, content_block] ) { |f|
      concat f.text_area :value, id: "text_area_#{content_block.name}", class: "tinymce", rows: 20, cols: 120
      concat f.submit 'Save', class: "btn btn-primary"
    }

  end
end

#tiny_mce_stuffObject



20
21
22
23
24
25
# File 'app/helpers/content_block_helper.rb', line 20

def tiny_mce_stuff
  capture do
    concat tinymce_assets
    concat tinymce
  end
end