Sha256: b62e07f8ec04d19154500dee6f66ac51821dd0375985dc8ae27a458bfcc7903d

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

<% params_to_keep = [:size, :tagged_with, :query, :element_id, :options, :content_id, :_] %>

<div id="filter_bar">
  <h2><%= _t('Filter') %></h2>
  <%= select_tag(
    'picture_filter',
    options_for_select([
      [_t(:all_pictures), ''],
      [_t(:last_upload_only), 'last_upload'],
      [_t(:recently_uploaded_only), 'recent']
    ], params[:filter]),
    :data => { :remote => !!request.xhr? },
    :class => 'alchemy_selectbox'
  ) %>
</div>

<script type="text/javascript">
  $(function() {
    $('#picture_filter').on('change', function(e) {
      var $this = $(this);
      var url = '<%= alchemy.admin_pictures_path(merge_params_only(params_to_keep)).html_safe %>';
      if ($this.data('remote') === true) {
        $.get(url, {filter: $this.val()}, null, 'script');
      } else {
        Alchemy.pleaseWaitOverlay();
        delimiter = url.match(/\?/) ? '&' : '?';
        window.location = url + delimiter + 'filter=' + $this.val();
      }
      return false;
    });
  });
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alchemy_cms-2.6.0.rc5 app/views/alchemy/admin/pictures/_filter_bar.html.erb