Univention Bugzilla – Attachment 8237 Details for
Bug 43011
ThumbnailDndList needs to properly support watch events
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
bug43011.patch (text/plain), 5.60 KB, created by
Alexander Kläser
on 2016-11-18 20:55:53 CET
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Alexander Kläser
Created:
2016-11-18 20:55:53 CET
Size:
5.60 KB
patch
obsolete
>diff --git a/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailBox.js b/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailBox.js >index 4a68455..a8e97a1 100644 >--- a/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailBox.js >+++ b/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailBox.js >@@ -139,9 +139,11 @@ define([ > 'class': 'thumbnailBoxImageInput', > buttonLabel: this._uploadImageButtonLabel, > showClearButton: false, >+ maxSize: 1 * 1024 * 1024, > updateView: lang.hitch(this, '_updateUploadedImagePreview') > }); > this._imageUploader.startup(); >+ this._imageUploader.watch('value', lang.hitch(this, '_updateValue')); > > this._youtubeVideoTextBox = new TextBox({ > 'class': 'thumbnailBoxYoutubeInput', >@@ -152,6 +154,12 @@ define([ > this._youtubeVideoTextBox.on('keypress', lang.hitch(this, 'checkForEnterPress')); > }, > >+ _updateValue: function() { >+ function _cut(val) { if (typeof val == 'string') {return val.substr(0, 20) + '...';} return val; } >+ console.log('### ThumbnailBox:_updateValue() - old value:', _cut(this.value), ' new value:', _cut(this.get('value'))); >+ this._set('value', this.get('value')); >+ }, >+ > _setValueAttr: function(value) { > if (!value) { > // remove content of youtube textbox and show initial label >@@ -170,8 +178,7 @@ define([ > } else { > this._updateUploadedImagePreview(value); > } >- >- this._set('value', this.get('value')); >+ this._updateValue(); > }, > > _getValueAttr: function() { >@@ -234,7 +241,7 @@ define([ > > _updateUploadedImagePreview: function(/*image as base64 encoded string*/ value) { > // clear youtube thumbnail preview >- this._setYoutubeVideThumbnailPreview(); >+ this._setYoutubeVideoThumbnailPreview(); > domClass.add(this._youtubeVideoThumbnailPreview.domNode, 'inactive'); > > this._setUploadedImagePreview(value); >@@ -253,20 +260,20 @@ define([ > this._setUploadedImagePreview(); > domClass.add(this._uploadedImgPreview.domNode, 'inactive'); > >- this._setYoutubeVideThumbnailPreview(value); >+ this._setYoutubeVideoThumbnailPreview(value); > domClass.remove(this._youtubeVideoThumbnailPreview.domNode, 'inactive'); > this.activePreview = this._youtubeVideoThumbnailPreview; > > this.onThumbnailSet(); > }, > >- _setYoutubeVideThumbnailPreview: function(value) { >+ _setYoutubeVideoThumbnailPreview: function(value) { > this._youtubeVideoThumbnailPreview.set('value', value); > }, > > _clearPreviews: function() { > this._setUploadedImagePreview(); >- this._setYoutubeVideThumbnailPreview(); >+ this._setYoutubeVideoThumbnailPreview(); > }, > > // fires when a thumbnail is successfully set >diff --git a/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailDndList.js b/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailDndList.js >index e7c5538..28b2969 100644 >--- a/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailDndList.js >+++ b/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailDndList.js >@@ -43,12 +43,18 @@ define([ > _thumbnailBox: null, > initialBoxValue: null, > >+ _updateValue: function(attr, oldVal, newVal) { >+ console.log('### ThumbnailDndTile:_updateValue() - old value:', this.value, ' new value:', this.get('value'), ' arguments:', arguments); >+ this._set('value', newVal); >+ }, >+ > buildRendering: function() { > this.inherited(arguments); > > this._thumbnailBox = new ThumbnailBox({ > value: this.initialBoxValue > }); >+ this._thumbnailBox.watch('value', lang.hitch(this, '_updateValue')); > > var styleContainer = put('div.styleContainer'); > var leftNav = put('div.leftNav.dojoDndHandle'); >@@ -120,11 +126,18 @@ define([ > // This reference is used so that there is always only one empty ThumbnailDndTile > _emptyTileNode: null, > >+ labelPosition: 'top', >+ > buildRendering: function() { > this.inherited(arguments); > this._createDndSource(); > }, > >+ _updateValue: function() { >+ console.log('### ThumbnailDndList:_updateValue() - old value:', this.value, ' new value:', this.get('value'), ' arguments:', arguments); >+ this._set('value', this.get('value')); >+ }, >+ > _createDndSource: function() { > this.dndSource = new Source(this.domNode, { > type: ['thumbnailDndList'], >@@ -150,12 +163,13 @@ define([ > 'class': 'thumbnailDndTile', > disabled: this.get('disabled') > }); >+ tile.watch('value', lang.hitch(this, '_updateValue')); > tile.on('deleteRequest', lang.hitch(this, '_destroyTile', tile)); > tile.on('moveUp', lang.hitch(this, '_moveTile', tile, true)); > tile.on('moveDown', lang.hitch(this, '_moveTile', tile, false)); > tile.on('addBefore', lang.hitch(this, '_addEmptyTile', tile, true)); > tile.on('addAfter', lang.hitch(this, '_addEmptyTile', tile, false)); >- >+ > return { > node: tile.domNode, > data: tile, >@@ -175,6 +189,7 @@ define([ > if (this.dndSource.getAllNodes().length === 0) { > this._addEmptyTile(); > } >+ this._updateValue(); > }, > > _moveTile: function(tile, before) { >@@ -184,6 +199,7 @@ define([ > return; > } > put(referenceNode, putCombinator, tile.domNode); >+ this._updateValue(); > }, > > _addEmptyTile: function(tile, before) { >@@ -224,6 +240,7 @@ define([ > if (this.dndSource.getAllNodes().length === 0) { > this._addEmptyTile(); > } >+ this._set('value', value); > }, > > _getValueAttr: function() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43011
: 8237