Sha256: 4dc33a6c630623bbc0919c30dbb9b2587a6fa25ba6175f0dd8814ae2ebbbd3e1

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

$(function(){
   var ransack_options;
  
  $(document).on("page:load 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.3.1 app/assets/javascripts/cardboard/search_filter.js
cardboard_cms-0.2.2 app/assets/javascripts/cardboard/search_filter.js
cardboard_cms-0.2.1 app/assets/javascripts/cardboard/search_filter.js