Permalink
Browse files

Add EF.Labels object

  • Loading branch information...
1 parent f41ce25 commit 29cbe18c929fefe2535c83d391e4dc5e55008f38 @josepjaume josepjaume committed Dec 16, 2012
View
11 packages/ember-forms/lib/fields/date.js
@@ -1,5 +1,6 @@
require("ember-forms/fields/base");
require("ember-forms/controls/unbound_select");
+require("ember-forms/labels");
var e = Ember.empty;
@@ -33,7 +34,7 @@ EF.DateComponent = Ember.ContainerView.extend({
name: Ember.computed(function(){
return this.get('parentView').get('name') + '_day';
}),
- prompt: "- Day -",
+ promptBinding: 'EF.Labels.dayPrompt',
content: Ember.computed(function(){
var days = [];
for(var i=1; i<=31; i++){
@@ -44,23 +45,21 @@ EF.DateComponent = Ember.ContainerView.extend({
}),
monthView: EF.UnboundSelect.extend({
- prompt: "- Month -",
+ promptBinding: 'EF.Labels.monthPrompt',
attributeBindings: ['name'],
name: Ember.computed(function(){
return this.get('parentView').get('name') + '_month';
}),
content: Ember.computed(function(){
- var months = Ember.A(["January", "February", "March", "April", "May",
- "June", "July", "August", "September", "October", "November",
- "December"]);
+ var months = EF.Labels.get('months');
return months.map(function(month, index){
return {value: (index + ''), label: month};
});
})
}),
yearView: EF.UnboundSelect.extend({
- prompt: "- Year -",
+ promptBinding: 'EF.Labels.yearPrompt',
attributeBindings: ['name'],
name: Ember.computed(function(){
return this.get('parentView').get('name') + '_year';
View
8 packages/ember-forms/lib/labels.js
@@ -0,0 +1,8 @@
+EF.Labels = Ember.Object.create({
+ months: Ember.A(["January", "February", "March", "April", "May",
+ "June", "July", "August", "September", "October", "November",
+ "December"]),
+ dayPrompt: '- Day -',
+ monthPrompt: '- Month -',
+ yearPrompt: '- Year -',
+});
View
1 packages/ember-forms/lib/main.js
@@ -1,4 +1,5 @@
require("ember-forms/core");
+require("ember-forms/labels");
require("ember-forms/controls");
require("ember-forms/fields");
require("ember-forms/form");

0 comments on commit 29cbe18

Please sign in to comment.