Module: PageHelper
- Defined in:
- app/helpers/page_helper.rb
Instance Method Summary collapse
- #editable(template_content_key, placeholder = '', default_content = '') ⇒ Object
- #inline_editable(template_content_key, placeholder = '', default_content = '') ⇒ Object
- #redactor(template_content_key, default_content = '') ⇒ Object
- #settings(group, name) ⇒ Object
Instance Method Details
#editable(template_content_key, placeholder = '', default_content = '') ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/helpers/page_helper.rb', line 25 def editable(template_content_key, placeholder='', default_content='') if @object if placeholder.empty? placeholder = template_content_key + '...' end page = @object class_underscore = @object.class.name.underscore.gsub('/', '_') content = page.template_content[template_content_key] content ||= default_content if @form_action_url """<div class='character-editor' data-input-name='#{class_underscore}[template_content][#{ template_content_key }]' data-options=\"placeholder:'#{ placeholder }';targetBlanks:true;\" >#{ content }</div>""".html_safe else content.html_safe end end end |
#inline_editable(template_content_key, placeholder = '', default_content = '') ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/page_helper.rb', line 2 def inline_editable(template_content_key, placeholder='', default_content='') if @object if placeholder.empty? placeholder = template_content_key + '...' end page = @object class_underscore = @object.class.name.underscore.gsub('/', '_') content = page.template_content[template_content_key] content ||= default_content if @form_action_url """<span class='character-editor' data-input-name='#{class_underscore}[template_content][#{ template_content_key }]' data-options=\"placeholder:'#{ placeholder }';disableReturn:true;disableToolbar:true;\" >#{ content }</span>""".html_safe else content.html_safe end end end |
#redactor(template_content_key, default_content = '') ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/helpers/page_helper.rb', line 48 def redactor(template_content_key, default_content='') if @object page = @object class_underscore = @object.class.name.underscore.gsub('/', '_') content = page.template_content[template_content_key] content ||= default_content if @form_action_url """<textarea id='redactor' class='character-redactor' placeholder='Type text here...'>#{ content }</textarea>""".html_safe else content.html_safe end end end |