I made some enhancements for the facetapi_slider module.
These are solutions for multiple issues, but because they are grouped together, I made a new issue.

- support for prefix and suffix (solution for #1496316: Prefix and Suffix from CCK field)
- support for rounding and slider step (solution for #1412110: rounding to integers causes poor precision for float-based sliders)
- possibility to enlarge the range
- better slider ui
- some code enhancements

there is still a problem with the initial value of the slider values, but it works.
After applying the patch, this should be the result:
http://spatial.mollux.be/facetapi-enhancements+search_api-integration-01...
http://spatial.mollux.be/facetapi-enhancements+search_api-integration-02...

I have tested it with search_api (I will make a separate issue with the patch) and search_api_location, and it works well :)
Can somebody with apachesolr experience confirm that it works well also?

Comments

mollux’s picture

nick_vh’s picture

Status: Active » Needs work
+++ b/facetapi_slider.infoundefined
@@ -3,4 +3,4 @@ description = A Facet API widget that displays a slider to control ranges.
-files[] = plugins/facetapi/widget_slider.inc
\ No newline at end of file

newline error

+++ b/facetapi_slider.jsundefined
@@ -62,10 +63,21 @@ Drupal.facetapi_slider.makeSlider = function($form, settings) {
+  var $real_left_position = ($real_width/$range)*$real_left-3;

not sure about convention, but shouldn't there be a space between the multiplication sign?

+++ b/facetapi_slider.jsundefined
@@ -62,10 +63,21 @@ Drupal.facetapi_slider.makeSlider = function($form, settings) {
+  $wrapper.children('.facetapi-slider-min').css("margin-left", $real_left_position+"px");

same with the plus?

+++ b/plugins/facetapi/widget_slider.incundefined
@@ -53,18 +52,29 @@ class FacetapiWidgetSlider extends FacetapiWidget {
+    $slider_min_global = round($slider_min_global / $step) * $step;

same as ceil

+++ b/plugins/facetapi/widget_slider.incundefined
@@ -53,18 +52,29 @@ class FacetapiWidgetSlider extends FacetapiWidget {
+    $slider_max_global = ceil($slider_max_global / $step) * $step;

does this fail if the step value is not present?

mollux’s picture

I added the spaces and removed the dpm's in patch.

$step defaults to 1 in the settings form, but you could intert nothing or 0 (devidebyzero error)
Best solution is to check on form submission that you add a value > 0?

nick_vh’s picture

+++ b/facetapi_slider.infoundefined
@@ -3,4 +3,4 @@ description = A Facet API widget that displays a slider to control ranges.
\ No newline at end of file

still the newline thing

+++ b/plugins/facetapi/widget_slider.incundefined
@@ -26,20 +25,21 @@ class FacetapiWidgetSlider extends FacetapiWidget {
+        $range = explode(' TO ', trim($value, '{[]}'));

same here, I'd be afraid of braking this if this does not become more reliable. What happens if the value is empty?

devonwarren’s picture

I like the prefix addition however i was encountering some issues having the new values loaded in the slider by default and I wanted to have commas in the number displays as well. I have attached my modifications to your patch for those interested. Still needs some testing with different configurations. (this is my first patch so let me know if I did something wrong)

luo8’s picture

StatusFileSize
new501.57 KB

Hello,
after patch implemantation Slider didn't show me...check attached picture.

devonwarren’s picture

@luo8: What browser version? If it fails to load the javascript must be failing early on. Do you have anything coming up in the browser console log?

luo8’s picture

devonwarren
I was tried to use Firefox,Internet Explorer and Chrome as well.I don't think that could be because of browser.
I was flash all caches as well.Its strange...

nick_vh’s picture

Status: Needs work » Needs review
StatusFileSize
new12.34 KB

Rerolled and fixed some problems

nick_vh’s picture

Status: Needs review » Fixed

Committed, thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

luo8’s picture

Nick_vh,
I'm sorry module with patch not working for me...after price range selection nothing happen.