Sha256: 9e4579fcc7ea498f3e7f3d5d6e782aa56b1be2604132ea86e4816d034c1eb151

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

<%#
# SimpleMarkdown Form Partial

This partial renders a WYSIWYG text area to help writing Markdown text

## Local variables:

- `f`:
  A Rails form generator, used to help create the appropriate input fields.
- `field`:
  An instance of Administrate::Field::SimpleMarkdown.
%>

<div class="field-unit__label">
  <%= f.label field.attribute %>
</div>
<div class="field-unit__field simple_markdown">
  <%= f.text_area field.attribute,
    data: {
      easymde_options: field.easymde_options
    }
  %>
</div>
<%= content_for :javascript do %>
  <%= javascript_tag nonce: true do %>
    $(function() {
      var el = document.getElementById('<%= field.html_id %>')
      var options = JSON.parse(el.getAttribute('data-easymde-options'));

      new EasyMDE(Object.assign({}, { element: el }, options));
    });
  <%- end %>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administrate-field-simple_markdown-0.7.0 app/views/fields/simple_markdown/_form.html.erb
administrate-field-simple_markdown-0.6.0 app/views/fields/simple_markdown/_form.html.erb