aboutsummaryrefslogtreecommitdiffstats
path: root/src/Widgets.js
diff options
context:
space:
mode:
authorMisko Hevery2010-02-17 20:50:13 -0800
committerMisko Hevery2010-02-17 20:50:13 -0800
commit2f99af1cce0e7bd440f937d2557dbd583d8a6129 (patch)
tree978c81b302eb32326a3c21e16dae812e21a7bacc /src/Widgets.js
parent060c18c796f59703193efcf61818684187091663 (diff)
downloadangular.js-2f99af1cce0e7bd440f937d2557dbd583d8a6129.tar.bz2
fixed upload widget
Diffstat (limited to 'src/Widgets.js')
-rw-r--r--src/Widgets.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/Widgets.js b/src/Widgets.js
index 13506a78..6d7530f0 100644
--- a/src/Widgets.js
+++ b/src/Widgets.js
@@ -57,7 +57,7 @@ WidgetFactory.prototype = {
bind(event, action);
return controller;
},
-
+
createFileController: function(fileInput) {
var uploadId = '__uploadWidget_' + (this.nextUploadId++);
var view = FileController.template(uploadId);
@@ -72,7 +72,7 @@ WidgetFactory.prototype = {
var swfNode = this.createSWF(att, par, uploadId);
fileInput.remove();
var cntl = new FileController(view, fileInput[0].name, swfNode, this.serverUrl + "/data/" + this.database);
- jQuery(swfNode).data('controller', cntl);
+ jQuery(swfNode).parent().data('controller', cntl);
return cntl;
}
};
@@ -92,7 +92,7 @@ function FileController(view, scopeName, uploader, databaseUrl) {
angularCallbacks['flashEvent'] = function(id, event, args) {
var object = document.getElementById(id);
var jobject = jQuery(object);
- var controller = jobject.data("controller");
+ var controller = jobject.parent().data("controller");
FileController.prototype[event].apply(controller, args);
_.defer(jobject.scope().get('$updateView'));
};
@@ -103,7 +103,7 @@ FileController.template = function(id) {
'<object id="' + id + '" />' +
'<a></a>' +
'<span/>' +
- '</span>');
+ '</span>');
};
extend(FileController.prototype, {
@@ -130,14 +130,14 @@ extend(FileController.prototype, {
this.value = value;
this.updateModel(scope);
this.value = null;
- },
+ },
'select': function(name, size, type) {
this.name = name;
this.view.find("a").text(name).attr('href', name);
this.view.find("span").text(angular['filter']['bytes'](size));
this.upload();
},
-
+
updateModel: function(scope) {
var isChecked = this.view.find("input").attr('checked');
var value = isChecked ? this.value : null;
@@ -148,7 +148,7 @@ extend(FileController.prototype, {
return true;
}
},
-
+
updateView: function(scope) {
var modelValue = scope.get(this.scopeName);
if (modelValue && this.value !== modelValue) {
@@ -160,7 +160,7 @@ extend(FileController.prototype, {
}
this.view.find("input").attr('checked', !!modelValue);
},
-
+
upload: function() {
if (this.name) {
this.uploader['uploadFile'](this.attachmentsPath);
@@ -213,7 +213,7 @@ TextController.prototype = {
return true;
}
},
-
+
updateView: function(scope) {
var view = this.view;
var value = scope.get(this.exp);
@@ -226,7 +226,7 @@ TextController.prototype = {
view.value = this.formatter['format'](value);
this.lastValue = value;
}
-
+
var isValidationError = false;
view.removeAttribute('ng-error');
if (this.required) {
@@ -273,7 +273,7 @@ CheckboxController.prototype = {
return true;
}
},
-
+
updateView: function(scope) {
var input = this.view;
var value = scope.eval(this.exp);
@@ -311,7 +311,7 @@ SelectController.prototype = {
}
}
},
-
+
updateView: function(scope) {
var input = this.view;
var value = scope.get(this.exp);
@@ -348,7 +348,7 @@ MultiSelectController.prototype = {
}
return value;
},
-
+
updateModel: function(scope) {
var value = this.selected();
// TODO: This is wrong! no caching going on here as we are always comparing arrays
@@ -360,7 +360,7 @@ MultiSelectController.prototype = {
return true;
}
},
-
+
updateView: function(scope) {
var input = this.view;
var selected = scope.get(this.exp);
@@ -403,7 +403,7 @@ RadioController.prototype = {
return true;
}
},
-
+
updateView: function(scope) {
var input = this.view;
var value = scope.get(this.exp);
@@ -540,7 +540,7 @@ BindAttrUpdater.prototype = {
if(isImage && attrName == 'src' && !attrValue)
attrValue = scope.get('$config.blankImage');
jNode.attr(attrName, attrValue);
- }
+ }
}
};
@@ -797,7 +797,7 @@ Status.prototype = {
}
this.requestCount++;
},
-
+
endRequest: function () {
this.requestCount--;
if (this.requestCount === 0) {