Skip to content

Commit 66845d3

Browse files
committed
GCA-28 refactored to use compile and have settings locally (temporary)
1 parent 96498ec commit 66845d3

File tree

5 files changed

+117
-65
lines changed

5 files changed

+117
-65
lines changed

dist/rzslider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v2.14.0 -
22
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-06-02 */
4+
2016-06-03 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

dist/rzslider.js

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v2.14.0 -
22
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-06-02 */
4+
2016-06-03 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -1967,27 +1967,44 @@
19671967
* min: lower price range value, 2 way binding changes as user drags
19681968
* max: upper price range value, 2 way binding changes as user drags
19691969
*/
1970-
.directive('otPriceRangeSlider', ['$compile', 'otPriceRangeSliderLocaleConfig', function ($compile, otPriceRangeSliderLocaleConfig) {
1970+
.directive('otPriceRangeSlider', ['$compile', function ($compile) {
19711971
return {
19721972
restrict: 'E',
19731973
scope: {
19741974
locale:"=",
19751975
min:"=",
19761976
max:"="
19771977
},
1978-
template: '<rzslider class="opentable-style" '
1979-
+ 'rz-slider-model="otPRConfig.minValue" '
1980-
+ 'rz-slider-high="otPRConfig.maxValue" '
1981-
+ 'rz-slider-options="otPRConfig.options" '
1982-
+ '></rzslider>',
19831978
link: function (scope, iElm, iAttrs, controller) {
19841979
// load locale specific settings; default to us if none passed
19851980
// or lang locale not found
1981+
var localeConfig = {
1982+
"en_us": {
1983+
floor: 20,
1984+
ceil: 80,
1985+
step: 1,
1986+
currency: "$"
1987+
},
1988+
"de_de": {
1989+
floor: 10,
1990+
ceil: 90,
1991+
step: 5,
1992+
currency: "€"
1993+
},
1994+
"en_ca": {
1995+
floor: 30,
1996+
ceil: 100,
1997+
step: 6,
1998+
currency: "C$"
1999+
}
2000+
}
19862001
var locale = scope.locale || "en_us";
1987-
var localeConfig = otPriceRangeSliderLocaleConfig[locale.toLowerCase()];
2002+
var localeConfig = localeConfig[locale.toLowerCase()];
19882003
if (!localeConfig) {
1989-
otPriceRangeSliderLocaleConfig["en_us"];
2004+
localeConfig = otPriceRangeSliderLocaleConfig["en_us"];
19902005
}
2006+
console.log("otPriceRangeSlider localeConfig:", localeConfig)
2007+
19912008

19922009
// setup scope properties for use in rzslider
19932010
scope.otPRConfig = {
@@ -2018,6 +2035,14 @@
20182035
}
20192036
}
20202037
};
2038+
2039+
var otSliderHtml = '<rzslider class="opentable-style" '
2040+
+ 'rz-slider-model="otPRConfig.minValue" '
2041+
+ 'rz-slider-high="otPRConfig.maxValue" '
2042+
+ 'rz-slider-options="otPRConfig.options" '
2043+
+ '></rzslider>';
2044+
var otSlider = $compile(otSliderHtml)(scope);
2045+
iElm.append(otSlider);
20212046
}
20222047
};
20232048
}])
@@ -2026,28 +2051,29 @@
20262051
* private service with locale specific settings for currency etc
20272052
* used by otPriceRangeSlider
20282053
*/
2029-
.factory("otPriceRangeSliderLocaleConfig", function() {
2030-
return {
2031-
"en_us": {
2032-
floor: 20,
2033-
ceil: 80,
2034-
step: 1,
2035-
currency: "$"
2036-
},
2037-
"de_de": {
2038-
floor: 10,
2039-
ceil: 90,
2040-
step: 5,
2041-
currency: "€"
2042-
},
2043-
"en_ca": {
2044-
floor: 30,
2045-
ceil: 100,
2046-
step: 6,
2047-
currency: "C$"
2048-
}
2049-
}
2050-
})
2054+
//.factory("otPriceRangeSliderLocaleConfig", function() {
2055+
// return {
2056+
// "en_us": {
2057+
// floor: 20,
2058+
// ceil: 80,
2059+
// step: 1,
2060+
// currency: "$"
2061+
// },
2062+
// "de_de": {
2063+
// floor: 10,
2064+
// ceil: 90,
2065+
// step: 5,
2066+
// currency: "€"
2067+
// },
2068+
// "en_ca": {
2069+
// floor: 30,
2070+
// ceil: 100,
2071+
// step: 6,
2072+
// currency: "C$"
2073+
// }
2074+
// }
2075+
//})
2076+
20512077
;
20522078

20532079

dist/rzslider.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rzslider.js

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,27 +1971,44 @@
19711971
* min: lower price range value, 2 way binding changes as user drags
19721972
* max: upper price range value, 2 way binding changes as user drags
19731973
*/
1974-
.directive('otPriceRangeSlider', ['$compile', 'otPriceRangeSliderLocaleConfig', function ($compile, otPriceRangeSliderLocaleConfig) {
1974+
.directive('otPriceRangeSlider', ['$compile', function ($compile) {
19751975
return {
19761976
restrict: 'E',
19771977
scope: {
19781978
locale:"=",
19791979
min:"=",
19801980
max:"="
19811981
},
1982-
template: '<rzslider class="opentable-style" '
1983-
+ 'rz-slider-model="otPRConfig.minValue" '
1984-
+ 'rz-slider-high="otPRConfig.maxValue" '
1985-
+ 'rz-slider-options="otPRConfig.options" '
1986-
+ '></rzslider>',
19871982
link: function (scope, iElm, iAttrs, controller) {
19881983
// load locale specific settings; default to us if none passed
19891984
// or lang locale not found
1985+
var localeConfig = {
1986+
"en_us": {
1987+
floor: 20,
1988+
ceil: 80,
1989+
step: 1,
1990+
currency: "$"
1991+
},
1992+
"de_de": {
1993+
floor: 10,
1994+
ceil: 90,
1995+
step: 5,
1996+
currency: "€"
1997+
},
1998+
"en_ca": {
1999+
floor: 30,
2000+
ceil: 100,
2001+
step: 6,
2002+
currency: "C$"
2003+
}
2004+
}
19902005
var locale = scope.locale || "en_us";
1991-
var localeConfig = otPriceRangeSliderLocaleConfig[locale.toLowerCase()];
2006+
var localeConfig = localeConfig[locale.toLowerCase()];
19922007
if (!localeConfig) {
1993-
otPriceRangeSliderLocaleConfig["en_us"];
2008+
localeConfig = otPriceRangeSliderLocaleConfig["en_us"];
19942009
}
2010+
console.log("otPriceRangeSlider localeConfig:", localeConfig)
2011+
19952012

19962013
// setup scope properties for use in rzslider
19972014
scope.otPRConfig = {
@@ -2022,6 +2039,14 @@
20222039
}
20232040
}
20242041
};
2042+
2043+
var otSliderHtml = '<rzslider class="opentable-style" '
2044+
+ 'rz-slider-model="otPRConfig.minValue" '
2045+
+ 'rz-slider-high="otPRConfig.maxValue" '
2046+
+ 'rz-slider-options="otPRConfig.options" '
2047+
+ '></rzslider>';
2048+
var otSlider = $compile(otSliderHtml)(scope);
2049+
iElm.append(otSlider);
20252050
}
20262051
};
20272052
}])
@@ -2030,28 +2055,29 @@
20302055
* private service with locale specific settings for currency etc
20312056
* used by otPriceRangeSlider
20322057
*/
2033-
.factory("otPriceRangeSliderLocaleConfig", function() {
2034-
return {
2035-
"en_us": {
2036-
floor: 20,
2037-
ceil: 80,
2038-
step: 1,
2039-
currency: "$"
2040-
},
2041-
"de_de": {
2042-
floor: 10,
2043-
ceil: 90,
2044-
step: 5,
2045-
currency: "€"
2046-
},
2047-
"en_ca": {
2048-
floor: 30,
2049-
ceil: 100,
2050-
step: 6,
2051-
currency: "C$"
2052-
}
2053-
}
2054-
})
2058+
//.factory("otPriceRangeSliderLocaleConfig", function() {
2059+
// return {
2060+
// "en_us": {
2061+
// floor: 20,
2062+
// ceil: 80,
2063+
// step: 1,
2064+
// currency: "$"
2065+
// },
2066+
// "de_de": {
2067+
// floor: 10,
2068+
// ceil: 90,
2069+
// step: 5,
2070+
// currency: "€"
2071+
// },
2072+
// "en_ca": {
2073+
// floor: 30,
2074+
// ceil: 100,
2075+
// step: 6,
2076+
// currency: "C$"
2077+
// }
2078+
// }
2079+
//})
2080+
20552081
;
20562082

20572083

0 commit comments

Comments
 (0)