Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better

  • Loading branch information...
commit 5b2f71813a689bdcd89e00f9a9b535f272e38bb0 1 parent 1527a50
@kristianmandrup authored
View
5 www/Content.js
@@ -2,7 +2,7 @@
Ext.define('FriendlyRent.view.search.Content', {
extend: 'Ext.Panel',
alias: 'widget.search_content',
- requires: ['FriendlyRent.view.search.criteria.Location', 'FriendlyRent.view.search.criteria.Radius'],
+ requires: ['FriendlyRent.view.search.criteria.Location', 'FriendlyRent.view.search.criteria.Radius', 'FriendlyRent.view.search.criteria.PropertyType'],
config: {
layout: 'vbox',
items: [
@@ -12,6 +12,9 @@ Ext.define('FriendlyRent.view.search.Content', {
}, {
xtype: 'search_criteria_radius',
name: 'radius'
+ }, {
+ xtype: 'search_criteria_property_type',
+ name: 'property_type'
}
]
}
View
10 www/PropertyType.js
@@ -0,0 +1,10 @@
+
+Ext.define('FriendlyRent.view.search.criteria.PropertyType', {
+ extend: 'Ext.field.SliderText',
+ alias: 'widget.search_criteria_property_type',
+ config: {
+ label: 'Property type',
+ autoValues: true,
+ valueMap: ['Any', 'Room', 'Apartment', 'House', 'Independent house', 'House boat']
+ }
+});
View
4 www/Radius.js
@@ -6,9 +6,9 @@ Ext.define('FriendlyRent.view.search.criteria.Radius', {
({
config: {
+ label: 'Radius',
value: 5,
minValue: 1,
- maxValue: 50,
- label: 'Radius'
+ maxValue: 50
}
});
View
5 www/app/view/search/Content.js
@@ -2,7 +2,7 @@
Ext.define('FriendlyRent.view.search.Content', {
extend: 'Ext.Panel',
alias: 'widget.search_content',
- requires: ['FriendlyRent.view.search.criteria.Location', 'FriendlyRent.view.search.criteria.Radius'],
+ requires: ['FriendlyRent.view.search.criteria.Location', 'FriendlyRent.view.search.criteria.Radius', 'FriendlyRent.view.search.criteria.PropertyType'],
config: {
layout: 'vbox',
items: [
@@ -12,6 +12,9 @@ Ext.define('FriendlyRent.view.search.Content', {
}, {
xtype: 'search_criteria_radius',
name: 'radius'
+ }, {
+ xtype: 'search_criteria_property_type',
+ name: 'property_type'
}
]
}
View
2  www/app/view/search/criteria/PropertyType.js
@@ -1,7 +1,7 @@
Ext.define('FriendlyRent.view.search.criteria.PropertyType', {
extend: 'Ext.field.SliderText',
- alias: 'widget.search.criteria.property_type',
+ alias: 'widget.search_criteria_property_type',
config: {
label: 'Property type',
autoValues: true,
View
4 www/app/view/search/criteria/Radius.js
@@ -6,9 +6,9 @@ Ext.define('FriendlyRent.view.search.criteria.Radius', {
({
config: {
+ label: 'Radius',
value: 5,
minValue: 1,
- maxValue: 50,
- label: 'Radius'
+ maxValue: 50
}
});
View
42 www/lib/plugins/SliderFieldInput.js
@@ -14,17 +14,7 @@ Ext.define('Ext.field.SliderInput', {
config: {
cls: Ext.baseCSSPrefix + 'slider-field-input',
tabIndex: -1,
- helperPosition: 'right',
- valueMapper: function(value) {
- var valueMap = this.valueMap;
- if (valueMap) {
- console.log('mapped value', value);
- return valueMap[value];
- } else {
- console.log('value', value);
- return value;
- }
- }
+ helperPosition: 'right'
},
proxyConfig: {
@@ -41,12 +31,17 @@ Ext.define('Ext.field.SliderInput', {
config.value = config.values;
}
- if (config.hasOwnProperty('valueMap')) {
- if (config.autoValues == true) {
- config.value = config.defaultValue || 0;
- config.minValue = 0;
- config.maxValue = config.valueMap.size -1;
- config.increment = 1;
+ // console.log('setup values', this.config.valueMap);
+ if (this.config.valueMap) {
+ // console.log('has valuemap:', this.config.autoValues);
+ if (this.config.autoValues == true) {
+ // console.log('has autovalues');
+ this.config.value = this.config.defaultValue || 0;
+ this.config.minValue = 0;
+ this.config.maxValue = this.config.valueMap.length -1;
+ // console.log('default', this.config.value);
+ // console.log('min', this.config.minValue);
+ // console.log('max', this.config.maxValue);
}
}
@@ -65,6 +60,19 @@ Ext.define('Ext.field.SliderInput', {
});
},
+ valueMapper: function(value, scope) {
+ var valueMap = this.config.valueMap;
+ // console.log('Input Valuemap', valueMap)
+ if (valueMap) {
+ // console.log('mapped value', value);
+ return valueMap[value];
+ } else {
+ // console.log('orig value', value);
+ return value;
+ }
+ },
+
+
getElementConfig: function() {
var self = this;
var originalConfig = self.callParent();
View
47 www/lib/plugins/SliderFieldText.js
@@ -9,14 +9,7 @@ Ext.define('Ext.field.SliderText', {
config: {
cls: Ext.baseCSSPrefix + 'slider-field-text',
tabIndex: -1,
- helperPosition: 'right',
- valueMapper: function(value) {
- if (self.config.valueMap) {
- self.config.valueMap[value];
- } else {
- value;
- }
- }
+ helperPosition: 'right'
},
proxyConfig: {
@@ -32,13 +25,17 @@ Ext.define('Ext.field.SliderText', {
if (config.hasOwnProperty('values')) {
config.value = config.values;
}
-
- if (config.hasOwnProperty('valueMap')) {
- if (config.autoValues == true) {
- config.value = config.defaultValue || 0;
- config.minValue = 0;
- config.maxValue = config.valueMap.size -1;
- config.increment = 1;
+ // console.log('setup values', this.config.valueMap);
+ if (this.config.valueMap) {
+ // console.log('has valuemap:', this.config.autoValues);
+ if (this.config.autoValues == true) {
+ // console.log('has autovalues');
+ this.config.value = this.config.defaultValue || 0;
+ this.config.minValue = 0;
+ this.config.maxValue = this.config.valueMap.length -1;
+ // console.log('default', this.config.value);
+ // console.log('min', this.config.minValue);
+ // console.log('max', this.config.maxValue);
}
}
@@ -78,9 +75,10 @@ Ext.define('Ext.field.SliderText', {
},
setHelperValue: function(value) {
- var valueMapper = self.config.valueMapper;
- var value = valueMapper ? valueMapper(value) : value;
- this.helperInput.dom.text = value;
+ var value = this.valueMapper(value)
+ // console.log('value:', value);
+ // console.log('helperInput', this.helperInput);
+ this.helperInput.dom.innerText = value;
},
// @private
@@ -123,6 +121,19 @@ Ext.define('Ext.field.SliderText', {
return this.getValue();
},
+ valueMapper: function(value) {
+ // console.log('Config', config)
+ var valueMap = this.config.valueMap;
+ // console.log('Text Valuemap', valueMap)
+ if (valueMap) {
+ // console.log('mapped value', value);
+ return valueMap[value];
+ } else {
+ // console.log('orig value', value);
+ return value;
+ }
+ },
+
reset: function() {
var config = this.config,
initialValue = (this.config.hasOwnProperty('values')) ? config.values : config.value;
View
5 www/src/app/view/search/Content.coffee
@@ -4,6 +4,7 @@ Ext.define 'FriendlyRent.view.search.Content'
requires: [
'FriendlyRent.view.search.criteria.Location'
'FriendlyRent.view.search.criteria.Radius'
+ 'FriendlyRent.view.search.criteria.PropertyType'
]
config:
layout: 'vbox'
@@ -15,5 +16,9 @@ Ext.define 'FriendlyRent.view.search.Content'
{
xtype: 'search_criteria_radius'
name: 'radius'
+ }
+ {
+ xtype: 'search_criteria_property_type'
+ name: 'property_type'
}
]
View
6 www/src/app/view/search/criteria/PropertyType.coffee
@@ -1,7 +1,7 @@
Ext.define 'FriendlyRent.view.search.criteria.PropertyType'
- extend: 'Ext.field.SliderText'
- alias: 'widget.search.criteria.property_type'
+ extend: 'Ext.field.SliderText'
+ alias: 'widget.search_criteria_property_type'
config:
label: 'Property type'
- autoValues: true
+ autoValues: true
valueMap: ['Any', 'Room', 'Apartment', 'House', 'Independent house', 'House boat']
View
5 www/src/app/view/search/criteria/Radius.coffee
@@ -1,8 +1,9 @@
Ext.define 'FriendlyRent.view.search.criteria.Radius'
extend: 'Ext.field.SliderInput'
- alias: 'widget.search_criteria_radius'
+ alias: 'widget.search_criteria_radius'
config:
+ label: 'Radius'
value: 5
minValue: 1
maxValue: 50
- label: 'Radius'
+
Please sign in to comment.
Something went wrong with that request. Please try again.