Sha256: a3c6fee75654e434128bf881c77c290a50f55bb3500d81c6243eb083270ce124

Contents?: true

Size: 1.39 KB

Versions: 34

Compression:

Stored size: 1.39 KB

Contents

SymphoniaFilter = function(filtersForm) {
  var form = document.getElementById(filtersForm);

  $(document).ready(function() {
    var n = form.querySelector(".symphonia-query-column-selector");
    if (n) {
      new Sortable(n, {
        animation: 0,
        draggable: "div.column",
        scroll: false
      })
    }
    initDatepicker(filtersForm + ' .filter-custom-date > .datepicker');
  });

  this.submit = function() {
    var cols = document.querySelectorAll("#" + form.id + " .column input:checked");
    var params = [];
    for (var i=0;i < cols.length; i++) {
      params.push(cols[i].name.replace(/\[|\]/g, ""))
    }
    var uri = form.action.replace(/[\?&]column_names=.*&?/, "");
    if (!uri.includes("?")) {
      uri = uri + "?"
    }
    if (params.length > 0) {
      uri = uri + "&column_names=" + params.join("|")
    }
    var $filters = $("#"+form.id+" .symphonia-query-filters-selector").find("input, select");
    $filters.each(function(_index, item) {
      if (item.value && item.value !== "" && (item.type !== 'checkbox' || item.checked)) {
        uri = uri + "&" + item.name + "=" + item.value;
      }
    });
    window.location = uri
  }
};
SymphoniaFilter.prototype.dateFilterCallback = function(element) {
  if (element.value === 'custom') {
    window.Symphonia.toggle(element.nextElementSibling)
  } else {
    window.Symphonia.toggle(element.nextElementSibling, false)
  }
};

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
symphonia-3.2.1 app/assets/javascripts/symphonia/filters.js
symphonia-3.1.5 app/assets/javascripts/symphonia/filters.js
symphonia-3.1.4 app/assets/javascripts/symphonia/filters.js
symphonia-3.1.3 app/assets/javascripts/symphonia/filters.js
symphonia-3.1.2 app/assets/javascripts/symphonia/filters.js
symphonia-3.1.1 app/assets/javascripts/symphonia/filters.js
symphonia-3.1.0 app/assets/javascripts/symphonia/filters.js
symphonia-3.0.3 app/assets/javascripts/symphonia/filters.js
symphonia-3.0.2 app/assets/javascripts/symphonia/filters.js
symphonia-2.2.1 app/assets/javascripts/symphonia/filters.js
symphonia-3.0.1 app/assets/javascripts/symphonia/filters.js
symphonia-3.0.0 app/assets/javascripts/symphonia/filters.js
symphonia-2.1.8 app/assets/javascripts/symphonia/filters.js
symphonia-2.1.7 app/assets/javascripts/symphonia/filters.js