denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyNewsletters/app/views/shiny_newsletters/admin/editions/_element.html.erb

Summary

Maintainability
Test Coverage
<% if current_user.can? :edit, :newsletter_templates %>
<tr id="sorted_<%= id %>">
  <td class="handle" hidden><i class="cil-elevator"></i></td>
<% else %>
<tr>
<% end %>
  <td>
  <% if element_type == 'short_text' %>
    <%= fields.label content, name.humanize %><br>
    <%= fields.text_field content %>
  <% elsif element_type == 'long_text' %>
    <%= fields.label content, name.humanize %><br>
    <%= fields.text_area content %>
  <% elsif element_type == 'html' %>
    <%= fields.label content, name.humanize %><br>
    <%= fields.cktext_area content, ckeditor: { customConfig: '/js/ckeditor/config.js' } %>
  <% elsif element_type == 'image' %>
    <%= fields.label 'image', name.humanize %><br>
    <% if image.attached? %>
    <%= image_tag url_for( image.variant( resize_to_limit: [ nil, 150 ] ) ), class: 'admin-image-thumbnail' %>
    &nbsp;(<%= image.filename %>)
    <% end %>
    <%= fields.file_field 'image', accept: 'image/png,image/gif,image/jpeg' %>
  <% else %>
    [ <%= t( 'shinycms.admin.elements.unknown_type' ) %> ]
  <% end %>
  </td>
</tr>