Permalink
Browse files

Merge branch 'pull-request-51-AUI-654'

Conflicts:
	build/aui-scheduler/aui-scheduler-min.js
	build/aui-scheduler/aui-scheduler-view-min.js
  • Loading branch information...
2 parents 90618c6 + 3fed3cd commit e997eb569a1299108f9c61035a80d01e3e59df7a @eduardolundgren eduardolundgren committed May 11, 2012
@@ -9,6 +9,7 @@ var Lang = A.Lang,
},
COLOR = 'color',
+ DISABLED = 'disabled',
EVENTS = 'events',
PALLETE = 'pallete',
SCHEDULER = 'scheduler',
@@ -30,6 +31,11 @@ var SchedulerCalendar = A.Component.create({
validator: isString
},
+ disabled: {
+ value: false,
+ validator: isBoolean
+ },
+
name: {
value: '(no name)',
validator: isString
@@ -60,50 +66,59 @@ var SchedulerCalendar = A.Component.create({
var instance = this;
instance.after('colorChange', instance._afterColorChange);
- instance.on('eventsChange', instance._onEventsChange);
- instance.on('visibleChange', instance._onVisibleChange);
+ instance.after('disabledChange', instance._afterDisabledChange);
+ instance.after('eventsChange', instance._afterEventsChange);
+ instance.after('visibleChange', instance._afterVisibleChange);
- instance._uiSetVisible(
- instance.get(VISIBLE)
+ instance._uiSetColor(
+ instance.get(COLOR)
+ );
+
+ instance._uiSetDisabled(
+ instance.get(DISABLED)
);
instance._uiSetEvents(
instance.get(EVENTS)
);
+
+ instance._uiSetVisible(
+ instance.get(VISIBLE)
+ );
},
- syncEventsColor: function(events) {
+ _afterColorChange: function(event) {
var instance = this;
- A.Array.each(events || instance.get(EVENTS), function(evt) {
- evt.set(COLOR, instance.get(COLOR));
- });
+ instance._uiSetColor(event.newVal);
},
- _afterColorChange: function(event) {
+ _afterDisabledChange: function(event) {
var instance = this;
- instance.syncEventsColor(instance.get(EVENTS));
+ instance._uiSetDisabled(event.newVal);
},
- _onEventsChange: function(event) {
+ _afterEventsChange: function(event) {
var instance = this;
- var value = event.newVal;
- var visible = instance.get(VISIBLE);
-
- A.Array.each(value, function(event) {
- event.set(VISIBLE, visible);
- });
- instance._uiSetEvents(value);
+ instance._uiSetEvents(event.newVal);
},
- _onVisibleChange: function(event) {
+ _afterVisibleChange: function(event) {
var instance = this;
instance._uiSetVisible(event.newVal);
},
+ _propagateAttr: function(attrName, attrValue) {
+ var instance = this;
+
+ instance.eachEvent(function(evt) {
+ evt.set(attrName, attrValue);
+ });
+ },
+
_setScheduler: function(val) {
var instance = this;
var scheduler = instance.get(SCHEDULER);
@@ -117,11 +132,25 @@ var SchedulerCalendar = A.Component.create({
return val;
},
+ _uiSetColor: function(val) {
+ var instance = this;
+
+ instance._propagateAttr(COLOR, instance.get(COLOR));
+ },
+
+ _uiSetDisabled: function(val) {
+ var instance = this;
+
+ instance._propagateAttr(DISABLED, val);
+ },
+
_uiSetEvents: function(val) {
var instance = this;
var scheduler = instance.get(SCHEDULER);
- instance.syncEventsColor(val);
+ instance._propagateAttr(COLOR, instance.get(COLOR));
+ instance._propagateAttr(DISABLED, instance.get(DISABLED));
+ instance._propagateAttr(VISIBLE, instance.get(VISIBLE));
if (scheduler) {
scheduler.removeEvents(instance);
@@ -133,9 +162,7 @@ var SchedulerCalendar = A.Component.create({
_uiSetVisible: function(val) {
var instance = this;
- instance.eachEvent(function(evt) {
- evt.set(VISIBLE, val);
- });
+ instance._propagateAttr(VISIBLE, val);
}
}
});
Oops, something went wrong.
@@ -9,6 +9,7 @@ var Lang = A.Lang,
},
COLOR = 'color',
+ DISABLED = 'disabled',
EVENTS = 'events',
PALLETE = 'pallete',
SCHEDULER = 'scheduler',
@@ -30,6 +31,11 @@ var SchedulerCalendar = A.Component.create({
validator: isString
},
+ disabled: {
+ value: false,
+ validator: isBoolean
+ },
+
name: {
value: '(no name)',
validator: isString
@@ -60,50 +66,59 @@ var SchedulerCalendar = A.Component.create({
var instance = this;
instance.after('colorChange', instance._afterColorChange);
- instance.on('eventsChange', instance._onEventsChange);
- instance.on('visibleChange', instance._onVisibleChange);
+ instance.after('disabledChange', instance._afterDisabledChange);
+ instance.after('eventsChange', instance._afterEventsChange);
+ instance.after('visibleChange', instance._afterVisibleChange);
- instance._uiSetVisible(
- instance.get(VISIBLE)
+ instance._uiSetColor(
+ instance.get(COLOR)
+ );
+
+ instance._uiSetDisabled(
+ instance.get(DISABLED)
);
instance._uiSetEvents(
instance.get(EVENTS)
);
+
+ instance._uiSetVisible(
+ instance.get(VISIBLE)
+ );
},
- syncEventsColor: function(events) {
+ _afterColorChange: function(event) {
var instance = this;
- A.Array.each(events || instance.get(EVENTS), function(evt) {
- evt.set(COLOR, instance.get(COLOR));
- });
+ instance._uiSetColor(event.newVal);
},
- _afterColorChange: function(event) {
+ _afterDisabledChange: function(event) {
var instance = this;
- instance.syncEventsColor(instance.get(EVENTS));
+ instance._uiSetDisabled(event.newVal);
},
- _onEventsChange: function(event) {
+ _afterEventsChange: function(event) {
var instance = this;
- var value = event.newVal;
- var visible = instance.get(VISIBLE);
-
- A.Array.each(value, function(event) {
- event.set(VISIBLE, visible);
- });
- instance._uiSetEvents(value);
+ instance._uiSetEvents(event.newVal);
},
- _onVisibleChange: function(event) {
+ _afterVisibleChange: function(event) {
var instance = this;
instance._uiSetVisible(event.newVal);
},
+ _propagateAttr: function(attrName, attrValue) {
+ var instance = this;
+
+ instance.eachEvent(function(evt) {
+ evt.set(attrName, attrValue);
+ });
+ },
+
_setScheduler: function(val) {
var instance = this;
var scheduler = instance.get(SCHEDULER);
@@ -117,11 +132,25 @@ var SchedulerCalendar = A.Component.create({
return val;
},
+ _uiSetColor: function(val) {
+ var instance = this;
+
+ instance._propagateAttr(COLOR, instance.get(COLOR));
+ },
+
+ _uiSetDisabled: function(val) {
+ var instance = this;
+
+ instance._propagateAttr(DISABLED, val);
+ },
+
_uiSetEvents: function(val) {
var instance = this;
var scheduler = instance.get(SCHEDULER);
- instance.syncEventsColor(val);
+ instance._propagateAttr(COLOR, instance.get(COLOR));
+ instance._propagateAttr(DISABLED, instance.get(DISABLED));
+ instance._propagateAttr(VISIBLE, instance.get(VISIBLE));
if (scheduler) {
scheduler.removeEvents(instance);
@@ -133,9 +162,7 @@ var SchedulerCalendar = A.Component.create({
_uiSetVisible: function(val) {
var instance = this;
- instance.eachEvent(function(evt) {
- evt.set(VISIBLE, val);
- });
+ instance._propagateAttr(VISIBLE, val);
}
}
});
Oops, something went wrong.

0 comments on commit e997eb5

Please sign in to comment.