Sha256: 8defcd6afce0147edf934562afa6fb72216de1c3a61c08db17264447b4c07fe2

Contents?: true

Size: 947 Bytes

Versions: 9

Compression:

Stored size: 947 Bytes

Contents

<div id="filter_bar">
  <h2><%= Alchemy.t('Filter') %></h2>
  <%= select_tag(
    'resource_filter',
    options_for_select(
      resource_filter_select, params[:filter]
    ),
    include_blank: Alchemy.t(:all, scope: ['resources', resource_name, 'filters']),
    data: { remote: !!request.xhr? },
    class: 'alchemy_selectbox'
  ) %>
</div>

<script type="text/javascript">
  $(function() {
    $('#resource_filter').on('change', function(e) {
      var $this = $(this);
      var url = '<%= resources_path(resource_handler.namespaced_resources_name, search_filter_params.except(:filter).to_h) %>';
      if ($this.data('remote') === true) {
        $.get(url, {filter: $this.val()}, null, 'script');
      } else {
        Alchemy.pleaseWaitOverlay();
        delimiter = url.match(/\?/) ? '&' : '?';
        window.location = url + delimiter + 'filter=' + encodeURIComponent($this.val());
      }
      return false;
    });
  });
</script>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alchemy_cms-4.0.6 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.5 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.4 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.3 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.2 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.1 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.0 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.0.rc2 app/views/alchemy/admin/resources/_filter_bar.html.erb
alchemy_cms-4.0.0.rc1 app/views/alchemy/admin/resources/_filter_bar.html.erb