noesya/osuny

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

Summary

Maintainability
Test Coverage
<%
label = t('admin.communication.blocks.components.file.input.label')
remove = t('admin.communication.blocks.components.file.input.remove')
hint = file_hint if hint.blank?
accept ||= '*'
%>
<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="<%= accept %>"
            @change="onFileImageChange( $event, <%= model %>, '<%= property %>' )"
            data-size-limit="<%= Rails.application.config.default_file_max_size %>"
            :id="<%= dom_id.html_safe %>">
  </div>
  <div v-if="<%= model %>.<%= property %>.id">
    <p><b>{{ <%= model %>.<%= property %>.filename }}</b></p>
    <a  class="btn btn-sm text-danger"
        v-on:click="<%= model %>.<%= property %>={}">
        <i class="<%= Icon::DELETE %>"></i>
      <%= remove %>
    </a>
  </div>
  <div v-if="<%= hint.present? %> && !<%= model %>.<%= property %>.id" class="form-text">
    <%= hint %>
  </div>
</div>