Module: MdSimpleEditor::Rails::MdHelper
- Defined in:
- app/helpers/md_simple_editor/rails/md_helper.rb
Instance Method Summary collapse
- #header_tags ⇒ Object
- #link_and_image_tools ⇒ Object
- #md_simple_editor(klass = '') ⇒ Object
- #text_tools ⇒ Object
Instance Method Details
#header_tags ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/md_simple_editor/rails/md_helper.rb', line 30 def content_tag(:div, :class => 'btn-group') do (type: 'button', class: "#{@md_builder.default_class} md_h1") do content_tag(:strong, 'H1') end + (type: 'button', class: "#{@md_builder.default_class} md_h2") do content_tag(:strong, 'H2') end + (type: 'button', class: "#{@md_builder.default_class} md_h3") do content_tag(:strong, 'H3') end + (type: 'button', class: "#{@md_builder.default_class} md_h4") do content_tag(:strong, 'H4') end + (type: 'button', class: "#{@md_builder.default_class} md_h5") do content_tag(:strong, 'H5') end end end |
#link_and_image_tools ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'app/helpers/md_simple_editor/rails/md_helper.rb', line 50 def link_and_image_tools content_tag(:div, :class => 'btn-group') do (:type => 'button', :class => "#{@md_builder.default_class} md_link") do fa_icon 'link' end + (:type => 'button', :class => "#{@md_builder.default_class} md_camera-retro") do fa_icon 'camera-retro' end end end |
#md_simple_editor(klass = '') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/md_simple_editor/rails/md_helper.rb', line 6 def md_simple_editor(klass='') @md_builder = MdBuilder.new(klass) content_tag(:div, :id => 'md-editor') do content_tag(:div, :class => 'btn-toolbar', role: 'toolbar') do + text_tools + link_and_image_tools + content_tag(:div, class: 'btn-group pull-righ') do (:type => 'button', :class => "#{@md_builder.default_class} btn-primary preview_md") do 'Preview' end end end + content_tag(:div, :id => 'md-text') do yield end + content_tag(:div, class: 'panel panel-success preview-panel', hidden: true) do content_tag(:div, class: 'panel-heading') do 'Preview' end + content_tag(:div, :id => 'md-preview', class: 'panel-body') do end end end end |
#text_tools ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/helpers/md_simple_editor/rails/md_helper.rb', line 61 def text_tools content_tag(:div, :class => 'btn-group') do (type: 'button', class: "#{@md_builder.default_class} md_italic") do fa_icon 'italic' end + (type: 'button', class: "#{@md_builder.default_class} md_bold") do fa_icon 'bold' end + (:type => 'button', class: "#{@md_builder.default_class} md_list-ul") do fa_icon 'list-ul' end + (:type => 'button', class: "#{@md_builder.default_class} md_list-ol") do fa_icon 'list-ol' end + (:type => 'button', class: "#{@md_builder.default_class} md_indent") do fa_icon 'indent' end + (:type => 'button', class: "#{@md_builder.default_class} md_underline") do fa_icon 'underline' end + (:type => 'button', class: "#{@md_builder.default_class} md_table") do fa_icon 'table' end + (:type => 'button', class: "#{@md_builder.default_class} md_square") do fa_icon 'square' end + (:type => 'button', class: "#{@md_builder.default_class} md_minus") do fa_icon 'minus' end end end |