Sha256: 18f8076038029599a507e6bf2ca727b9e41b19e43991ae22e9af8146ecb68c0a

Contents?: true

Size: 1.34 KB

Versions: 118

Compression:

Stored size: 1.34 KB

Contents

<%= form_for [:admin, object], html: {multipart: true, class: 'upload-button'} do |f| %>
  <%= f.file_field file_attribute,
    class: 'fileupload fileupload--field', multiple: true,
    name: "#{f.object_name}[#{file_attribute}]", tabindex: '-1' %>
  <%= hidden_field_tag("#{f.object_name}[upload_hash]", Time.current.hash) if object.respond_to?(:upload_hash) %>
  <%= f.label file_attribute, data: {alchemy_hotkey: 'alt+n'} do %>
    <div class="button_with_label">
      <span class="icon_button" tabindex="0"><%= render_icon :upload %></span>
      <label>
        <%= local_assigns[:label] ||
          Alchemy.t(:button_label, scope: [:uploader, object.class.model_name.i18n_key]) %>
      </label>
    </div>
  <% end %>
<% end %>

<% file_types = local_assigns[:file_types].presence ||
  configuration(:uploader)['allowed_filetypes'][object.class.model_name.collection] || ['*'] %>

<script type='text/javascript'>
  $(function() {
    var options = {
      file_types: '<%= file_types.join("|") %>',
      dropzone: '<%= local_assigns[:dropzone] || '#main_content' %>',
      complete: function() {
        var url = '<%= redirect_url.html_safe %>';
      <% if local_assigns[:in_dialog] %>
        $.get(url, null, null, 'script');
      <% else %>
        Turbolinks.visit(url);
      <% end %>
      }
    };
    Alchemy.Uploader(options);
  });
</script>

Version data entries

118 entries across 118 versions & 1 rubygems

Version Path
alchemy_cms-6.1.10 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.9 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.8 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.7 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.6 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-7.0.0.pre.b app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.5 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.0.14 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.4 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-7.0.0.pre.a app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.0.13 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.3 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.2 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.1 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.1.0 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.0.12 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.0.11 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.0.10 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-5.3.8 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-6.0.9 app/views/alchemy/admin/uploader/_button.html.erb