commit 9b268a1b359bbe40ac6f5fa1f4f482ae7842a184
parent d06e8e922b85e1eb769957d6157db2cc3b33aee7
Author: Felicitus <felicitus@felicitus.org>
Date: Sat, 26 Sep 2015 19:55:39 +0200
Use /getImage on all images consistently
Diffstat:
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/RemoteImageField.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/RemoteImageField.js
@@ -3,12 +3,12 @@
* <p>The RemoteImageField is a form field which can be used to upload one image. It automatically
* displays the remote image by id, assigns a temporary ID if it's a new image so the model can be
* syncronized at once.
- *
+ *
*/
Ext.define('PartKeepr.RemoteImageField', {
- extend:'Ext.container.Container',
+ extend: 'Ext.container.Container',
alias: 'widget.remoteimagefield',
-
+
xtype: 'remoteimagefield',
listeners: {
@@ -17,8 +17,9 @@ Ext.define('PartKeepr.RemoteImageField', {
layout: 'vbox',
/**
* Initializes the field
- */
- initComponent : function(){
+ */
+ initComponent: function ()
+ {
this.image = Ext.create("Ext.Img", {
maxHeight: this.maxHeight,
@@ -36,35 +37,39 @@ Ext.define('PartKeepr.RemoteImageField', {
handler: this.onClick
});
- this.items = [ this.image, this.button ];
- this.minHeight = this.imageHeight;
- this.minWidth = this.imageWidth;
+ this.items = [this.image, this.button];
+ this.minHeight = this.maxHeight;
+ this.minWidth = this.maxWidth;
this.callParent();
},
- onClick: function () {
- var j = Ext.create("PartKeepr.FileUploadDialog", { imageUpload: true });
- j.on("fileUploaded", this.onFileUploaded, this);
- j.show();
+ onClick: function ()
+ {
+ var j = Ext.create("PartKeepr.FileUploadDialog", {imageUpload: true});
+ j.on("fileUploaded", this.onFileUploaded, this);
+ j.show();
},
- onFileUploaded: function (data) {
+ onFileUploaded: function (data)
+ {
this.fireEvent("fileUploaded", data);
},
/**
* Sets a value for the field. If the value is numeric, we call the image service
* with the specified id and the specified type. If the value is a string and prefixed
* with TMP:, we use the type "TempImage" and pass the id which has to be specified after TMP:.
- *
+ *
* Example
* TMP:12 would retrieve the temporary image with the ID 12
* @param {Mixed} value The value to set
* @return {Ext.form.field.Field} this
*/
- setValue: function(value) {
+ setValue: function (value)
+ {
this.value = value;
if (value !== null) {
- this.image.setSrc(value.getId() + "?maxWidth="+this.imageWidth+"&maxHeight="+this.imageHeight + "&ts=" + new Date().getTime());
+ this.image.setSrc(
+ value.getId() + "/getImage?maxWidth=" + this.imageWidth + "&maxHeight=" + this.imageHeight + "&ts=" + new Date().getTime());
} else {
this.image.setSrc("");
}