Sha256: 8f72fd526aa2ee0f776a88adcca18e6fdb6e2ca1834965acfbdb7b143802c2b9

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

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

<% file_types = local_assigns[:file_types].presence ||
  configuration(:uploader)['allowed_filetypes'][model_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 %>
        Alchemy.pleaseWaitOverlay();
        window.location.href = url;
      <% end %>
      }
    };
    Alchemy.Uploader(options);
  });
</script>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alchemy_cms-3.4.2 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.4.1 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.3.3 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.3.2 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.4.0 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.4.0.rc1 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.3.1 app/views/alchemy/admin/uploader/_button.html.erb
alchemy_cms-3.3.0 app/views/alchemy/admin/uploader/_button.html.erb