Module: EditorHelper

Defined in:
app/helpers/editor_helper.rb

Instance Method Summary collapse

Instance Method Details

#editor_defaults(language, options, styles = '') ⇒ Object



2
3
4
5
6
7
# File 'app/helpers/editor_helper.rb', line 2

def editor_defaults(language, options, styles = '')
  {class: styles,
   data: {placeholder: I18n.t(:editor_placeholder),
          'editor-language' => language},
   rows: 15}.deep_merge(options)
end

#read_only_editor(content, language, options = {}) ⇒ Object



9
10
11
12
# File 'app/helpers/editor_helper.rb', line 9

def read_only_editor(content, language, options = {})
  editor_options = editor_defaults(language, options.deep_merge(data: { readonly: true }), 'editor')
  text_area_tag 'solution[content]', content, editor_options
end

#spell_checked_editor(name, options = {}) ⇒ Object



14
15
16
17
# File 'app/helpers/editor_helper.rb', line 14

def spell_checked_editor(name, options = {})
  editor_options = editor_defaults('markdown', options, 'form-control mu-spell-checked-editor')
  text_area_tag name, '', editor_options
end