[pollen] branch feature/waitResourceBeforeSave created (now 7cbcdac)
This is an automated email from the git hooks/post-receive script. New change to branch feature/waitResourceBeforeSave in repository pollen. See http://git.chorem.org/pollen.git at 7cbcdac wait send resource before save choice and add icon loader This branch includes the following new commits: new 7cbcdac wait send resource before save choice and add icon loader The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 7cbcdacee0c4dee8ec231973b3da30dea102b1b6 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Mon Jul 21 15:28:01 2014 +0200 wait send resource before save choice and add icon loader -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/waitResourceBeforeSave in repository pollen. See http://git.chorem.org/pollen.git commit 7cbcdacee0c4dee8ec231973b3da30dea102b1b6 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Mon Jul 21 15:28:01 2014 +0200 wait send resource before save choice and add icon loader --- pollen-ui-angular/bower.json | 3 +- pollen-ui-angular/src/main/webapp/index.html | 3 ++ .../src/main/webapp/js/controllers/pollCtrl.js | 56 +++++++++++++++------- pollen-ui-angular/src/main/webapp/js/directives.js | 14 +++++- pollen-ui-angular/src/main/webapp/less/style.less | 13 ++++- .../src/main/webapp/less/variables.less | 4 +- .../src/main/webapp/partials/printResource.html | 2 +- 7 files changed, 72 insertions(+), 23 deletions(-) diff --git a/pollen-ui-angular/bower.json b/pollen-ui-angular/bower.json index 905062e..48979ae 100644 --- a/pollen-ui-angular/bower.json +++ b/pollen-ui-angular/bower.json @@ -19,7 +19,8 @@ "jquery": "2.1.1", "ckeditor": "4.4.2", "less": "1.7.3", - "jqplot-bower": "1.0.8" + "jqplot-bower": "1.0.8", + "spin.js": "2.0.1" }, "devDependencies": { "angular-mocks": "1.2.16" diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html index e2716f3..668106d 100644 --- a/pollen-ui-angular/src/main/webapp/index.html +++ b/pollen-ui-angular/src/main/webapp/index.html @@ -45,6 +45,9 @@ <script language="javascript" type="text/javascript" src="lib/jqplot-bower/dist//plugins/jqplot.pointLabels.min.js"></script> <script language="javascript" type="text/javascript" src="lib/jqplot-bower/dist//plugins/jqplot.highlighter.min.js"></script> + <script language="javascript" type="text/javascript" src="lib/spin.js/spin.js"></script> + <script language="javascript" type="text/javascript" src="lib/spin.js/jquery.spin.js"></script> + <script language="javascript" type="text/javascript" src="lib/ckeditor/ckeditor.js"></script> <script language="javascript" type="text/javascript" src="lib/angular/angular.min.js"></script> diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js index 2df3ff7..395eee8 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -411,6 +411,21 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var popupChoice = function (choiceEdit, title, callBack) { var choice = angular.copy(choiceEdit); + var modalCallBack = function (choiceEdit, choice, callBack) { + if (! angular.equals(choiceEdit.choiceValue, choice.choiceValue) + || + choiceEdit.choiceType != choice.choiceType + || + choiceEdit.description != choice.description) { + + choiceEdit.choiceValue = choice.choiceValue; + choiceEdit.choiceType = choice.choiceType; + choiceEdit.description = choice.description; + + callBack(choiceEdit); + } + } + var modalInstance = $modal.open({ templateUrl : 'partials/poll-popupChoice.html', controller : PollPopChoiceCtrl, @@ -445,32 +460,39 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr if (choice.choiceType == 'TEXT') { choice.choiceValue = choice.choiceValueText; + + modalCallBack(choiceEdit, choice, callBack) } else if (choice.choiceType == 'DATE') { choice.choiceValue = choice.choiceValueDate; $scope.globalVariables.lastDate = angular.copy(choice.choiceValueDate); + + modalCallBack(choiceEdit, choice, callBack) } else if (choice.choiceType == 'RESOURCE') { - if (angular.isUndefined(choiceEdit.choiceValue) - || - angular.isDefined(choice.choiceValueImage) - && - choice.choiceValueImage.id != choiceEdit.choiceValue.id) { - choice.choiceValue = choice.choiceValueImage; - } - } + var resourceOldId = angular.copy(choiceEdit.choiceValue.id); + var oldChoiceType = angular.copy(choiceEdit.choiceType); - if (! angular.equals(choiceEdit.choiceValue, choice.choiceValue) - || - choiceEdit.choiceType != choice.choiceType - || - choiceEdit.description != choice.description) { + delete choiceEdit.choiceValue.id; + choiceEdit.choiceType = 'RESOURCE'; - choiceEdit.choiceValue = choice.choiceValue; - choiceEdit.choiceType = choice.choiceType; - choiceEdit.description = choice.description; + if (angular.isDefined(choice.choiceValueImage)) { + choice.choiceValueImage.promise.$promise.then(function () { + if (angular.isUndefined(resourceOldId) + || + angular.isDefined(choice.choiceValueImage) + && + choice.choiceValueImage.id != resourceOldId) { - callBack(choiceEdit); + choice.choiceValue = choice.choiceValueImage; + + modalCallBack(choiceEdit, choice, callBack) + } + else { + choiceEdit.choiceValue.id = resourceOldId; + } + }); + } } }); } diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js index d58f819..066cddb 100644 --- a/pollen-ui-angular/src/main/webapp/js/directives.js +++ b/pollen-ui-angular/src/main/webapp/js/directives.js @@ -423,7 +423,9 @@ angular.module('pollenDirective', []) scope.ngModel = { meta: changeEvent.target.files[0] }; }); - PollenResource.upload(formData, function (response) { + delete scope.ngModel.id; + + scope.ngModel.promise = PollenResource.upload(formData, function (response) { scope.ngModel.meta.id = response.id; scope.ngModel.id = response.id; scope.ngModel.data = conf.restURL+'/resources/'+response.id; @@ -457,6 +459,16 @@ angular.module('pollenDirective', []) if (angular.isDefined(newVal)) { scope.resourceURL = conf.restURL+"/resources/"+scope.image; scope.previewURL = scope.resourceURL+"/preview"; + $(element).find('div').spin(false); + } + else { + scope.resourceURL = ""; + scope.previewURL = ""; + $(element).find('.preview').spin({ + position:'relative', + top:'32px', + left:'50%' + }); } }); }); diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less index 97829fe..8728234 100644 --- a/pollen-ui-angular/src/main/webapp/less/style.less +++ b/pollen-ui-angular/src/main/webapp/less/style.less @@ -241,8 +241,14 @@ } img { - max-width:200px; - max-height:200px; + max-width: @preview-size; + max-height: @preview-size; + } + + .spinner { + height:64px; + width:150x !important; + z-index:1000 !important; } } } @@ -485,6 +491,9 @@ hr { background-color:@borderColor; border-radius:8px; + transition-duration: @time-transition; + transition-property:width,height; + span { display:block; padding-top:2px; diff --git a/pollen-ui-angular/src/main/webapp/less/variables.less b/pollen-ui-angular/src/main/webapp/less/variables.less index 77ce45a..6d102cd 100644 --- a/pollen-ui-angular/src/main/webapp/less/variables.less +++ b/pollen-ui-angular/src/main/webapp/less/variables.less @@ -32,4 +32,6 @@ @responsive-large-width : 1024px; @responsive-min-width : 770px; -@responsive-height: 600px; \ No newline at end of file +@responsive-height: 600px; + +@preview-size:200px; \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/partials/printResource.html b/pollen-ui-angular/src/main/webapp/partials/printResource.html index 74fbdbc..810e708 100644 --- a/pollen-ui-angular/src/main/webapp/partials/printResource.html +++ b/pollen-ui-angular/src/main/webapp/partials/printResource.html @@ -1,4 +1,4 @@ -<div><img ng-attr-src="{{previewURL}}" /></div> +<div class="preview"><img ng-attr-src="{{previewURL}}" /></div> <div ng-show="showImage" class="full"> <div class="full-content"> <span>{{name}}</span> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm