Sha256: 06c935636772a203688107fe561f9910abb9848ca916be78827cba0abf6812a4

Contents?: true

Size: 899 Bytes

Versions: 2

Compression:

Stored size: 899 Bytes

Contents

<div id="filter_bar">
  <h2><%= Alchemy.t('Filter') %></h2>
  <%= select_tag(
    'file_type_filter',
    options_for_select(
      Alchemy::Attachment.file_types_for_select,
      search_filter_params[:file_type]
    ),
    include_blank: Alchemy.t('Show all files'),
    data: { remote: !!request.xhr? },
    class: 'alchemy_selectbox'
  ) %>
</div>

<script type="text/javascript">
  $(function() {
    $('#file_type_filter').on('change', function(e) {
      var $this = $(this);
      var url = '<%= alchemy.admin_attachments_path(search_filter_params.except(:file_type).to_h) %>';
      if ($this.data('remote') === true) {
        $.get(url, {file_type: $this.val()}, null, 'script');
      } else {
        delimiter = url.match(/\?/) ? '&' : '?';
        Turbolinks.visit(url + delimiter + 'file_type=' + encodeURIComponent($this.val()));
      }
      return false;
    });
  });
</script>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alchemy_cms-4.1.0.rc1 app/views/alchemy/admin/attachments/_filter_bar.html.erb
alchemy_cms-4.1.0.beta app/views/alchemy/admin/attachments/_filter_bar.html.erb