This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See http://git.chorem.org/pollen.git commit 046a10e5942e5e346f51b3981e4b08850557d897 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Mon Jun 23 10:59:54 2014 +0200 auto focus on edit comment and poll description --- pollen-ui-angular/src/main/webapp/js/app.js | 10 +++++++++- pollen-ui-angular/src/main/webapp/partials/poll-comment.html | 6 +++--- pollen-ui-angular/src/main/webapp/partials/poll-poll.html | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js index 6c57603..037841d 100644 --- a/pollen-ui-angular/src/main/webapp/js/app.js +++ b/pollen-ui-angular/src/main/webapp/js/app.js @@ -119,7 +119,7 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC }; }) -.directive('ckEditor', function () { +.directive('ckEditor', function ($timeout) { return { require: '?ngModel', link: function ($scope, element, attrs, ngModel) { @@ -138,6 +138,14 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC ngModel.$render = function(value) { ck.setData(ngModel.$modelValue); }; + + if (attrs.focusMe) { + $scope.$watch(attrs.focusMe, function (value) { + if (value === true) { + $timeout(function () { ck.focus(); }); + } + }) + } } }; }) diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html index 978c2b7..a738c9c 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html @@ -25,12 +25,12 @@ <!-- begin for add comment --> <form class="form-horizontal" ng-submit="postComment()" novalidate> <div class="form-group"> - <label class="col-sm-2"> {{ 'user.name' | translate }} </label> + <label class="col-sm-2"> {{ 'user.name' | translate }} </label> <div class="col-sm-1"> <info-error error="restError['author.name'][0]" data="comment.authorName"></info-error> </div> <div class="col-sm-9"> - <input type="text" ng-model="comment.authorName" class="form-control"/> + <input type="text" ng-model="comment.authorName" class="form-control" focus-me="comment.id != null" /> </div> </div> @@ -38,7 +38,7 @@ <label class="col-sm-2"> {{ 'comment' | translate }} </label> <div class="col-sm-1"><info-error error="restError.text[0]" data="comment.text"></info-error></div> <div class="col-sm-9"> - <textarea data-ck-editor ng-model="comment.text"></textarea> + <textarea data-ck-editor ng-model="comment.text" focus-me="comment.id != null"></textarea> </div> </div> diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-poll.html b/pollen-ui-angular/src/main/webapp/partials/poll-poll.html index b5e6620..ede3062 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-poll.html @@ -34,7 +34,7 @@ <div ng-hide="data.poll.description ">{{ 'poll.desc' | translate }}</div> </div> <div ng-show="showEditDesc" class="pollDesc"> - <textarea id="descEditor" data-ck-editor ng-model="data.poll.description"></textarea> + <textarea id="descEditor" data-ck-editor ng-model="data.poll.description" focus-me="showEditDesc"></textarea> <!-- fix me : no save in creation but save in edition --> <button type="button" class="btn btn-primary" ng-click="showEditDesc = false;" ng-show="globalVariables.create">{{ 'action.return' | translate }}</button> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.