noesya/osuny

View on GitHub
app/views/admin/communication/blocks/components/image/_edit.html.erb

Summary

Maintainability
Test Coverage
<%
label = t('admin.communication.blocks.components.image.input.label')
remove = t('admin.communication.blocks.components.image.input.remove')
hint = images_formats_accepted_hint
%>
<div class="mb-3">
  <div v-if="!<%= model %>.<%= property %>.id">
    <label  class="form-label"
            :for="<%= dom_id.html_safe %>">
      <%= label %>
    </label>
    <input  class="form-control"
            type="file"
            accept="<%= default_images_formats_accepted %>"
            @change="onFileImageChange( $event, <%= model %>, '<%= property %>' )"
            data-size-limit="<%= Rails.application.config.default_image_max_size %>"
            :id="<%= dom_id.html_safe %>"
            >
  </div>
  <div v-if="<%= model %>.<%= property %>.id">
    <img :src="getImageUrl(<%= model %>.<%= property %>)" class="img-fluid mb-3" />
  </div>
  <a  class="btn btn-sm text-danger"
      v-on:click="<%= model %>.<%= property %>={}"
      v-if="<%= model %>.<%= property %>.id">
      <i class="<%= Icon::DELETE %>"></i>
    <%= remove %>
  </a>
  <div v-if="!<%= model %>.<%= property %>.id" class="form-text">
    <%= hint %>
  </div>
</div>