Sha256: d9752543a9f2ed425cc6e4ed8af2e8f3cdd17f5331004b27831192ba568d46d5

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

$(function(){
   var ransack_options;
  
  $(document).on("pjax:end ready", function(e){
    ransack_options = $("select#ransack_options").html();
    $("select#advanced_field").trigger("change");
  })

  $(document).on('change', "select#advanced_field", function(){
    var type = $(this).find(":selected").data("type");
    var options = $(ransack_options).filter("optgroup[label='" + type + "']").html()
    $("select#ransack_options").html(options).trigger("change");
    $("select#ransack_options").selectpicker('refresh');
  });
  
  $(document).on('change',"select#ransack_options", function(){
    var field_name = $("select#advanced_field").find(":selected").val() +"_" + $(this).val();
    $("#advanced_query").attr("name", "q["+field_name+"]").val("");
  });
  $(document).on('click', "#advanced_search_link", function(){
    $("#simple_search").hide();
    $("#advanced_search").show();
  });
  $(document).on('click', "#simple_search_link", function(){
    $("#advanced_search").hide();
    $("#simple_search").show();
  });
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cardboard_cms-0.1.8 app/assets/javascripts/cardboard/search_filter.js
cardboard_cms-0.1.6 app/assets/javascripts/cardboard/search_filter.js
cardboard_cms-0.1.4 app/assets/javascripts/cardboard/search_filter.js