Sha256: d8dc316bc2d25720d4ce00c6fda1c600172c8481fe0e45ad90821339468380ee

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 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 %>
  <script type="text/javascript">
    $(function() {
      var el = document.getElementById('<%= field.html_id %>')
      var options = JSON.parse(el.getAttribute('data-easymde-options'));

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

Version data entries

1 entries across 1 versions & 1 rubygems

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