Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
June 2014
- 2 participants
- 106 discussions
This is an automated email from the git hooks/post-receive script.
New commit to branch feature/addBuilder in repository pollen.
See http://git.chorem.org/pollen.git
commit dca101da6ab2dc8986ed3451ef5a4aabc9de40d9
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jun 13 17:02:26 2014 +0200
get lib by bower
---
pollen-ui-angular/.bowerrc | 4 ++++
pollen-ui-angular/.gitignore | 4 +++-
pollen-ui-angular/bower.json | 22 +++++++++++++++++
pollen-ui-angular/pom.xml | 24 +++++++++++++++++++
pollen-ui-angular/src/main/webapp/index.html | 35 ++++++++++++++--------------
5 files changed, 70 insertions(+), 19 deletions(-)
diff --git a/pollen-ui-angular/.bowerrc b/pollen-ui-angular/.bowerrc
new file mode 100644
index 0000000..20d69e9
--- /dev/null
+++ b/pollen-ui-angular/.bowerrc
@@ -0,0 +1,4 @@
+{
+ "directory" : "./src/main/webapp/bower"
+}
+
diff --git a/pollen-ui-angular/.gitignore b/pollen-ui-angular/.gitignore
index 797b705..9b808b5 100644
--- a/pollen-ui-angular/.gitignore
+++ b/pollen-ui-angular/.gitignore
@@ -1 +1,3 @@
-*.iml
\ No newline at end of file
+*.iml
+src/main/webapp/bower
+
diff --git a/pollen-ui-angular/bower.json b/pollen-ui-angular/bower.json
new file mode 100644
index 0000000..278a446
--- /dev/null
+++ b/pollen-ui-angular/bower.json
@@ -0,0 +1,22 @@
+{
+ "name": "pollen-ui-angular",
+ "version": "2.0",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ],
+ "dependencies": {
+ "angular-route": "1.2.16",
+ "angular": "1.2.16",
+ "angular-resource": "1.2.16",
+ "angular-translate": "2.0.0",
+ "angular-bootstrap": "0.11.0",
+ "angular-animate": "1.2.16",
+ "bootstrap": "~3.1.1",
+ "jqplot": "*"
+ }
+}
+
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index b0b6b99..957e34c 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -21,6 +21,30 @@
<skipPostRelease>false</skipPostRelease>
</properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>bower</executable>
+ <arguments>
+ <argument>install</argument>
+ </arguments>
+ <workingDirectory>${basedir}</workingDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 60b2aa9..585ad84 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -19,31 +19,30 @@
#L%
-->
-<html lang="en" ng-app="pollen">
+<html ng-app="pollen">
<head>
<title>Pollen</title>
<meta charset="utf-8" />
- <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/jquery.jqplot.min.css" />
+ <link href="bower/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
+ <link href="bower/jqplot/jquery.jqplot.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="css/style.css"/>
<script src="js/conf.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/jquery.jqplot.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.barRende…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.pieRende…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.category…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.pointLab…"></script>
-
- <script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.4.1/ckeditor.js"></script>
-
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.min.js"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-resource.min…"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-animate.min.…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/bower-angular-translate/2.0.1/angula…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.0/ui-boots…"></script>
+ <script src="bower/jquery/dist/jquery.min.js"></script>
+ <script src="bower/jqplot/jquery.jqplot.min.js"></script>
+ <script src="bower/jqplot/plugins/jqplot.barRenderer.min.js"></script>
+ <script src="bower/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
+ <script src="bower/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
+ <script src="bower/jqplot/plugins/jqplot.pointLabels.min.js"></script>
+
+ <script src="bower/angular/angular.min.js"></script>
+ <script src="bower/angular-route/angular-route.min.js"></script>
+ <script src="bower/angular-resource/angular-resource.min.js"></script>
+ <script src="bower/angular-translate/angular-translate.min.js"></script>
+ <script src="bower/angular-animate/angular-animate.min.js"></script>
+ <script src="bower/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
+ <script src="bower/ckeditor/ckeditor.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
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 4d9dbea9a538e13edc2fdbb7c96311a1f824eed9
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jun 24 17:53:16 2014 +0200
ordered comments by date (desc or asc)
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 2 ++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 ++
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 12 ++++++++++--
pollen-ui-angular/src/main/webapp/partials/poll-comment.html | 7 ++++++-
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index e5b1e54..9dc7f0d 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -68,6 +68,8 @@ var translateEN = {
'comment' : 'Comment',
'comment.added' : 'Comment added.',
+'comment.order.toDesc' : 'Ordered by newer date',
+'comment.order.toAsc' : 'Ordered by older date',
'action.logout' : 'Logout',
'action.login' : 'Login',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index b85c1f2..0222bd1 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -68,6 +68,8 @@ var translateFR = {
'comment' : 'Commentaire',
'comment.added' : 'Commentaire effectué',
+'comment.order.toDesc' : 'Ordonner par le plus récent',
+'comment.order.toAsc' : 'Ordonner par ordre chronologique',
'action.logout' : 'Se Deconnecter',
'action.login' : 'Se Connecter',
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 6987f95..ae03045 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -862,9 +862,17 @@ angular.module('pollControllers', [])
else {
$scope.pageSize = -1;
}
- $scope.urlPagination = $scope.setUrl(['page', 'pageSize']);
- var paginationParameter = {pageSize:$scope.pageSize, order:'postDate', desc:true};
+ $scope.desc = true;
+
+ $scope.toggleOrder = function () {
+ $scope.desc = !$scope.desc;
+ paginationParameter.desc = $scope.desc;
+ paginationParameter.pageNumber = $scope.data.commentsPagination.lastPage - $scope.data.commentsPagination.currentPage;
+ initComments();
+ }
+
+ var paginationParameter = {pageSize: $scope.pageSize, order: 'postDate', desc: $scope.desc};
if (angular.isDefined($routeParams.page)) {
if (angular.isDefined($routeParams.pageSize)) {
paginationParameter = {pageSize:$routeParams.pageSize};
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 cfd2042..ab8f2a1 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -43,7 +43,12 @@
</div>
<div class="form-group">
- <div class="col-sm-3"> </div>
+ <div class="col-sm-3">
+ <div ng-show="data.comments">
+ <a class="fakeLink" ng-click="toggleOrder()" ng-show="desc" tooltip="{{ 'comment.order.toAsc' | translate }}"><span class="glyphicon glyphicon-sort-by-attributes"></span></a>
+ <a class="fakeLink" ng-click="toggleOrder()" ng-hide="desc" tooltip="{{ 'comment.order.toDesc' | translate }}"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span></a>
+ </div>
+ </div>
<div class="col-sm-9">
<button type="submit" class="btn btn-primary" ng-hide="comment.id"><span class="glyphicon glyphicon-save"></span> {{ 'action.comment' | translate }}</button>
<button type="submit" class="btn btn-primary" ng-show="comment.id"><span class="glyphicon glyphicon-save"></span> {{ 'action.edit' | translate }}</button>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
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 833886ee87cda4372bb052d0a5180a98310a8cc0
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jun 24 17:12:13 2014 +0200
translate result page
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 5 +++++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 5 +++++
pollen-ui-angular/src/main/webapp/index.html | 2 +-
.../src/main/webapp/js/controllers/localeCtrl.js | 1 +
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 9 ++++++++-
pollen-ui-angular/src/main/webapp/partials/poll-result.html | 11 +++++++----
6 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index a6264ca..e5b1e54 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -58,6 +58,11 @@ var translateEN = {
'poll.restricted.restricted' : 'Restricted',
'poll.restricted.group' : 'Group',
'poll.restricted.pollType' : 'Who can vote ?',
+'poll.result.choice' : 'Choice',
+'poll.result.score' : 'Score',
+'poll.result.title.zero' : 'No result',
+'poll.result.title.one' : 'Result : One voter',
+'poll.result.title.other' : 'Result : {{nbVoter}} Voters',
'vote.added' : 'Vote added.',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index e0ffabb..b85c1f2 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -58,6 +58,11 @@ var translateFR = {
'poll.restricted.restricted' : 'Restreint',
'poll.restricted.group' : 'Groupe',
'poll.restricted.pollType' : 'Qui peut voter ?',
+'poll.result.choice' : 'Choix',
+'poll.result.score' : 'Score',
+'poll.result.title.zero' : 'Aucun Résultat',
+'poll.result.title.one' : 'Résultat : Un votant',
+'poll.result.title.other' : 'Résultat : {{nbVoter}} Votants',
'vote.added' : 'Vote effectué',
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 894c59e..60b2aa9 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -69,7 +69,7 @@
<ul class="dropdown-menu">
<li><a ng-click="switchLocale('fr')"><img src="img/fr.png" /> Français </a></li>
<li><a ng-click="switchLocale('en')"><img src="img/en.png" /> English </a> </li>
- <li><a ng-click="switchLocale('no')"> No Translate </a> </li>
+ <li ng-if="debug"><a ng-click="switchLocale('no')"> No Translate </a> </li>
</ul>
</li>
</ul>
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
index 960b086..d370ab8 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
@@ -20,6 +20,7 @@
*/
angular.module('localeControllers', [])
.controller('LocaleCtrl', ['$scope', '$translate', 'SessionStorage',function ($scope, $translate, SessionStorage) {
+ $scope.debug = conf.debug;
$scope.locale = SessionStorage.get().locale;
if (angular.isUndefined($scope.locale)) {
// set locale with browser preference
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 b2e399e..6987f95 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -975,9 +975,16 @@ angular.module('pollControllers', [])
}])
-.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote) {
+.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate',
+ function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate) {
$controller('PollCtrl', {$scope:$scope});
+ $scope.translateTitle = {
+ '0' : "{{ 'poll.result.title.zero' | translate }}",
+ 'one' : "{{ 'poll.result.title.one' | translate }}",
+ 'other' : "{{ 'poll.result.title.other' | translate:{nbVoter:data.result.nbVotant} }}",
+ };
+
$scope.tab = $scope.setTab('result');
$scope.plot = 'chart';
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-result.html b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
index fb492d4..47af606 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-result.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
@@ -1,7 +1,8 @@
<h1>{{data.poll.title}}</h1>
-<h2> Résultats : {{data.result.nbVotant}} Votants</h2>
+<h2> <ng-pluralize count="data.result.nbVotant" when="translateTitle"></ng-pluralize> </h2>
+<div ng-if="data.result.nbVotant > 0">
<hr/>
<div>
@@ -19,8 +20,8 @@
<hr/>
<table class="table-result">
<tr>
- <th>Choix</th>
- <th>Score</th>
+ <th>{{ 'poll.result.choice' | translate }}</th>
+ <th>{{ 'poll.result.score' | translate }}</th>
</tr>
<tr ng-repeat="score in data.result.scores">
<th> {{score.choice.name}} </th>
@@ -28,4 +29,6 @@
{{score.scoreValue}}
</td>
</tr>
-</table>
\ No newline at end of file
+</table>
+
+</div>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
01/01: no reload all voterList when import, fix pagination number in favoriteListMember, Add field defaultAlertTimeSuccess and defaultAlertTimeError in conf.js fix default conf for pagination number => not mandatory in conf.js
by chorem.org scm 24 Jun '14
by chorem.org scm 24 Jun '14
24 Jun '14
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 c455900f6d3bc9b30081d6aa0268b38c3dd335f0
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jun 24 14:47:25 2014 +0200
no reload all voterList when import,
fix pagination number in favoriteListMember,
Add field defaultAlertTimeSuccess and defaultAlertTimeError in conf.js
fix default conf for pagination number => not mandatory in conf.js
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 5 ++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 3 +
.../src/main/webapp/js/conf.js.exemple | 8 +++
.../src/main/webapp/js/controllers/alertCtrl.js | 14 ++++-
.../main/webapp/js/controllers/favoriteListCtrl.js | 8 ++-
.../src/main/webapp/js/controllers/pollCtrl.js | 73 ++++++++++++++--------
.../src/main/webapp/js/controllers/userCtrl.js | 8 +--
.../src/main/webapp/partials/poll-list.html | 2 -
.../main/webapp/partials/poll-listParticipant.html | 2 +-
9 files changed, 86 insertions(+), 37 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 164d011..a6264ca 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -33,6 +33,8 @@ var translateEN = {
'user.error.mail.notFound' : 'E-mail not found',
'user.error.mail.empty' : 'E-mail can not be empty',
'user.error.login' : 'Error in e-mail or password',
+'user.error.login.mandatory' : 'You must be connected',
+'user.error.logout.mandatory' : 'You must be disconnected',
'poll.tab.vote' : 'Vote',
'poll.tab.comment' : 'Comment',
@@ -48,6 +50,7 @@ var translateEN = {
'poll.edit' : 'Click to edit',
'poll.desc' : 'Description is optional. This message will not visible in vote page.',
'poll.saved' : 'Poll saved.',
+'poll.deleted' : 'Poll deleted',
'poll.restricted.name' : 'Name',
'poll.restricted.mail' : 'E-mail',
'poll.restricted.weight' : 'Weight',
@@ -88,5 +91,7 @@ var translateEN = {
'dateFormat' : 'MM-dd-yy',
+'error.forbidden' : 'Access forbidden',
+
}
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index e624020..e0ffabb 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -50,6 +50,7 @@ var translateFR = {
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
'poll.saved' : 'Sondage sauvegardé',
+'poll.deleted' : 'Sondage supprimé',
'poll.restricted.name' : 'Nom du votant',
'poll.restricted.mail' : 'Courriel du votant',
'poll.restricted.weight' : 'Poids',
@@ -91,5 +92,7 @@ var translateFR = {
'dateFormat' : 'dd/MM/yyyy',
+'error.forbidden' : 'Accès interdit',
+
}
diff --git a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
index 4602e9a..6fa3b5e 100644
--- a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
+++ b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
@@ -16,4 +16,12 @@ var conf = {
// Default Language for i18n : 'en' or 'fr'
defaultLanguage: 'en',
+
+ // Time in ms to print alert success
+ // -1 for infinite time, click or reload for close alert
+ defaultAlertTimeSuccess: 2000, // 2s
+
+ // Time in ms to print alert error
+ // -1 for infinite time, click or reload for close alert
+ defaultAlertTimeError: -1, // infinite
}
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
index 7d798c0..f2be73d 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -30,17 +30,25 @@ angular.module('alertControllers', [])
$scope.$on('newError', function (event, error, timeout) {
var alert = {msg:error, type:'danger'};
- addAlert(alert, timeout);
+ if (angular.isDefined(timeout)) {
+ addAlert(alert, timeout);
+ } else {
+ addAlert(alert, conf.defaultAlertTimeError);
+ }
});
$scope.$on('newSuccess', function (event, success, timeout) {
var alert = {msg:success, type:'success'};
- addAlert(alert, timeout);
+ if (angular.isDefined(timeout)) {
+ addAlert(alert, timeout);
+ } else {
+ addAlert(alert, conf.defaultAlertTimeSuccess);
+ }
});
var addAlert = function (alert, timeout) {
$scope.data.alerts.push(alert);
- if (angular.isDefined(timeout)) {
+ if (angular.isDefined(timeout) && timeout >= 0) {
$timeout(function () {
$scope.hideAlert(alert)
}, timeout);
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
index 655996f..b531a7a 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
@@ -24,6 +24,9 @@ angular.module('favoriteListControllers', [])
$scope.data = {};
var paginationParameter = {pageSize: conf.favoriteListDefaultPageSize};
+ if (angular.isUndefined(paginationParameter.pageSize)) {
+ paginationParameter.pageSize = -1;
+ }
if (angular.isDefined($routeParams.page)) {
if (angular.isDefined($routeParams.pageSize)) {
paginationParameter = {pageSize:$routeParams.pageSize};
@@ -53,7 +56,10 @@ angular.module('favoriteListControllers', [])
function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, $timeout, $q, $location, $route) {
$scope.data = {};
- var paginationParameter = {pageSize: conf.favoriteListDefaultPageSize};
+ var paginationParameter = {pageSize: conf.favoriteListMemberDefaultPageSize};
+ if (angular.isUndefined(paginationParameter.pageSize)) {
+ paginationParameter.pageSize = -1;
+ }
if (angular.isDefined($routeParams.page)) {
if (angular.isDefined($routeParams.pageSize)) {
paginationParameter = {pageSize:$routeParams.pageSize};
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 ba0865e..b2e399e 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -349,7 +349,7 @@ angular.module('pollControllers', [])
}
Poll.add(poll, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
if ($scope.data.poll.pollType != 'FREE') {
SessionStorage.save({'voterList':$scope.data.voterList})
$location.url('/poll/edit/'+data.id+'?token='+data.permission);
@@ -392,7 +392,7 @@ angular.module('pollControllers', [])
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function (data) {
delete choice.restError;
choice.id = data.id;
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
choice.restError = error.data;
});
@@ -401,7 +401,7 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function() {
delete choice.restError;
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
choice.restError = error.data;
});
@@ -409,7 +409,7 @@ angular.module('pollControllers', [])
$scope.deleteChoice = function (choice) {
PollChoice.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, choiceId: choice.id}, function () {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
var index = $scope.data.choices.indexOf(choice);
if (index > -1) {
$scope.data.choices.splice(index,1);
@@ -483,24 +483,33 @@ angular.module('pollControllers', [])
}
}; initFavoriteList();
- $scope.importFavoriteList = function (voterListId) {
- if (angular.isDefined(voterListId)) {
- PollVoterList.importInGroup({pollId:$routeParams.pollId, voterListId:voterListId, favoriteListId:$scope.data.favoriteListImport}, null, function (data) {
- $scope.data.favoriteListImport = null;
- initVoterList();
- });
+ $scope.importFavoriteList = function (voterList) {
+ var pollVoterListPromise;
+ if (angular.isDefined(voterList.group.id)) {
+ pollVoterListPromise = PollVoterList.importInGroup({pollId:$routeParams.pollId, voterListId:voterList.group.id, favoriteListId:$scope.data.favoriteListImport}, null).$promise;
} else {
- PollVoterList.importAddGroup({pollId:$routeParams.pollId, favoriteListId:$scope.data.favoriteListImport}, null, function (data) {
- $scope.data.favoriteListImport = null;
- initVoterList();
- })
+ pollVoterListPromise = PollVoterList.importAddGroup({pollId:$routeParams.pollId, favoriteListId:$scope.data.favoriteListImport}, null).$promise;
}
+
+ pollVoterListPromise.then(function (data) {
+ $scope.data.favoriteListImport = null;
+ PollVoterList.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: data.id},
+ function (vl) {
+ voterList.group = vl;
+ PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: vl.id},
+ function(members) {
+ voterList.members = members;
+ }
+ );
+ }
+ );
+ });
};
$scope.saveVoterList = function (voterList) {
if (angular.isDefined(voterList.group.id)) {
PollVoterList.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:voterList.group.id}, voterList.group, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
delete voterList.group.restError;
}, function (error) {
voterList.group.restError = error.data;
@@ -519,7 +528,7 @@ angular.module('pollControllers', [])
});
if (vl.members.length > 0) {
PollVoterList.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, vl, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
voterList.group.id = data.id;
delete voterList.group.restError;
@@ -577,7 +586,7 @@ angular.module('pollControllers', [])
}
vlMemberPromise.then(function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
member.id = data.id;
delete member.restError;
}, function (error) {
@@ -694,7 +703,7 @@ angular.module('pollControllers', [])
}
$scope.data.poll.$update({permission:$scope.globalVariables.permission}, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
angular.extend($scope.restError, error.data);
});
@@ -708,6 +717,7 @@ angular.module('pollControllers', [])
var confirmDelete = confirm(confirmMessage);
if (confirmDelete == true) {
$scope.data.poll.$remove({permission:$scope.globalVariables.permission}, function() {
+ $rootScope.$broadcast('newSuccess', 'poll.deleted');
$location.path('/');
});
}
@@ -778,7 +788,7 @@ angular.module('pollControllers', [])
if (angular.isDefined($scope.data.vote.id)) {
// edit vote
PollVote.update({pollId:$routeParams.pollId}, sendVote, function (data) {
- $rootScope.$broadcast('newSuccess', 'vote.added', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'vote.added');
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
})
@@ -790,7 +800,7 @@ angular.module('pollControllers', [])
$scope.data.vote.permission = returnRequest.permission;
$scope.data.votants.push(angular.copy($scope.data.vote));
- $rootScope.$broadcast('newSuccess', 'vote.added', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'vote.added');
initVote();
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
@@ -846,7 +856,12 @@ angular.module('pollControllers', [])
}
}; initAuthor();
- $scope.pageSize = conf.commentDefaultPageSize;
+ if (angular.isDefined(conf.pollDefaultPageSize)) {
+ $scope.pageSize = conf.pollDefaultPageSize;
+ }
+ else {
+ $scope.pageSize = -1;
+ }
$scope.urlPagination = $scope.setUrl(['page', 'pageSize']);
var paginationParameter = {pageSize:$scope.pageSize, order:'postDate', desc:true};
@@ -912,7 +927,7 @@ angular.module('pollControllers', [])
}
commentPromise.then(function () {
- $rootScope.$broadcast('newSuccess', 'comment.added', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'comment.added');
//clean form
$scope.comment.text = '';
delete $scope.comment.postDate;
@@ -1013,11 +1028,16 @@ angular.module('pollControllers', [])
}])
.controller('PollListCtrl',
- ['$scope', '$controller', '$routeParams', 'Poll',
- function ($scope, $controller, $routeParams, Poll) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll',
+ function ($scope, $rootScope, $controller, $routeParams, $location, Poll) {
$controller('PollCtrl', {$scope:$scope});
- $scope.pageSize = conf.pollDefaultPageSize;
+ if (angular.isDefined(conf.pollDefaultPageSize)) {
+ $scope.pageSize = conf.pollDefaultPageSize;
+ }
+ else {
+ $scope.pageSize = -1;
+ }
$scope.urlPagination = $scope.setUrl(['page', 'pageSize']);
var paginationParameter = {pageSize:$scope.pageSize};
@@ -1035,7 +1055,8 @@ angular.module('pollControllers', [])
$scope.data.polls = data.elements
$scope.data.pollsPagination = data.pagination;
}, function (error) {
- $scope.restError = {forbidden:true};
+ $rootScope.$broadcast('newError', 'error.forbidden');
+ $location.url('/');
});
}; initPolls();
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
index cb4104e..20b38da 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -35,7 +35,7 @@
$scope.submit = function () {
if ($scope.data.user.password == $scope.data.user.password2) {
User.add({}, $scope.data.user, function (data) {
- $rootScope.$broadcast('newSuccess', 'user.register.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.register.success');
$scope.data.user = {email:'', password:'', password2:''};
}, function (error) {
$scope.restError = error.data;
@@ -55,7 +55,7 @@
$scope.submit = function () {
if ($scope.email != '') {
UserLostPassword.send({login:$scope.email}, function (data) {
- $rootScope.$broadcast('newSuccess', 'user.forgotPassword.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.forgotPassword.success');
$scope.email = '';
}, function (error) {
$translate('user.error.mail.notFound').then(function (error) {
@@ -86,7 +86,7 @@
$scope.editUser = function () {
User.update($scope.currentUser, function (data) {
SessionStorage.save({user:data});
- $rootScope.$broadcast('newSuccess', 'user.edit.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.edit.success');
}, function (error) {
$scope.restError = error.data;
});
@@ -96,7 +96,7 @@
if ($scope.currentUser.newPassword == $scope.currentUser.newPassword2) {
User.editPassword($scope.currentUser, function (data) {
SessionStorage.save({user:data});
- $rootScope.$broadcast('newSuccess', 'user.edit.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.edit.success');
}, function (error) {
$scope.restError = error.data;
});
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-list.html b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
index 0d9c69c..e036126 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
@@ -1,6 +1,4 @@
-<alert type="danger" ng-if="restError.forbidden">Accès interdit</alert>
-
<div ng-repeat="poll in data.polls">
<h2><a href="#/poll/vote/{{poll.id}}">{{poll.title}}</a> <a href="#/poll/edit/{{poll.id}}"><i class="glyphicon glyphicon-pencil"></i></a></h2>
<p ng-bind-html="toHTML(poll.description)"></p>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
index a60cb46..8007aa3 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
@@ -91,7 +91,7 @@
<th colspan="4">
<button class="btn btn-info" ng-click="addVoter($index);"> <span class="glyphicon glyphicon-plus"></span> {{ 'action.restricted.addVoter' | translate }} </button>
<button class="btn btn-danger" ng-click="deleteVoterList(voterList);"> <span class="glyphicon glyphicon-trash"></span> {{ 'action.restricted.deleteGroup' | translate }} </button>
- <button class="btn btn-info" ng-click="importFavoriteList(voterList.group.id)" ng-if="data.favoriteList"><span class="glyphicon glyphicon-plus"></span> {{ 'action.favoriteList.import.inGroup' | translate }}</button>
+ <button class="btn btn-info" ng-click="importFavoriteList(voterList)" ng-if="data.favoriteList"><span class="glyphicon glyphicon-plus"></span> {{ 'action.favoriteList.import.inGroup' | translate }}</button>
</th>
</tr>
</table>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
01/01: no reload all voterList when import, fix pagination number in favoriteListMember, Add field defaultAlertTimeSuccess and defaultAlertTimeError in conf.js fix default conf for pagination number => not mandatory in conf.js
by chorem.org scm 24 Jun '14
by chorem.org scm 24 Jun '14
24 Jun '14
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 dd85dd7ec82b6ecb62375f8703d08ab53e4068f3
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jun 24 14:47:25 2014 +0200
no reload all voterList when import,
fix pagination number in favoriteListMember,
Add field defaultAlertTimeSuccess and defaultAlertTimeError in conf.js
fix default conf for pagination number => not mandatory in conf.js
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 5 ++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 3 +
.../src/main/webapp/js/conf.js.exemple | 8 +++
.../src/main/webapp/js/controllers/alertCtrl.js | 14 ++++-
.../main/webapp/js/controllers/favoriteListCtrl.js | 8 ++-
.../src/main/webapp/js/controllers/pollCtrl.js | 73 ++++++++++++++--------
.../src/main/webapp/js/controllers/userCtrl.js | 8 +--
.../src/main/webapp/partials/poll-list.html | 2 -
.../main/webapp/partials/poll-listParticipant.html | 2 +-
9 files changed, 86 insertions(+), 37 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 164d011..a6264ca 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -33,6 +33,8 @@ var translateEN = {
'user.error.mail.notFound' : 'E-mail not found',
'user.error.mail.empty' : 'E-mail can not be empty',
'user.error.login' : 'Error in e-mail or password',
+'user.error.login.mandatory' : 'You must be connected',
+'user.error.logout.mandatory' : 'You must be disconnected',
'poll.tab.vote' : 'Vote',
'poll.tab.comment' : 'Comment',
@@ -48,6 +50,7 @@ var translateEN = {
'poll.edit' : 'Click to edit',
'poll.desc' : 'Description is optional. This message will not visible in vote page.',
'poll.saved' : 'Poll saved.',
+'poll.deleted' : 'Poll deleted',
'poll.restricted.name' : 'Name',
'poll.restricted.mail' : 'E-mail',
'poll.restricted.weight' : 'Weight',
@@ -88,5 +91,7 @@ var translateEN = {
'dateFormat' : 'MM-dd-yy',
+'error.forbidden' : 'Access forbidden',
+
}
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index e624020..e0ffabb 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -50,6 +50,7 @@ var translateFR = {
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
'poll.saved' : 'Sondage sauvegardé',
+'poll.deleted' : 'Sondage supprimé',
'poll.restricted.name' : 'Nom du votant',
'poll.restricted.mail' : 'Courriel du votant',
'poll.restricted.weight' : 'Poids',
@@ -91,5 +92,7 @@ var translateFR = {
'dateFormat' : 'dd/MM/yyyy',
+'error.forbidden' : 'Accès interdit',
+
}
diff --git a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
index 4602e9a..d45d87e 100644
--- a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
+++ b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
@@ -16,4 +16,12 @@ var conf = {
// Default Language for i18n : 'en' or 'fr'
defaultLanguage: 'en',
+
+ // Time in ms to print alert success
+ // -1 for infinite time, click or reload for close alert
+ defaultAlertTimeSuccess: 2000, // 5s
+
+ // Time in ms to print alert error
+ // -1 for infinite time, click or reload for close alert
+ defaultAlertTimeError: -1, // infinite
}
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
index 7d798c0..f2be73d 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -30,17 +30,25 @@ angular.module('alertControllers', [])
$scope.$on('newError', function (event, error, timeout) {
var alert = {msg:error, type:'danger'};
- addAlert(alert, timeout);
+ if (angular.isDefined(timeout)) {
+ addAlert(alert, timeout);
+ } else {
+ addAlert(alert, conf.defaultAlertTimeError);
+ }
});
$scope.$on('newSuccess', function (event, success, timeout) {
var alert = {msg:success, type:'success'};
- addAlert(alert, timeout);
+ if (angular.isDefined(timeout)) {
+ addAlert(alert, timeout);
+ } else {
+ addAlert(alert, conf.defaultAlertTimeSuccess);
+ }
});
var addAlert = function (alert, timeout) {
$scope.data.alerts.push(alert);
- if (angular.isDefined(timeout)) {
+ if (angular.isDefined(timeout) && timeout >= 0) {
$timeout(function () {
$scope.hideAlert(alert)
}, timeout);
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
index 655996f..b531a7a 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
@@ -24,6 +24,9 @@ angular.module('favoriteListControllers', [])
$scope.data = {};
var paginationParameter = {pageSize: conf.favoriteListDefaultPageSize};
+ if (angular.isUndefined(paginationParameter.pageSize)) {
+ paginationParameter.pageSize = -1;
+ }
if (angular.isDefined($routeParams.page)) {
if (angular.isDefined($routeParams.pageSize)) {
paginationParameter = {pageSize:$routeParams.pageSize};
@@ -53,7 +56,10 @@ angular.module('favoriteListControllers', [])
function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, $timeout, $q, $location, $route) {
$scope.data = {};
- var paginationParameter = {pageSize: conf.favoriteListDefaultPageSize};
+ var paginationParameter = {pageSize: conf.favoriteListMemberDefaultPageSize};
+ if (angular.isUndefined(paginationParameter.pageSize)) {
+ paginationParameter.pageSize = -1;
+ }
if (angular.isDefined($routeParams.page)) {
if (angular.isDefined($routeParams.pageSize)) {
paginationParameter = {pageSize:$routeParams.pageSize};
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 ba0865e..b2e399e 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -349,7 +349,7 @@ angular.module('pollControllers', [])
}
Poll.add(poll, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
if ($scope.data.poll.pollType != 'FREE') {
SessionStorage.save({'voterList':$scope.data.voterList})
$location.url('/poll/edit/'+data.id+'?token='+data.permission);
@@ -392,7 +392,7 @@ angular.module('pollControllers', [])
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function (data) {
delete choice.restError;
choice.id = data.id;
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
choice.restError = error.data;
});
@@ -401,7 +401,7 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function() {
delete choice.restError;
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
choice.restError = error.data;
});
@@ -409,7 +409,7 @@ angular.module('pollControllers', [])
$scope.deleteChoice = function (choice) {
PollChoice.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, choiceId: choice.id}, function () {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
var index = $scope.data.choices.indexOf(choice);
if (index > -1) {
$scope.data.choices.splice(index,1);
@@ -483,24 +483,33 @@ angular.module('pollControllers', [])
}
}; initFavoriteList();
- $scope.importFavoriteList = function (voterListId) {
- if (angular.isDefined(voterListId)) {
- PollVoterList.importInGroup({pollId:$routeParams.pollId, voterListId:voterListId, favoriteListId:$scope.data.favoriteListImport}, null, function (data) {
- $scope.data.favoriteListImport = null;
- initVoterList();
- });
+ $scope.importFavoriteList = function (voterList) {
+ var pollVoterListPromise;
+ if (angular.isDefined(voterList.group.id)) {
+ pollVoterListPromise = PollVoterList.importInGroup({pollId:$routeParams.pollId, voterListId:voterList.group.id, favoriteListId:$scope.data.favoriteListImport}, null).$promise;
} else {
- PollVoterList.importAddGroup({pollId:$routeParams.pollId, favoriteListId:$scope.data.favoriteListImport}, null, function (data) {
- $scope.data.favoriteListImport = null;
- initVoterList();
- })
+ pollVoterListPromise = PollVoterList.importAddGroup({pollId:$routeParams.pollId, favoriteListId:$scope.data.favoriteListImport}, null).$promise;
}
+
+ pollVoterListPromise.then(function (data) {
+ $scope.data.favoriteListImport = null;
+ PollVoterList.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: data.id},
+ function (vl) {
+ voterList.group = vl;
+ PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: vl.id},
+ function(members) {
+ voterList.members = members;
+ }
+ );
+ }
+ );
+ });
};
$scope.saveVoterList = function (voterList) {
if (angular.isDefined(voterList.group.id)) {
PollVoterList.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:voterList.group.id}, voterList.group, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
delete voterList.group.restError;
}, function (error) {
voterList.group.restError = error.data;
@@ -519,7 +528,7 @@ angular.module('pollControllers', [])
});
if (vl.members.length > 0) {
PollVoterList.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, vl, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
voterList.group.id = data.id;
delete voterList.group.restError;
@@ -577,7 +586,7 @@ angular.module('pollControllers', [])
}
vlMemberPromise.then(function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
member.id = data.id;
delete member.restError;
}, function (error) {
@@ -694,7 +703,7 @@ angular.module('pollControllers', [])
}
$scope.data.poll.$update({permission:$scope.globalVariables.permission}, function (data) {
- $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
angular.extend($scope.restError, error.data);
});
@@ -708,6 +717,7 @@ angular.module('pollControllers', [])
var confirmDelete = confirm(confirmMessage);
if (confirmDelete == true) {
$scope.data.poll.$remove({permission:$scope.globalVariables.permission}, function() {
+ $rootScope.$broadcast('newSuccess', 'poll.deleted');
$location.path('/');
});
}
@@ -778,7 +788,7 @@ angular.module('pollControllers', [])
if (angular.isDefined($scope.data.vote.id)) {
// edit vote
PollVote.update({pollId:$routeParams.pollId}, sendVote, function (data) {
- $rootScope.$broadcast('newSuccess', 'vote.added', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'vote.added');
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
})
@@ -790,7 +800,7 @@ angular.module('pollControllers', [])
$scope.data.vote.permission = returnRequest.permission;
$scope.data.votants.push(angular.copy($scope.data.vote));
- $rootScope.$broadcast('newSuccess', 'vote.added', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'vote.added');
initVote();
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
@@ -846,7 +856,12 @@ angular.module('pollControllers', [])
}
}; initAuthor();
- $scope.pageSize = conf.commentDefaultPageSize;
+ if (angular.isDefined(conf.pollDefaultPageSize)) {
+ $scope.pageSize = conf.pollDefaultPageSize;
+ }
+ else {
+ $scope.pageSize = -1;
+ }
$scope.urlPagination = $scope.setUrl(['page', 'pageSize']);
var paginationParameter = {pageSize:$scope.pageSize, order:'postDate', desc:true};
@@ -912,7 +927,7 @@ angular.module('pollControllers', [])
}
commentPromise.then(function () {
- $rootScope.$broadcast('newSuccess', 'comment.added', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'comment.added');
//clean form
$scope.comment.text = '';
delete $scope.comment.postDate;
@@ -1013,11 +1028,16 @@ angular.module('pollControllers', [])
}])
.controller('PollListCtrl',
- ['$scope', '$controller', '$routeParams', 'Poll',
- function ($scope, $controller, $routeParams, Poll) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll',
+ function ($scope, $rootScope, $controller, $routeParams, $location, Poll) {
$controller('PollCtrl', {$scope:$scope});
- $scope.pageSize = conf.pollDefaultPageSize;
+ if (angular.isDefined(conf.pollDefaultPageSize)) {
+ $scope.pageSize = conf.pollDefaultPageSize;
+ }
+ else {
+ $scope.pageSize = -1;
+ }
$scope.urlPagination = $scope.setUrl(['page', 'pageSize']);
var paginationParameter = {pageSize:$scope.pageSize};
@@ -1035,7 +1055,8 @@ angular.module('pollControllers', [])
$scope.data.polls = data.elements
$scope.data.pollsPagination = data.pagination;
}, function (error) {
- $scope.restError = {forbidden:true};
+ $rootScope.$broadcast('newError', 'error.forbidden');
+ $location.url('/');
});
}; initPolls();
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
index cb4104e..20b38da 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -35,7 +35,7 @@
$scope.submit = function () {
if ($scope.data.user.password == $scope.data.user.password2) {
User.add({}, $scope.data.user, function (data) {
- $rootScope.$broadcast('newSuccess', 'user.register.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.register.success');
$scope.data.user = {email:'', password:'', password2:''};
}, function (error) {
$scope.restError = error.data;
@@ -55,7 +55,7 @@
$scope.submit = function () {
if ($scope.email != '') {
UserLostPassword.send({login:$scope.email}, function (data) {
- $rootScope.$broadcast('newSuccess', 'user.forgotPassword.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.forgotPassword.success');
$scope.email = '';
}, function (error) {
$translate('user.error.mail.notFound').then(function (error) {
@@ -86,7 +86,7 @@
$scope.editUser = function () {
User.update($scope.currentUser, function (data) {
SessionStorage.save({user:data});
- $rootScope.$broadcast('newSuccess', 'user.edit.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.edit.success');
}, function (error) {
$scope.restError = error.data;
});
@@ -96,7 +96,7 @@
if ($scope.currentUser.newPassword == $scope.currentUser.newPassword2) {
User.editPassword($scope.currentUser, function (data) {
SessionStorage.save({user:data});
- $rootScope.$broadcast('newSuccess', 'user.edit.success', conf.defaultTimeSuccessSave);
+ $rootScope.$broadcast('newSuccess', 'user.edit.success');
}, function (error) {
$scope.restError = error.data;
});
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-list.html b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
index 0d9c69c..e036126 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
@@ -1,6 +1,4 @@
-<alert type="danger" ng-if="restError.forbidden">Accès interdit</alert>
-
<div ng-repeat="poll in data.polls">
<h2><a href="#/poll/vote/{{poll.id}}">{{poll.title}}</a> <a href="#/poll/edit/{{poll.id}}"><i class="glyphicon glyphicon-pencil"></i></a></h2>
<p ng-bind-html="toHTML(poll.description)"></p>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
index a60cb46..8007aa3 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
@@ -91,7 +91,7 @@
<th colspan="4">
<button class="btn btn-info" ng-click="addVoter($index);"> <span class="glyphicon glyphicon-plus"></span> {{ 'action.restricted.addVoter' | translate }} </button>
<button class="btn btn-danger" ng-click="deleteVoterList(voterList);"> <span class="glyphicon glyphicon-trash"></span> {{ 'action.restricted.deleteGroup' | translate }} </button>
- <button class="btn btn-info" ng-click="importFavoriteList(voterList.group.id)" ng-if="data.favoriteList"><span class="glyphicon glyphicon-plus"></span> {{ 'action.favoriteList.import.inGroup' | translate }}</button>
+ <button class="btn btn-info" ng-click="importFavoriteList(voterList)" ng-if="data.favoriteList"><span class="glyphicon glyphicon-plus"></span> {{ 'action.favoriteList.import.inGroup' | translate }}</button>
</th>
</tr>
</table>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
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 56ceaf71cb0a7c0ded15ce9a98c3a205ad16134e
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jun 24 12:00:16 2014 +0200
use controller for alert
---
pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 +
pollen-ui-angular/src/main/webapp/index.html | 5 ++
pollen-ui-angular/src/main/webapp/js/app.js | 20 ++++----
.../src/main/webapp/js/controllers/alertCtrl.js | 56 ++++++++++++++++++++++
.../src/main/webapp/js/controllers/pollCtrl.js | 56 +++++++++++-----------
.../src/main/webapp/js/controllers/userCtrl.js | 32 ++++++++++---
pollen-ui-angular/src/main/webapp/js/services.js | 18 +++++++
.../src/main/webapp/partials/poll.html | 4 --
.../src/main/webapp/partials/user-edit.html | 2 -
.../main/webapp/partials/user-lostPassword.html | 2 -
.../src/main/webapp/partials/user-register.html | 4 +-
11 files changed, 146 insertions(+), 55 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 9466e8e..e624020 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -33,6 +33,8 @@ var translateFR = {
'user.error.mail.notFound' : 'Courriel n\'a pas été trouvé',
'user.error.mail.empty' : 'Courriel ne peux pas être vide',
'user.error.login' : 'Erreur sur le nom d\'utilisateur ou le mot de passe',
+'user.error.login.mandatory' : 'Accès refusé, vous devez êtes connecté(e)',
+'user.error.logout.mandatory' : 'Accès refusé, vous êtes connecté(e)',
'poll.tab.vote' : 'Voter',
'poll.tab.comment' : 'Commenter',
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index a4589d9..894c59e 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -51,6 +51,7 @@
<script src="js/controllers/userCtrl.js"></script>
<script src="js/controllers/favoriteListCtrl.js"></script>
<script src="js/controllers/localeCtrl.js"></script>
+ <script src="js/controllers/alertCtrl.js"></script>
<script src="i18n/fr.js"></script>
<script src="i18n/en.js"></script>
@@ -148,6 +149,10 @@
</div>
</nav>
+<div class="pool-alert alert-float" ng-controller="printAlertCtrl" >
+ <alert ng-repeat="alert in data.alerts track by $index" type="{{alert.type}}" class="fakeLink" close="hideAlert(alert)" ng-click="hideAlert(alert)"> {{ alert.msg | translate }} </alert>
+</div>
+
<div ng-view class='container' id="content"></div>
</body>
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 0465c9e..5d87bae 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
+angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'alertControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
.config(['$httpProvider', function($httpProvider) {
// edit header for locale and sessionToken
$httpProvider.interceptors.push('httpInterceptor');
@@ -237,14 +237,16 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
scope.oldVal = {};
scope.change = false;
scope.timeout;
- scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel);
- scope.$watch(attrs.ngModel, function (newVal, oldVal) {
- if (newVal != scope.oldVal[attrs.ngModel]) {
- scope.change = true;
- } else {
- scope.change = false;
- }
- }, true);
+ $timeout(function () {
+ scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel);
+ scope.$watch(attrs.ngModel, function (newVal, oldVal) {
+ if (angular.isDefined(oldVal) && newVal != scope.oldVal[attrs.ngModel]) {
+ scope.change = true;
+ } else {
+ scope.change = false;
+ }
+ }, true);
+ }, 500);
var save = function () {
if (scope.change) {
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
new file mode 100644
index 0000000..7d798c0
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -0,0 +1,56 @@
+/*
+ * #%L
+ * Pollen :: UI (Angular)
+ * %%
+ * Copyright (C) 2009 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+angular.module('alertControllers', [])
+.controller('printAlertCtrl', ['$scope', '$timeout',
+ function ($scope, $timeout) {
+
+ if (angular.isUndefined($scope.data)) {
+ $scope.data = {}
+ }
+ $scope.data.alerts = [];
+
+ $scope.$on('newError', function (event, error, timeout) {
+ var alert = {msg:error, type:'danger'};
+ addAlert(alert, timeout);
+ });
+
+ $scope.$on('newSuccess', function (event, success, timeout) {
+ var alert = {msg:success, type:'success'};
+ addAlert(alert, timeout);
+ });
+
+ var addAlert = function (alert, timeout) {
+ $scope.data.alerts.push(alert);
+ if (angular.isDefined(timeout)) {
+ $timeout(function () {
+ $scope.hideAlert(alert)
+ }, timeout);
+ }
+ }
+
+ $scope.hideAlert = function (alert) {
+ var index = $scope.data.alerts.indexOf(alert);
+ if (index >= 0) {
+ $scope.data.alerts.splice(index, 1);
+ }
+ }
+}])
\ No newline at end of file
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 316add0..ba0865e 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -54,14 +54,7 @@ angular.module('pollControllers', [])
if (angular.isUndefined($scope.globalVariables)) {
- $scope.globalVariables = {saved : SessionStorage.get().saved};
- SessionStorage.remove('saved');
-
- $scope.$watch('globalVariables.saved', function() {
- $timeout(function () {
- $scope.globalVariables.saved = false;
- }, 5000);
- });
+ $scope.globalVariables = {};
/**
* Sauvegarde du token si non connecté
@@ -327,8 +320,8 @@ angular.module('pollControllers', [])
}
}])
-.controller('PollCreateCtrl', ['$scope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList',
- function ( $scope, $controller, $location, Poll, SessionStorage, PollVoterList) {
+.controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList',
+ function ( $scope, $rootScope, $controller, $location, Poll, SessionStorage, PollVoterList) {
$controller('PollAdminCtrl', {$scope:$scope});
$scope.globalVariables.create = true;
@@ -356,7 +349,7 @@ angular.module('pollControllers', [])
}
Poll.add(poll, function (data) {
- SessionStorage.save({saved: true});
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
if ($scope.data.poll.pollType != 'FREE') {
SessionStorage.save({'voterList':$scope.data.voterList})
$location.url('/poll/edit/'+data.id+'?token='+data.permission);
@@ -371,7 +364,11 @@ angular.module('pollControllers', [])
if (angular.isDefined(error.data['choice['+index+'].name'])) {
choice.restError = {name:error.data['choice['+index+'].name']};
}
- })
+ });
+
+ if (angular.isDefined(error.data.choice)) {
+ $rootScope.$broadcast('newError', error.data.choice[0]);
+ }
});
}
@@ -381,8 +378,8 @@ angular.module('pollControllers', [])
}])
-.controller('PollEditCtrl', ['$scope', '$controller', '$routeParams', '$location', '$timeout', '$translate', 'Poll', 'PollChoice', 'PollVote', 'PollVoterList', 'PollVoterListMember', 'FavoriteList', 'SessionStorage',
- function ( $scope, $controller, $routeParams, $location, $timeout, $translate, Poll, PollChoice, PollVote, PollVoterList, PollVoterListMember, FavoriteList, SessionStorage) {
+.controller('PollEditCtrl', ['$scope', '$rootScope', '$controller', '$routeParams', '$location', '$timeout', '$translate', 'Poll', 'PollChoice', 'PollVote', 'PollVoterList', 'PollVoterListMember', 'FavoriteList', 'SessionStorage',
+ function ( $scope, $rootScope, $controller, $routeParams, $location, $timeout, $translate, Poll, PollChoice, PollVote, PollVoterList, PollVoterListMember, FavoriteList, SessionStorage) {
$controller('PollAdminCtrl', {$scope:$scope});
$scope.globalVariables.edit = true;
@@ -395,7 +392,7 @@ angular.module('pollControllers', [])
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function (data) {
delete choice.restError;
choice.id = data.id;
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
}, function (error) {
choice.restError = error.data;
});
@@ -404,7 +401,7 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function() {
delete choice.restError;
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
}, function (error) {
choice.restError = error.data;
});
@@ -412,13 +409,16 @@ angular.module('pollControllers', [])
$scope.deleteChoice = function (choice) {
PollChoice.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, choiceId: choice.id}, function () {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
var index = $scope.data.choices.indexOf(choice);
if (index > -1) {
$scope.data.choices.splice(index,1);
}
}, function (error) {
angular.extend($scope.restError, error.data);
+ if (angular.isDefined(error.data.choice)) {
+ $rootScope.$broadcast('newError', error.data.choice[0]);
+ }
});
};
@@ -500,7 +500,7 @@ angular.module('pollControllers', [])
$scope.saveVoterList = function (voterList) {
if (angular.isDefined(voterList.group.id)) {
PollVoterList.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:voterList.group.id}, voterList.group, function (data) {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
delete voterList.group.restError;
}, function (error) {
voterList.group.restError = error.data;
@@ -519,7 +519,7 @@ angular.module('pollControllers', [])
});
if (vl.members.length > 0) {
PollVoterList.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, vl, function (data) {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
voterList.group.id = data.id;
delete voterList.group.restError;
@@ -577,7 +577,7 @@ angular.module('pollControllers', [])
}
vlMemberPromise.then(function (data) {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
member.id = data.id;
delete member.restError;
}, function (error) {
@@ -694,7 +694,7 @@ angular.module('pollControllers', [])
}
$scope.data.poll.$update({permission:$scope.globalVariables.permission}, function (data) {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'poll.saved', conf.defaultTimeSuccessSave);
}, function (error) {
angular.extend($scope.restError, error.data);
});
@@ -715,8 +715,8 @@ angular.module('pollControllers', [])
};
}])
-.controller('PollVoteCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate',
- function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate) {
+.controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate',
+ function ($scope, $rootScope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate) {
$controller('PollCtrl', {$scope:$scope});
$scope.tab = $scope.setTab('vote');
@@ -778,7 +778,7 @@ angular.module('pollControllers', [])
if (angular.isDefined($scope.data.vote.id)) {
// edit vote
PollVote.update({pollId:$routeParams.pollId}, sendVote, function (data) {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'vote.added', conf.defaultTimeSuccessSave);
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
})
@@ -790,7 +790,7 @@ angular.module('pollControllers', [])
$scope.data.vote.permission = returnRequest.permission;
$scope.data.votants.push(angular.copy($scope.data.vote));
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'vote.added', conf.defaultTimeSuccessSave);
initVote();
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
@@ -826,8 +826,8 @@ angular.module('pollControllers', [])
}])
.controller('PollCommentCtrl',
- ['$scope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate',
- function ( $scope, $controller, $routeParams, Poll, PollComment, $translate) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate',
+ function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate) {
$controller('PollCtrl', {$scope:$scope});
$scope.tab = $scope.setTab('comment');
@@ -912,7 +912,7 @@ angular.module('pollControllers', [])
}
commentPromise.then(function () {
- $scope.globalVariables.saved = true;
+ $rootScope.$broadcast('newSuccess', 'comment.added', conf.defaultTimeSuccessSave);
//clean form
$scope.comment.text = '';
delete $scope.comment.postDate;
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
index 8a3c40d..cb4104e 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -19,7 +19,13 @@
* #L%
*/
angular.module('userControllers', [])
- .controller('UserRegisterCtrl', ['$scope', 'User', function ($scope, User) {
+ .controller('UserRegisterCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage',
+ function ($scope, $rootScope, $location, User, SessionStorage) {
+
+ if (angular.isDefined(SessionStorage.get().user)) {
+ $rootScope.$broadcast('newError', 'user.error.logout.mandatory');
+ $location.url('/');
+ }
if (!angular.isDefined($scope.data)) {
$scope.data = {};
@@ -29,7 +35,7 @@
$scope.submit = function () {
if ($scope.data.user.password == $scope.data.user.password2) {
User.add({}, $scope.data.user, function (data) {
- $scope.saved = true;
+ $rootScope.$broadcast('newSuccess', 'user.register.success', conf.defaultTimeSuccessSave);
$scope.data.user = {email:'', password:'', password2:''};
}, function (error) {
$scope.restError = error.data;
@@ -38,12 +44,18 @@
}
}])
-.controller('UserLostPasswordCtrl', ['$scope', '$translate', 'UserLostPassword', function ($scope, $translate, UserLostPassword) {
+.controller('UserLostPasswordCtrl', ['$scope', '$rootScope', '$translate', '$location', 'SessionStorage', 'UserLostPassword',
+ function ($scope, $rootScope, $translate, $location, SessionStorage, UserLostPassword) {
+ if (angular.isDefined(SessionStorage.get().user)) {
+ $rootScope.$broadcast('newError', 'user.error.logout.mandatory');
+ $location.url('/');
+ }
+
$scope.email = '';
$scope.submit = function () {
if ($scope.email != '') {
UserLostPassword.send({login:$scope.email}, function (data) {
- $scope.saved = true;
+ $rootScope.$broadcast('newSuccess', 'user.forgotPassword.success', conf.defaultTimeSuccessSave);
$scope.email = '';
}, function (error) {
$translate('user.error.mail.notFound').then(function (error) {
@@ -61,14 +73,20 @@
-.controller('UserEditCtrl', ['$scope', 'User', 'SessionStorage', function ($scope, User, SessionStorage) {
+.controller('UserEditCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage', function ($scope, $rootScope, $location, User, SessionStorage) {
$scope.currentUser = SessionStorage.get().user;
+
+ if (angular.isUndefined($scope.currentUser)) {
+ $rootScope.$broadcast('newError', 'user.error.login.mandatory' );
+ $location.url('/');
+ }
+
$scope.currentUser.password = '';
$scope.editUser = function () {
User.update($scope.currentUser, function (data) {
SessionStorage.save({user:data});
- $scope.saved = true;
+ $rootScope.$broadcast('newSuccess', 'user.edit.success', conf.defaultTimeSuccessSave);
}, function (error) {
$scope.restError = error.data;
});
@@ -78,7 +96,7 @@
if ($scope.currentUser.newPassword == $scope.currentUser.newPassword2) {
User.editPassword($scope.currentUser, function (data) {
SessionStorage.save({user:data});
- $scope.saved = true;
+ $rootScope.$broadcast('newSuccess', 'user.edit.success', conf.defaultTimeSuccessSave);
}, function (error) {
$scope.restError = error.data;
});
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index 74b248b..e819aa8 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -317,6 +317,24 @@ angular.module('pollenServices', ['ngResource'])
})
localStorage.setItem(storageId, JSON.stringify(session));
},
+ append: function (data) {
+ angular.forEach(data, function (value, key) {
+ var field = session[key];
+ if (angular.isDefined(field)) {
+ if (angular.isArray(field)) {
+ field.push(value);
+ }
+ else {
+ field = [field, value];
+ }
+ }
+ else {
+ field = value;
+ }
+ session[key] = field;
+ });
+ localStorage.setItem(storageId, JSON.stringify(session));
+ },
remove: function (key) {
if (angular.isString(key)) {
delete session[key];
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html
index 87315b2..58bc694 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@ -19,10 +19,6 @@
#L%
-->
<div>
- <alert type="danger" class="alert-float" ng-if="restError.choice" close="restError.choice = false"> {{restError.choice[0]}} </alert>
- <alert type="success" class="alert-float" ng-if="globalVariables.editMode && globalVariables.saved" close="globalVariables.saved = false">{{ 'poll.saved' | translate }}</alert>
- <alert type="success" class="alert-float" ng-if="globalVariables.voteMode && globalVariables.saved" close="globalVariables.saved = false">{{ 'vote.added' | translate }}</alert>
- <alert type="success" class="alert-float" ng-if="globalVariables.commentMode && globalVariables.saved" close="globalVariables.saved = false">{{ 'comment.added' | translate }}</alert>
<ul class="nav nav-tabs">
<li ng-class="{active: tab == 'home'}"><a href="{{urlTab}}tab=home" ng-click="tab = 'home'"> <span class="glyphicon glyphicon-home"></span> </a></li>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-edit.html b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
index ccb0ae2..c995f7d 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-edit.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
@@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<alert type="success" class="alert-float" ng-show="saved" close="saved = false"> {{ 'user.edit.success' | translate }} </alert>
-
<h2> {{ 'title.editUser' | translate }} </h2>
<form class="horizontal-form" ng-submit="editUser()">
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html b/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
index fbf6890..dd28daa 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
@@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<alert type="success" class="alert-float" ng-show="saved" close="saved = false"> {{ 'user.forgotPassword.success' | translate }} </alert>
-
<h2>{{ 'title.forgotPassword' | translate }}</h2>
<form ng-submit="submit()" class="form-horizontal">
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-register.html b/pollen-ui-angular/src/main/webapp/partials/user-register.html
index a604231..ea75471 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-register.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-register.html
@@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<alert type="success" class="alert-float" ng-show="saved" close="saved = false"> {{ 'user.register.success' | translate }}</alert>
-
<h2>{{ 'title.register' | translate }}</h2>
<form ng-submit="submit()" class="form-horizontal">
@@ -42,7 +40,7 @@
{{ 'user.name' | translate }}
</label>
<div class="col-sm-6">
- <input type="text" id="formName" name="login" class="form-control" ng-model="data.user.name"/>
+ <input type="text" id="formName" name="email" class="form-control" ng-model="data.user.name"/>
</div>
<div class="col-sm-1">
</div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
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 fec8d1244e78d3c31b8f69c684a612a28d06bf24
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jun 23 15:39:23 2014 +0200
improve UI
---
pollen-ui-angular/src/main/webapp/css/style.css | 44 ++++++++++++++++++++-
.../src/main/webapp/img/chart-icon.png | Bin 0 -> 610 bytes
pollen-ui-angular/src/main/webapp/img/pie-icon.png | Bin 0 -> 1292 bytes
pollen-ui-angular/src/main/webapp/index.html | 4 +-
pollen-ui-angular/src/main/webapp/js/app.js | 41 ++++++++++---------
.../main/webapp/js/controllers/favoriteListCtrl.js | 17 ++++++--
.../src/main/webapp/js/controllers/pollCtrl.js | 29 ++++++++------
.../main/webapp/partials/favoriteList-edit.html | 4 +-
.../src/main/webapp/partials/poll-comment.html | 2 +-
.../main/webapp/partials/poll-listParticipant.html | 13 ++++--
.../src/main/webapp/partials/poll-result.html | 34 ++++++++++++----
11 files changed, 138 insertions(+), 50 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/css/style.css b/pollen-ui-angular/src/main/webapp/css/style.css
index ab77b85..7047243 100644
--- a/pollen-ui-angular/src/main/webapp/css/style.css
+++ b/pollen-ui-angular/src/main/webapp/css/style.css
@@ -276,4 +276,46 @@ i.icon-collapse {
hr {
border-top:1px solid #CCCCCC;
-}
\ No newline at end of file
+}
+
+.table-result {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top:5px;
+ margin-bottom:15px;
+}
+.table-result tr, .table-result tr td, .table-result tr th {
+ padding:8px;
+ border: 1px solid #AAA;
+ transition-duration: 0.5s;
+}
+
+.table-result tr:hover {
+ background:#DDDDDD;
+ transition-duration: 0.5s;
+}
+
+.plot {
+ height:300px;
+ margin-top:5px;
+ margin-bottom:15px;
+}
+
+.ng-enter, .ng-leave {
+ -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.25s;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.25s;
+}
+
+.ng-leave {
+ height:0px;
+}
+
+.ng-enter,
+.ng-leave.ng-leave-active {
+ opacity:0;
+}
+
+.ng-leave,
+.ng-enter.ng-enter-active {
+ opacity:1;
+}
diff --git a/pollen-ui-angular/src/main/webapp/img/chart-icon.png b/pollen-ui-angular/src/main/webapp/img/chart-icon.png
new file mode 100644
index 0000000..152442c
Binary files /dev/null and b/pollen-ui-angular/src/main/webapp/img/chart-icon.png differ
diff --git a/pollen-ui-angular/src/main/webapp/img/pie-icon.png b/pollen-ui-angular/src/main/webapp/img/pie-icon.png
new file mode 100644
index 0000000..fba9dd7
Binary files /dev/null and b/pollen-ui-angular/src/main/webapp/img/pie-icon.png differ
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 4423296..a4589d9 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -35,15 +35,15 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.pieRende…"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.category…"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.pointLab…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.highligh…"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.4.1/ckeditor.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-resource.min…"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-animate.min.…"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bower-angular-translate/2.0.1/angula…"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.0/ui-boots…"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.4.1/ckeditor.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 037841d..0465c9e 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'ui.bootstrap', 'pascalprecht.translate'])
+angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
.config(['$httpProvider', function($httpProvider) {
// edit header for locale and sessionToken
$httpProvider.interceptors.push('httpInterceptor');
@@ -320,6 +320,7 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
restrict : 'E',
scope : {
data:'=',
+ max:'='
},
template:'<div class="jqplot-target"></div>',
link: function(scope, element, attrs) {
@@ -332,7 +333,6 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
//animate: !$.jqplot.use_excanvas,
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
- pointLabels: { show: true },
rendererOptions : {
varyBarColor: true
}
@@ -340,6 +340,7 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
axesDefaults: {
showTicks: true,
showTickMarks: true,
+ max: scope.max,
tickOptions: {
showGridline: false,
show:true,
@@ -349,25 +350,28 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
+ },
+ yaxis: {
+ label:'Vote',
}
- },
- highlighter: {
- showMaker:false,
- tooltipLocation: 'ne',
- formatString:'<div style="display:none">%s</div>%s Vote(s)'
}
});
+
+ var imgData = $(element).find('div').jqplotToImageStr({});
+ $(element).html('<img src="' + imgData + '" />')
}
};
- scope.$watch('data', function () {
- if (angular.isDefined(scope.plot)) {
- scope.plot.html('');
- initChart()
- } else {
- initChart();
- }
- }, true);
+ $timeout( function() {
+ scope.$watch('data', function () {
+ if (angular.isDefined(scope.plot)) {
+ scope.plot.html('');
+ initChart()
+ } else {
+ initChart();
+ }
+ });
+ });
}
}
})
@@ -398,11 +402,12 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
},
legend:{
show:true
- },
- highlighter:{
- show:false
}
});
+
+ var imgData = $(element).find('div').jqplotToImageStr({});
+ $(element).html('<img src="' + imgData + '" />')
+
}
};
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
index 6bd03aa..655996f 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
@@ -70,6 +70,10 @@ angular.module('favoriteListControllers', [])
}
});
+ var getEmptyFavoriteList = function () {
+ return {name:'', members: []};
+ }
+
var initFavoriteList = function () {
if ($routeParams.favoriteListId) {
FavoriteList.get({favoriteListId:$routeParams.favoriteListId}, function (favList) {
@@ -78,7 +82,7 @@ angular.module('favoriteListControllers', [])
});
}
else {
- $scope.data.favoriteList = {name:'', members: []};
+ $scope.data.favoriteList = getEmptyFavoriteList();
}
}; initFavoriteList();
@@ -170,10 +174,13 @@ angular.module('favoriteListControllers', [])
}
});
}
+ else {
+ $location.url('/favoriteList');
+ }
};
$scope.deleteMember = function (member) {
- if (angular.isDefined($scope.data.favoriteList.id)) {
+ if (angular.isDefined($scope.data.favoriteList.id) && angular.isDefined(member.id)) {
var confirmMessage;
$translate('action.message.confirmDelete').then(function (msg) {
confirmMessage = msg;
@@ -187,10 +194,14 @@ angular.module('favoriteListControllers', [])
}
});
}
+ else {
+ var index = $scope.data.favoriteList.members.indexOf(member);
+ $scope.data.favoriteList.members.splice(index, 1);
+ }
};
$scope.newFavoriteList = function () {
- initFavoriteList();
+ $scope.data.favoriteList = getEmptyFavoriteList();
$location.url('/favoriteList/new');
}
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 3714ed5..316add0 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -475,10 +475,12 @@ angular.module('pollControllers', [])
}
var initFavoriteList = function () {
- FavoriteList.get({paginationParameter:{pageSize:-1}}, function (data) {
- $scope.data.favoriteList = data.elements;
- $scope.data.favoriteListImport = null;
- });
+ if (angular.isDefined(SessionStorage.get().user)) {
+ FavoriteList.get({paginationParameter:{pageSize:-1}}, function (data) {
+ $scope.data.favoriteList = data.elements;
+ $scope.data.favoriteListImport = null;
+ });
+ }
}; initFavoriteList();
$scope.importFavoriteList = function (voterListId) {
@@ -602,6 +604,9 @@ angular.module('pollControllers', [])
PollVoterList.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:voterList.group.id}, function (data) {
var index = $scope.data.voterList.indexOf(voterList);
$scope.data.voterList.splice(index, 1);
+ if ($scope.data.voterList.length == 0 && $scope.data.poll.pollType == 'RESTRICTED') {
+ $scope.addGroup();
+ }
});
}
});
@@ -609,6 +614,9 @@ angular.module('pollControllers', [])
else {
var index = $scope.data.voterList.indexOf(voterList);
$scope.data.voterList.splice(index, 1);
+ if ($scope.data.voterList.length == 0 && $scope.data.poll.pollType == 'RESTRICTED') {
+ $scope.addGroup();
+ }
}
};
@@ -956,6 +964,7 @@ angular.module('pollControllers', [])
$controller('PollCtrl', {$scope:$scope});
$scope.tab = $scope.setTab('result');
+ $scope.plot = 'chart';
var choicesDeferred = $q.defer();
PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
@@ -992,16 +1001,14 @@ angular.module('pollControllers', [])
}
}
})
- $scope.data.result.scoresChart = scores;
resultDeferred.resolve('result load');
- });
- });
- votesDeferred.promise.then(function () {
- angular.forEach($scope.data.result.scoresChart, function (value, key) {
- value.push( Math.round(value[1] * 100 / $scope.data.result.scoreTotal) + '%');
+ votesDeferred.promise.then(function () {
+ $scope.data.result.scoresChart = scores;
+ });
+
});
- })
+ });
}])
diff --git a/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html b/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html
index 3ceb95d..47f66fa 100644
--- a/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html
+++ b/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html
@@ -32,7 +32,7 @@
<input type="text" ng-model="member.email" class="form-control" auto-save="saveMember(member)" />
</input-error>
</td>
- <td class="action"> <div ng-show="member.id"><button class="btn btn-danger" ng-click="deleteMember(member);" tooltip="{{ 'action.favoriteList.deleteMember' | translate }} "><span class="glyphicon glyphicon-trash"></span></button></div></td>
+ <td class="action"><button class="btn btn-danger" ng-click="deleteMember(member);" tooltip="{{ 'action.favoriteList.deleteMember' | translate }} "><span class="glyphicon glyphicon-trash"></span></button></td>
</tr>
<tr>
@@ -46,7 +46,7 @@
<tr>
<th colspan="3">
<button class="btn btn-info" ng-click="addMember();"><span class="glyphicon glyphicon-plus"></span> {{ 'action.favoriteList.addMember' | translate }} </button>
- <button class="btn btn-danger" ng-click="deleteFavoriteList();" ng-show="data.favoriteList.id"><span class="glyphicon glyphicon-trash"></span> {{ 'action.favoriteList.delete' | translate }} </button>
+ <button class="btn btn-danger" ng-click="deleteFavoriteList();"><span class="glyphicon glyphicon-trash"></span> {{ 'action.favoriteList.delete' | translate }} </button>
</th>
</tr>
</table>
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 a738c9c..cfd2042 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -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" focus-me="comment.id != null"></textarea>
+ <textarea 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-listParticipant.html b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
index dc0ef80..a60cb46 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
@@ -34,11 +34,14 @@
{{ 'poll.restricted.group' | translate }}
</label>
- <hr/>
- <div class="container-fluid">
+
+
+ <div class="container-fluid" ng-hide="data.poll.pollType == 'FREE'">
+ <hr/>
+
<div class="row">
<button class="btn btn-info" ng-show="data.poll.pollType == 'GROUP'" ng-click="addGroup()"><span class="glyphicon glyphicon-plus"></span> {{ 'action.restricted.addGroup' | translate }}</button>
- <button class="btn btn-warning" ng-hide="data.poll.pollType == 'FREE'" disabled><span class="glyphicon glyphicon-envelope"></span> {{ 'action.restricted.notify' | translate }}</button>
+ <button class="btn btn-warning" disabled><span class="glyphicon glyphicon-envelope"></span> {{ 'action.restricted.notify' | translate }}</button>
</div>
<div class="row" ng-if="data.favoriteList">
@@ -56,9 +59,11 @@
</select>
</div>
</div>
+
+ <hr/>
</div>
- <hr/>
+
<table ng-repeat="voterList in data.voterList" class="voterList" ng-hide="data.poll.pollType == 'FREE'">
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-result.html b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
index 8ff8bb9..fb492d4 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-result.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
@@ -2,12 +2,30 @@
<h2> Résultats : {{data.result.nbVotant}} Votants</h2>
-<chart data="data.result.scoresChart"></chart>
-<pie data="data.result.scoresChart"></pie>
-<div ng-repeat="score in data.result.scores">
- <h4> {{score.choice.name}} </h4>
- <p>
- nb vote : {{score.scoreValue}}
- </p>
-</div>
\ No newline at end of file
+<hr/>
+<div>
+ <button class="btn btn-default" ng-click="plot = 'chart'"><img src="img/chart-icon.png" /></button>
+ <button class="btn btn-default" ng-click="plot = 'pie'"><img src="img/pie-icon.png" </button>
+</div>
+<div class="plot">
+ <div ng-if="plot == 'chart'">
+ <chart data="data.result.scoresChart" max="data.result.nbVotant"></chart>
+ </div>
+ <div ng-if="plot == 'pie'">
+ <pie data="data.result.scoresChart"></pie>
+ </div>
+</div>
+<hr/>
+<table class="table-result">
+ <tr>
+ <th>Choix</th>
+ <th>Score</th>
+ </tr>
+ <tr ng-repeat="score in data.result.scores">
+ <th> {{score.choice.name}} </th>
+ <td>
+ {{score.scoreValue}}
+ </td>
+ </tr>
+</table>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
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(a)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(a)chorem.org>.
1
0
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 f7646a0e2f902e496d99e9f5f15da463bb0f992e
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jun 23 10:25:15 2014 +0200
fix url lib ckeditor
---
pollen-ui-angular/src/main/webapp/js/app.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 8dd1a9c..6c57603 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -123,7 +123,7 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
return {
require: '?ngModel',
link: function ($scope, element, attrs, ngModel) {
- var ck = CKEDITOR.replace(element[0], {customConfig: '//' + location.host + '/js/libs/ckeditor/config.js'});
+ var ck = CKEDITOR.replace(element[0], {customConfig: window.location.origin + window.location.pathname + 'js/libs/ckeditor/config.js'});
ck.on('pasteState', function () {
$scope.$apply(function () {
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
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 586df05664df9644ab7514246746560fe69f3789
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jun 20 18:08:45 2014 +0200
setup spinner in voterList form
---
pollen-ui-angular/src/main/webapp/js/app.js | 19 +++++++------------
.../main/webapp/partials/poll-listParticipant.html | 4 ++--
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index a186282..8dd1a9c 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -240,15 +240,11 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
var save = function () {
if (scope.change) {
- // other change
- scope.timeout = $timeout(function () {
- scope.change = false;
- scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel);;
- scope.$apply(function () {
- scope.$eval(attrs.autoSave);
- });
- $timeout.cancel(scope.timeout);
- }, 200);
+ scope.change = false;
+ scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel);;
+ scope.$apply(function () {
+ scope.$eval(attrs.autoSave);
+ });
}
};
@@ -256,15 +252,14 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'userC
if (scope.timeout) {
$timeout.cancel(scope.timeout)
}
- save();
+ scope.timeout = $timeout(save,1000);
});
element.bind('blur', function () {
if (scope.timeout) {
$timeout.cancel(scope.timeout)
}
- // timeout for conflit with event change
- $timeout(save, 50);
+ scope.timeout = $timeout(save, 100);
});
}
}
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
index 5273ec0..dc0ef80 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-listParticipant.html
@@ -64,7 +64,7 @@
<tr ng-show="data.poll.pollType == 'GROUP'" ng-class="{'has-success':voterList.group.id && !voterList.group.restError}">
<th colspan="2" ng-class="{'has-error':voterList.group.restError.name}"> <input type="text" name="group" placeholder="name group" ng-model="voterList.group.name" class="form-control" auto-save="saveVoterList(voterList)" focus-me="!voterList.group.id"/></th>
- <th class="weight" ng-class="{'has-error':voterList.group.restError.weight}"> <input type="number" ng-model="voterList.group.weight" select-on-click class="form-control" auto-save="saveVoterList(voterList)" /> </th>
+ <th class="weight" ng-class="{'has-error':voterList.group.restError.weight}"> <input type="number" step="0.1" min="0" ng-model="voterList.group.weight" select-on-click class="form-control" auto-save="saveVoterList(voterList)" /> </th>
<th class="action"> </th>
</tr>
@@ -78,7 +78,7 @@
<tr ng-repeat="member in voterList.members" ng-class="{'has-success':member.id && !member.restError}">
<td> <input-error error="member.restError.name[0]"><input type="text" ng-model="member.name" class="form-control" auto-save="saveVoterListMember(member, voterList)"/></input-error></td>
<td> <input-error error="member.restError.email[0]"><input type="text" ng-model="member.email" class="form-control" auto-save="saveVoterListMember(member, voterList)" /></input-error></td>
- <td class="weight"> <input-error error="member.restError.weight[0]"><input type="number" ng-model="member.weight" select-on-click class="form-control" auto-save="saveVoterListMember(member, voterList)"/></input-error></td>
+ <td class="weight"> <input-error error="member.restError.weight[0]"><input type="number" step="0.1" min="0" ng-model="member.weight" select-on-click class="form-control" auto-save="saveVoterListMember(member, voterList)"/></input-error></td>
<td class="action"> <button class="btn btn-danger" ng-click="deleteVoterListMember(member, voterList);" tooltip="{{ 'action.restricted.deleteVoter' | translate }}"><span class="glyphicon glyphicon-trash"></span></button></td>
</tr>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0