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 develop in repository pollen.
See http://git.chorem.org/pollen.git
commit c6f99acfa8c0bedc1323519e2de8aa39983a1de8
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jun 30 14:52:16 2014 +0200
improve alert
---
pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js | 8 ++++----
pollen-ui-angular/src/main/webapp/less/style.less | 10 ++++++++++
pollen-ui-angular/src/main/webapp/partials/alerts.html | 2 +-
3 files changed, 15 insertions(+), 5 deletions(-)
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 2099ed7..a6ea298 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -29,7 +29,7 @@ angular.module('alertControllers', [])
$scope.data.alerts = [];
$scope.$on('newError', function (event, error, timeout) {
- var alert = {msg:error, type:'danger'};
+ var alert = {msg:error, type:'danger', glyphicon:'glyphicon-remove'};
if (angular.isDefined(timeout)) {
addAlert(alert, timeout);
} else {
@@ -38,7 +38,7 @@ angular.module('alertControllers', [])
});
$scope.$on('newWarning', function (event, warning, timeout) {
- var alert = {msg:warning, type:'warning'};
+ var alert = {msg:warning, type:'warning', glyphicon:'glyphicon-warning-sign'};
if (angular.isDefined(timeout)) {
addAlert(alert, timeout);
} else {
@@ -47,7 +47,7 @@ angular.module('alertControllers', [])
});
$scope.$on('newSuccess', function (event, success, timeout) {
- var alert = {msg:success, type:'success'};
+ var alert = {msg:success, type:'success', glyphicon:'glyphicon-ok'};
if (angular.isDefined(timeout)) {
addAlert(alert, timeout);
} else {
@@ -56,7 +56,7 @@ angular.module('alertControllers', [])
});
$scope.$on('newInfo', function (event, info, timeout) {
- var alert = {msg:info, type:'info'};
+ var alert = {msg:info, type:'info', glyphicon:'glyphicon-info-sign'};
if (angular.isDefined(timeout)) {
addAlert(alert, timeout);
} else {
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 278b7ff..6939672 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -295,8 +295,18 @@
top:65px;
left:20%;
width:60%;
+ font-size:1.1em;
+ font-weight:bold;
z-index: 100000;
opacity: 0.9;
+
+ .glyphicon {
+ display:inline-block;
+ font-size:1.4em;
+ top:5px;
+ font-weight:bolder;
+ margin-right: 15px;
+ }
}
.danger {
diff --git a/pollen-ui-angular/src/main/webapp/partials/alerts.html b/pollen-ui-angular/src/main/webapp/partials/alerts.html
index 6102bbe..17fd0c9 100644
--- a/pollen-ui-angular/src/main/webapp/partials/alerts.html
+++ b/pollen-ui-angular/src/main/webapp/partials/alerts.html
@@ -1,3 +1,3 @@
<div class="pool-alert" ng-controller="printAlertCtrl" >
- <alert ng-repeat="alert in data.alerts" type="{{alert.type}}" class="fakeLink" close="hideAlert(alert)" ng-click="hideAlert(alert)"> {{ alert.msg | translate }} </alert>
+ <alert ng-repeat="alert in data.alerts" type="{{alert.type}}" class="fakeLink" close="hideAlert(alert)" ng-click="hideAlert(alert)"><span class="glyphicon" ng-class="alert.glyphicon"></span> {{ alert.msg | translate }} </alert>
</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
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 c4bf43841d5095130891df64f1ecb5723b9f428f
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jun 30 14:28:20 2014 +0200
close a poll
---
.../org/chorem/pollen/services/bean/PollBean.java | 1 +
.../chorem/pollen/services/service/PollService.java | 4 ++++
pollen-ui-angular/src/main/webapp/i18n/en.js | 2 ++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 ++
.../src/main/webapp/js/controllers/pollCtrl.js | 21 +++++++++++++++++++++
pollen-ui-angular/src/main/webapp/js/services.js | 4 ++++
.../src/main/webapp/partials/inline-poll.html | 2 +-
.../src/main/webapp/partials/poll-link.html | 4 ++--
8 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java
index 6ba3655..93b2f5d 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java
@@ -170,6 +170,7 @@ public class PollBean extends PollenBean<Poll> {
entity.setVoteVisibility(getVoteVisibility());
entity.setCommentVisibility(getCommentVisibility());
entity.setResultVisibility(getResultVisibility());
+ entity.setClosed(isClosed());
return entity;
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
index a86ad15..d7e65d3 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
@@ -232,6 +232,10 @@ public class PollService extends PollenServiceSupport {
Poll poll = getPoll0(pollId);
+ poll.setClosed(true);
+
+ savePoll(toBean(PollBean.class, poll), null);
+
//TODO
commit();
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index d6f2bd2..d6cb8e7 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -50,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.closed' : 'Poll closed',
'poll.deleted' : 'Poll deleted',
'poll.restricted.name' : 'Name',
'poll.restricted.mail' : 'E-mail',
@@ -96,6 +97,7 @@ var translateEN = {
'action.favoriteList.deleteMember' : 'Delete the member',
'action.message.confirmDelete' : 'Are you sure to delete it?',
+'action.message.confirmClose' : 'Are you sure to close it?',
'dateFormat' : 'MM-dd-yy',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 256a92b..94e7ad3 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -56,6 +56,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.closed' : 'Sondage fermé',
'poll.deleted' : 'Sondage supprimé',
'poll.restricted.name' : 'Nom du votant',
'poll.restricted.mail' : 'Courriel du votant',
@@ -102,6 +103,7 @@ var translateFR = {
'action.favoriteList.deleteMember' : 'Supprimer le membre',
'action.message.confirmDelete' : 'Êtes vous sûr de vouloir le supprimer?',
+'action.message.confirmClose' : 'Êtes vous sûr de vouloir le fermer?',
'dateFormat' : 'dd/MM/yyyy',
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 33bbf22..c81e4da 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -95,6 +95,10 @@ angular.module('pollControllers', [])
});
pollDeferred.promise.then(function () {
+ if ($scope.data.poll.isClosed) {
+ $rootScope.$broadcast('newWarning', 'poll.closed', -1);
+ }
+
var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
$scope.globalVariables.linkHome = baseUrl;
$scope.globalVariables.linkVote = baseUrl;
@@ -218,6 +222,23 @@ angular.module('pollControllers', [])
}
};
+ $scope.closePoll = function () {
+ if (angular.isDefined($scope.data.poll.id)) {
+ var confirmMessage;
+ $translate('action.message.confirmClose').then(function (msg) {
+ confirmMessage = msg;
+ }).then( function () {
+ var confirmClose = confirm(confirmMessage);
+ if (confirmClose == true) {
+ $scope.data.poll.$close({permission:$scope.globalVariables.pollToken}, function() {
+ $rootScope.$broadcast('newSuccess', 'poll.closed');
+ $route.reload();
+ });
+ }
+ });
+ }
+ };
+
}])
.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$timeout', '$routeParams', function ($scope, $controller, $modal, $timeout, $routeParams) {
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index 68c3edf..fc3ff51 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -48,6 +48,10 @@ angular.module('pollenServices', ['ngResource'])
transformRequest : function (data, headersGetter) {
return 'poll='+encodeURIComponent(JSON.stringify(data));
}
+ },
+ 'close' : {
+ method : 'PUT',
+ url : conf.restURL+'/polls/:pollId/close'
}
});
}])
diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
index 733fa23..e19b41e 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -49,7 +49,7 @@
<!-- end print choice -->
<!-- begin input vote -->
- <tr ng-show="!globalVariables.editMode">
+ <tr ng-show="!globalVariables.editMode" ng-if="! data.poll.isClosed">
<td class="pollChoice">
<input-error error="data.vote.restError.voterName[0]" data="data.vote.voterName">
<input type="text" class="form-control" placeholder="{{ 'user.name' | translate }}" ng-model="data.vote.voterName" input-error="data.vote.restError.voterName[0]" />
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-link.html b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
index 76402f4..87fb324 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-link.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
@@ -23,7 +23,7 @@
<a class="fakeLink" ng-show="globalVariables.minify"><span class="glyphicon glyphicon-chevron-right"></span></a>
<a class="fakeLink" ng-hide="globalVariables.minify"><span class="glyphicon glyphicon-chevron-left"></span></a>
</li>
- <li ng-if="data.poll.id">
+ <li ng-if="! data.poll.isClosed">
<a href="{{globalVariables.linkVote}}">
<span class="glyphicon glyphicon-link" title="{{ 'poll.link.vote' | translate }}"></span>
<span class="text">{{ 'poll.link.vote' | translate }}</span>
@@ -62,7 +62,7 @@
</ul>
<ul>
<li ng-if="data.poll.permission">
- <a class="fakeLink danger">
+ <a class="fakeLink danger" ng-click="closePoll()">
<span class="glyphicon glyphicon-remove" title="{{ 'poll.link.close' | translate }}"></span>
<span class="text">{{ 'poll.link.close' | translate }}</span>
</a>
--
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 1202bd20f972c7d07eedf646a626507abb993d27
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jun 30 14:27:41 2014 +0200
add info alert and warning alert in alertCtrl
---
pollen-ui-angular/src/main/webapp/index.html | 4 +--
.../src/main/webapp/js/conf.js.exemple | 8 +++++
.../src/main/webapp/js/controllers/alertCtrl.js | 34 ++++++++++++++++++++--
pollen-ui-angular/src/main/webapp/less/style.less | 3 +-
.../src/main/webapp/partials/alerts.html | 3 ++
5 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index f1da5fa..d120a11 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -160,9 +160,7 @@
</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-include="'partials/alerts.html'"></div>
<div ng-view class='container-fluid' id="content"></div>
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 6fa3b5e..9c44d4a 100644
--- a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
+++ b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
@@ -17,10 +17,18 @@ var conf = {
// Default Language for i18n : 'en' or 'fr'
defaultLanguage: 'en',
+ // Time in ms to print alert info
+ // -1 for infinite time, click or reload for close alert
+ defaultAlertTimeInfo: 10000, // 10s
+
// 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 warning
+ // -1 for infinite time, click or reload for close alert
+ defaultAlertTimeWaring: 5000, // 5s
+
// Time in ms to print alert error
// -1 for infinite time, click or reload for close alert
defaultAlertTimeError: -1, // infinite
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 f2be73d..2099ed7 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -37,6 +37,15 @@ angular.module('alertControllers', [])
}
});
+ $scope.$on('newWarning', function (event, warning, timeout) {
+ var alert = {msg:warning, type:'warning'};
+ if (angular.isDefined(timeout)) {
+ addAlert(alert, timeout);
+ } else {
+ addAlert(alert, conf.defaultAlertTimeWarning);
+ }
+ });
+
$scope.$on('newSuccess', function (event, success, timeout) {
var alert = {msg:success, type:'success'};
if (angular.isDefined(timeout)) {
@@ -46,10 +55,31 @@ angular.module('alertControllers', [])
}
});
+ $scope.$on('newInfo', function (event, info, timeout) {
+ var alert = {msg:info, type:'info'};
+ if (angular.isDefined(timeout)) {
+ addAlert(alert, timeout);
+ } else {
+ addAlert(alert, conf.defaultAlertTimeInfo);
+ }
+ });
+
var addAlert = function (alert, timeout) {
- $scope.data.alerts.push(alert);
+ var alertNotExist = true;
+ angular.forEach($scope.data.alerts, function (oneAlert, key) {
+ if (angular.equals(oneAlert.msg, alert.msg) && angular.equals(oneAlert.type, alert.type)) {
+ $timeout.cancel(oneAlert.timeout);
+ alert = oneAlert;
+ alertNotExist = false;
+ }
+ });
+
+ if (alertNotExist) {
+ $scope.data.alerts.push(alert);
+ }
+
if (angular.isDefined(timeout) && timeout >= 0) {
- $timeout(function () {
+ alert.timeout = $timeout(function () {
$scope.hideAlert(alert)
}, timeout);
}
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index b6c8c79..278b7ff 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -290,8 +290,9 @@
margin-top:5px;
}
-.alert-float {
+.pool-alert {
position: fixed;
+ top:65px;
left:20%;
width:60%;
z-index: 100000;
diff --git a/pollen-ui-angular/src/main/webapp/partials/alerts.html b/pollen-ui-angular/src/main/webapp/partials/alerts.html
new file mode 100644
index 0000000..6102bbe
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/partials/alerts.html
@@ -0,0 +1,3 @@
+<div class="pool-alert" ng-controller="printAlertCtrl" >
+ <alert ng-repeat="alert in data.alerts" type="{{alert.type}}" class="fakeLink" close="hideAlert(alert)" ng-click="hideAlert(alert)"> {{ alert.msg | translate }} </alert>
+</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
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 8a2ccd02ab6e0acd4bdb5ff9aaab688f16675db9
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jun 30 12:17:02 2014 +0200
add flag in pollBean
---
.../org/chorem/pollen/services/bean/PollBean.java | 67 ++++++++++++++++++++++
pollen-ui-angular/src/main/webapp/index.html | 6 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 46 +++++++++------
.../src/main/webapp/partials/poll-link.html | 2 +-
.../src/main/webapp/partials/poll.html | 4 +-
5 files changed, 100 insertions(+), 25 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java
index 0613f68..6ba3655 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java
@@ -93,6 +93,14 @@ public class PollBean extends PollenBean<Poll> {
protected ResultVisibility resultVisibility;
+ protected boolean isClosed;
+
+ protected boolean resultIsVisible;
+
+ protected boolean commentIsVisible;
+
+ protected boolean voteIsVisible;
+
@Override
public void fromEntity(Poll entity) {
@@ -130,7 +138,9 @@ public class PollBean extends PollenBean<Poll> {
setVoteVisibility(entity.getVoteVisibility());
setCommentVisibility(entity.getCommentVisibility());
setResultVisibility(entity.getResultVisibility());
+ setClosed(entity.getClosed());
+ setFlag();
}
@Override
@@ -171,6 +181,8 @@ public class PollBean extends PollenBean<Poll> {
public void setPermission(String permission) {
this.permission = permission;
+ // check new permission
+ setFlag();
}
public String getCreatorName() {
@@ -309,4 +321,59 @@ public class PollBean extends PollenBean<Poll> {
this.resultVisibility = resultVisibility;
}
+ public boolean isClosed() {
+ return isClosed;
+ }
+
+ public void setClosed(boolean isClosed) {
+ this.isClosed = isClosed;
+ }
+
+ public boolean isResultIsVisible() {
+ return resultIsVisible;
+ }
+
+ public void setResultIsVisible(boolean resultIsVisible) {
+ this.resultIsVisible = resultIsVisible;
+ }
+
+ public boolean isCommentIsVisible() {
+ return commentIsVisible;
+ }
+
+ public void setCommentIsVisible(boolean commentIsVisible) {
+ this.commentIsVisible = commentIsVisible;
+ }
+
+ public boolean isVoteIsVisible() {
+ return voteIsVisible;
+ }
+
+ public void setVoteIsVisible(boolean voteIsVisible) {
+ this.voteIsVisible = voteIsVisible;
+ }
+
+ protected void setFlag() {
+ // TODO: check CommentVisibility.VOTER
+ if (getPermission() != null || getCommentVisibility() == CommentVisibility.EVERYBODY) {
+ setCommentIsVisible(true);
+ } else {
+ setCommentIsVisible(false);
+ }
+
+ // TODO: check VoteVisibility.VOTER
+ if ((getPermission() != null || getVoteVisibility() == VoteVisibility.EVERYBODY) && getVoteVisibility() != VoteVisibility.ANONYMOUS) {
+ setVoteIsVisible(true);
+ } else {
+ setVoteIsVisible(false);
+ }
+
+ // TODO: check ResultVisibility.VOTER
+ if ( (getPermission() != null || getResultVisibility() == ResultVisibility.EVERYBODY)
+ && (isContinuousResults() || isClosed()) ) {
+ setResultIsVisible(true);
+ } else {
+ setResultIsVisible(false);
+ }
+ }
}
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 23582be..f1da5fa 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -31,9 +31,9 @@
ou
$ mvn compile
-->
- <link rel="stylesheet/less" type="text/css" href="less/style.less" />
- <script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>
- <!--<link rel="stylesheet" type="text/css" href="css/style.css"/>-->
+ <!--<link rel="stylesheet/less" type="text/css" href="less/style.less" />
+ <script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>-->
+ <link rel="stylesheet" type="text/css" href="css/style.css"/>
<script language="javascript" type="text/javascript" src="js/conf.js"></script>
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index 63c7bfe..33bbf22 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -24,8 +24,8 @@ angular.module('pollControllers', [])
}])
.controller('PollCtrl',
- ['$scope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll',
- function ( $scope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll) {
+ ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll',
+ function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll) {
$scope.setTab = function (defaultValue) {
if (angular.isDefined($routeParams.tab)) {
return $routeParams.tab;
@@ -785,27 +785,33 @@ angular.module('pollControllers', [])
$scope.data.choices = choices;
}).$promise;
-
- PollVote.query({pollId:$routeParams.pollId, permission:$routeParams.voteToken}, function (votes) {
- $scope.data.votants = votes;
- angular.forEach($scope.data.votants, function (vote) {
- angular.forEach(vote.choice, function (choice) {
- if ($scope.voteCountingIsBoolean()) {
- if (choice.voteValue != null && choice.voteValue != 0.0) {
- choice.voteValue = true;
- }
- else {
- choice.voteValue = false;
+ if ($scope.data.poll.voteIsVisible) {
+ PollVote.query({pollId:$routeParams.pollId, permission:$routeParams.voteToken}, function (votes) {
+ $scope.data.votants = votes;
+ angular.forEach($scope.data.votants, function (vote) {
+ angular.forEach(vote.choice, function (choice) {
+ if ($scope.voteCountingIsBoolean()) {
+ if (choice.voteValue != null && choice.voteValue != 0.0) {
+ choice.voteValue = true;
+ }
+ else {
+ choice.voteValue = false;
+ }
}
- }
- choice.inputType = $scope.getInputType();
+ choice.inputType = $scope.getInputType();
+ })
})
- })
- });
+ });
+ } else {
+ $scope.data.votants = [];
+ }
- $q.all([$scope.pollDeferred.promise, pollChoicePromise]).then(function() { initVote(); });
+ $q.all([$scope.pollDeferred.promise, pollChoicePromise]).then(function() {
+ initVote();
+ $scope.pollDeferred.resolve();
+ });
}
- initPoll();
+ $scope.pollDeferred.promise.then(initPoll);
var initAuthor = function () {
if (angular.isDefined($scope.session.user)) {
@@ -848,6 +854,7 @@ angular.module('pollControllers', [])
// edit vote
PollVote.update({pollId:$routeParams.pollId}, sendVote, function (data) {
$rootScope.$broadcast('newSuccess', 'vote.added');
+ $location.url('/vote/'+$routeParams.pollId+'/'+ data.permission);
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
})
@@ -861,6 +868,7 @@ angular.module('pollControllers', [])
$scope.data.votants.push(angular.copy($scope.data.vote));
$rootScope.$broadcast('newSuccess', 'vote.added');
initVote();
+ $location.url('/vote/'+$routeParams.pollId+'/'+ returnRequest.permission);
}, function (error) {
$scope.data.vote.restError = { voterName : error.data["voter.name"]};
});
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-link.html b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
index 7d20101..76402f4 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-link.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
@@ -30,7 +30,7 @@
</a>
<input type="text" select-on-click value="{{globalVariables.linkVote}}" readonly class="form-control input-mini"/>
</li>
- <li ng-if="data.poll.id">
+ <li ng-if="data.poll.resultIsVisible">
<a href="{{globalVariables.linkResult}}">
<span class="glyphicon glyphicon-stats" title="{{ 'poll.link.result' | translate }}"></span>
<span class="text">{{ 'poll.link.result' | translate }}</span>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html
index 04edd32..234c6fd 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@ -22,8 +22,8 @@
<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify || !data.poll.id}">
<ul class="nav nav-tabs">
<li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'">{{ 'poll.tab.vote' | translate }}</a></li>
- <li ng-class="{active: tab == 'comment'}" ng-show="data.poll.id"><a href="{{globalVariables.linkComment}}" ng-click="tab = 'comment'">{{ 'poll.tab.comment' | translate }}</a></li>
- <li ng-class="{active: tab == 'result'}" ng-show="!globalVariables.create"><a href="{{globalVariables.linkResult}}" ng-click="tab = 'result'">{{ 'poll.tab.result' | translate }}</a></li>
+ <li ng-class="{active: tab == 'comment'}" ng-show="data.poll.commentIsVisible"><a href="{{globalVariables.linkComment}}" ng-click="tab = 'comment'">{{ 'poll.tab.comment' | translate }}</a></li>
+ <li ng-class="{active: tab == 'result'}" ng-show="data.poll.resultIsVisible"><a href="{{globalVariables.linkResult}}" ng-click="tab = 'result'">{{ 'poll.tab.result' | translate }}</a></li>
<li ng-class="{active: tab == 'edit'}" ng-show="globalVariables.create"><a href="#/poll/create" ng-click="tab = 'edit'">{{ 'poll.tab.create' | translate }}</a></li>
<li ng-class="{active: tab == 'edit'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkEdit}}" ng-click="tab = 'edit'">{{ 'poll.tab.edit' | translate }}</a></li>
<li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{globalVariables.linkConf || '#/poll/create/conf'}}" ng-click="tab = 'conf'">{{ 'poll.tab.conf' | translate }}</a></li>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
27 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 c04c243ebc2716cb40effce305880e5db163132c
Merge: 8aa4813 8fb6f0e
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jun 27 18:19:46 2014 +0200
Merge branch 'feature/refontPagePollLink' into develop
pollen-ui-angular/.gitignore | 1 +
pollen-ui-angular/bower.json | 3 +-
pollen-ui-angular/pom.xml | 22 ++
pollen-ui-angular/src/main/webapp/css/style.css | 321 ---------------
pollen-ui-angular/src/main/webapp/i18n/en.js | 4 +-
pollen-ui-angular/src/main/webapp/i18n/fr.js | 10 +-
pollen-ui-angular/src/main/webapp/index.html | 33 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 64 ++-
pollen-ui-angular/src/main/webapp/less/style.less | 438 +++++++++++++++++++++
.../src/main/webapp/less/variables.less | 12 +
.../src/main/webapp/partials/poll-comment.html | 4 +-
.../src/main/webapp/partials/poll-link.html | 69 +++-
.../src/main/webapp/partials/poll.html | 7 +-
13 files changed, 598 insertions(+), 390 deletions(-)
diff --cc pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index 9c353ac,ff4ee6a..63c7bfe
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@@ -397,10 -406,10 +406,10 @@@ angular.module('pollControllers', []
$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);
++ $location.url('/poll/edit/'+data.id+'/'+data.permission);
}
else {
-- $location.url('/poll/edit/'+data.id+'?token='+data.permission);
++ $location.url('/poll/edit/'+data.id+'/'+data.permission);
}
}, function (error) {
$scope.globalVariables.restError = true;
diff --cc pollen-ui-angular/src/main/webapp/partials/poll.html
index b974c20,d5005b3..04edd32
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@@ -18,10 -18,10 +18,9 @@@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
- <div>
-<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify}">
++<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify || !data.poll.id}">
<ul class="nav nav-tabs">
-- <li ng-class="{active: tab == 'home'}"><a href="{{globalVariables.linkHome || '#/poll/create/home' }}" ng-click="tab = 'home'"> <span class="glyphicon glyphicon-home"></span> </a></li>
<li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'">{{ 'poll.tab.vote' | translate }}</a></li>
<li ng-class="{active: tab == 'comment'}" ng-show="data.poll.id"><a href="{{globalVariables.linkComment}}" ng-click="tab = 'comment'">{{ 'poll.tab.comment' | translate }}</a></li>
<li ng-class="{active: tab == 'result'}" ng-show="!globalVariables.create"><a href="{{globalVariables.linkResult}}" ng-click="tab = 'result'">{{ 'poll.tab.result' | translate }}</a></li>
@@@ -43,4 -43,6 +42,6 @@@
<div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'"></div>
- </div>
+ </div>
+
-<div ng-include="'./partials/poll-link.html'" id="poll-link" ng-class="{'mini-link': globalVariables.minify}"></div>
++<div ng-include="'./partials/poll-link.html'" id="poll-link" ng-class="{'mini-link': globalVariables.minify}" ng-show="data.poll.id"></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 8fb6f0e1c41d8a984ec9053b8baee894ee1eef50
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jun 27 18:19:39 2014 +0200
save state of poll menu
---
.../src/main/webapp/js/controllers/pollCtrl.js | 24 ++++++++--------------
.../src/main/webapp/partials/poll-link.html | 16 +++++++--------
2 files changed, 16 insertions(+), 24 deletions(-)
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 ca5257e..ff4ee6a 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -37,28 +37,15 @@ angular.module('pollControllers', [])
$scope.tab = $scope.setTab('home');
- $scope.setUrl = function (exclude) {
- var url = window.location.origin+window.location.pathname+'#'+$location.path();
- if ($location.search().length != 0) {
- url += '?';
- angular.forEach($location.search(), function(value, key) {
- if (exclude.indexOf(key) == -1)
- url += key+'='+value+'&';
- })
- }
- else {
- url += '?';
- }
- return url;
- };
-
if (angular.isUndefined($scope.globalVariables)) {
$scope.globalVariables = {};
+ $scope.session = SessionStorage.get();
+ $scope.globalVariables.minify = $scope.session.menuMinify;
+
/**
* Sauvegarde du token si non connecté
*/
- $scope.session = SessionStorage.get();
if (angular.isUndefined($routeParams.pollToken) && angular.isUndefined($scope.session.id)) { // pas de paramètre url et non connecté
if (angular.isDefined($scope.session.pollToken) && $scope.session.pollToken != '') { // existe une permission
$scope.globalVariables.pollToken = $scope.session.pollToken;
@@ -75,6 +62,11 @@ angular.module('pollControllers', [])
}
}
+ $scope.toggleMinify = function () {
+ $scope.globalVariables.minify = ! $scope.globalVariables.minify
+ SessionStorage.save({'menuMinify': $scope.globalVariables.minify});
+ }
+
$translate('dateFormat').then(function (dateFormat) {
$scope.globalVariables.dateFormat = dateFormat;
});
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-link.html b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
index 0551923..7d20101 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-link.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
@@ -19,18 +19,18 @@
#L%
-->
<ul>
- <li class="toMini" ng-click="globalVariables.minify = !globalVariables.minify">
+ <li class="toMini" ng-click="toggleMinify()">
<a class="fakeLink" ng-show="globalVariables.minify"><span class="glyphicon glyphicon-chevron-right"></span></a>
<a class="fakeLink" ng-hide="globalVariables.minify"><span class="glyphicon glyphicon-chevron-left"></span></a>
</li>
- <li>
+ <li ng-if="data.poll.id">
<a href="{{globalVariables.linkVote}}">
<span class="glyphicon glyphicon-link" title="{{ 'poll.link.vote' | translate }}"></span>
<span class="text">{{ 'poll.link.vote' | translate }}</span>
</a>
<input type="text" select-on-click value="{{globalVariables.linkVote}}" readonly class="form-control input-mini"/>
</li>
- <li>
+ <li ng-if="data.poll.id">
<a href="{{globalVariables.linkResult}}">
<span class="glyphicon glyphicon-stats" title="{{ 'poll.link.result' | translate }}"></span>
<span class="text">{{ 'poll.link.result' | translate }}</span>
@@ -40,20 +40,20 @@
<li class="empty"> </li>
</ul>
<ul>
- <li>
+ <li ng-if="data.poll.permission">
<a href="{{globalVariables.linkEdit}}">
<span class="glyphicon glyphicon-pencil" title="{{ 'poll.link.edit' | translate }}"></span>
<span class="text">{{ 'poll.link.edit' | translate }}</span>
</a>
<input type="text" select-on-click value="{{globalVariables.linkEdit}}" readonly class="form-control input-mini"/>
</li>
- <li>
+ <li ng-if="data.poll.permission">
<a class="fakeLink">
<span class="glyphicon glyphicon-transfer" title="{{ 'poll.link.clone' | translate }}"></span>
<span class="text">{{ 'poll.link.clone' | translate }} (disabled)</span>
</a>
</li>
- <li>
+ <li ng-if="data.poll.permission">
<a class="fakeLink">
<span class="glyphicon glyphicon-export" title="{{ 'poll.link.export' | translate }}"></span>
<span class="text">{{ 'poll.link.export' | translate }} (disabled)</span>
@@ -61,13 +61,13 @@
</li>
</ul>
<ul>
- <li>
+ <li ng-if="data.poll.permission">
<a class="fakeLink danger">
<span class="glyphicon glyphicon-remove" title="{{ 'poll.link.close' | translate }}"></span>
<span class="text">{{ 'poll.link.close' | translate }}</span>
</a>
</li>
- <li>
+ <li ng-if="data.poll.permission">
<a class="fakeLink danger" ng-click="deletePoll()">
<span class="glyphicon glyphicon-trash" title="{{ 'poll.link.delete' | translate }}"></span>
<span class="text">{{ 'poll.link.delete' | translate }}</span>
--
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 a9ce8536898ed3dbd02f25d656e971f59e360de5
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jun 27 17:17:43 2014 +0200
udate UI, migrate css to less
---
pollen-ui-angular/.gitignore | 1 +
pollen-ui-angular/bower.json | 3 +-
pollen-ui-angular/pom.xml | 22 ++
pollen-ui-angular/src/main/webapp/css/style.css | 420 --------------------
pollen-ui-angular/src/main/webapp/i18n/fr.js | 6 +
pollen-ui-angular/src/main/webapp/index.html | 31 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 1 -
pollen-ui-angular/src/main/webapp/less/style.less | 438 +++++++++++++++++++++
.../src/main/webapp/less/variables.less | 12 +
.../src/main/webapp/partials/poll-link.html | 49 ++-
.../src/main/webapp/partials/poll.html | 6 +-
11 files changed, 545 insertions(+), 444 deletions(-)
diff --git a/pollen-ui-angular/.gitignore b/pollen-ui-angular/.gitignore
index 951db95..5575e6a 100644
--- a/pollen-ui-angular/.gitignore
+++ b/pollen-ui-angular/.gitignore
@@ -1,3 +1,4 @@
*.iml
src/main/webapp/lib
+src/main/webapp/css/style.css
diff --git a/pollen-ui-angular/bower.json b/pollen-ui-angular/bower.json
index 8e8c94f..c2d33f7 100644
--- a/pollen-ui-angular/bower.json
+++ b/pollen-ui-angular/bower.json
@@ -18,6 +18,7 @@
"bootstrap": "3.1.1",
"jquery": "2.1.1",
"jqplot": "*",
- "ckeditor": "4.4.2"
+ "ckeditor": "4.4.2",
+ "less": "1.7.3"
}
}
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index e46b933..3239320 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -43,6 +43,28 @@
<workingDirectory>${basedir}</workingDirectory>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.lesscss</groupId>
+ <artifactId>lesscss-maven-plugin</artifactId>
+ <version>1.3.3</version>
+ <configuration>
+ <lessJs>${project.basedir}/src/main/webapp/lib/less/dist/less-1.7.3.min.js</lessJs>
+ <sourceDirectory>${project.basedir}/src/main/webapp/less</sourceDirectory>
+ <outputDirectory>${project.basedir}/src/main/webapp/css</outputDirectory>
+ <compress>true</compress>
+ <includes>
+ <include>style.less</include>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/pollen-ui-angular/src/main/webapp/css/style.css b/pollen-ui-angular/src/main/webapp/css/style.css
deleted file mode 100644
index ea6da2c..0000000
--- a/pollen-ui-angular/src/main/webapp/css/style.css
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (JS)
- * $Id: style.css 3943 2014-05-15 10:23:42Z garandel $
- * $HeadURL: https://svn.chorem.org/pollen/trunk/pollen-ui-angular/src/main/webapp/css/s… $
- * %%
- * Copyright (C) 2009 - 2013 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%
- */
-#pollenMenu {
- position:fixed;
- width:100%;
- height:50px;
- top:0px;
- left:0px;
-}
-#content {
- margin-top:60px;
-}
-
-@media screen and (max-width:770px) {
- #content, #pollenMenu, #pollenMenu .container-fluid, #poll-link {
- width:770px !important;
- }
-}
-
-.navbar .dropdown-menu.form {
- width:250px;
-}
-
-.navbar .dropdown-menu {
- padding: 0;
- padding-top: 15px;
- padding-bottom: 5px;
- left:auto;
- right:0px;
-}
-
-.dropdown-menu.form > form {
- margin: 0;
-}
-
-.dropdown-menu.form .form-actions {
- padding: 15px 20px 20px;
- margin-bottom: 0;
- border-radius: 0 0 6px 6px;
-}
-
-.dropdown-menu.form .control-group {
- padding: 0 15px;
- margin-bottom: 5px;
-}
-
-.noListStyle {
- list-style-type: none;
-}
-
-.noListStyle i {
- margin-right: 5px;
-}
-
-.link {
- cursor: pointer;
-}
-
-.icon-link {
- background-image: url(../img/glyphicons_050_link.png);
- background-position: center;
- background-repeat: no-repeat;
- background-size: 12px 14px;
-}
-
-i.bigger {
- width: 24px;
- height: 24px;
- background-size: 21px 23px;
-}
-
-i.icon-collapse {
- background-position: -288px -120px;
-}
-
-.collapsed i.icon-collapse {
- background-position: -313px -119px;
-}
-
-.list.alternate-colors > div {
- padding: 10px 20px;
-}
-
-.list.alternate-colors > .even {
- background-color: rgb(245, 245, 245);
-}
-
-.list.alternate-colors .footer {
- color: rgb(150, 150, 150);
-}
-
-
-@media screen and (min-width: 1025px) {
- #poll-link {
- position:fixed;
- top:0px;
- left:0px;
- width:300px;
- height:100%;
- padding-top:60px;
- padding-left:5px;
- padding-right:5px;
- border-right:2px solid #EEE;
- background-color:#DDD;
- overflow:hidden;
- z-index:50;
- }
-
- #poll-link ul {
- list-style-type:none;
- margin-left:0px;
- padding-left:0px;
- }
-
- #poll-link ul li {
- margin-bottom:15px;
- }
-
- #poll-content {
- margin-right:0px;
- margin-left:300px;
- }
-}
-
-@media screen and (max-width: 1024px) {
- #poll-link {
- text-align:center;
- position:fixed;
- bottom:0px;
- left:0px;
- width:100%;
- height:80px;
- border-top:2px solid #EEE;
- background-color:#DDD;
- overflow:hidden;
- z-index:50;
- }
-
- #poll-link ul {
- display:inline-block;
- margin-left:3.247%;
- margin-right:3.247%;
- }
-
- #poll-link input {
- display:none;
- }
-
- #poll-content {
- margin-bottom:80px;
- }
-
- @media screen and (max-height:600px) {
- #poll-link {
- position:relative;
- background-color:inherit;
- border-color: #DDD;
- }
- #poll-content {
- margin-bottom:0px;
- }
- }
-
-}
-
-
-.pollTitle, .pollDesc {
- margin-top:15px;
- min-height:60px;
- border-radius:5px;
- padding-left:5px;
- margin-bottom:30px;
-}
-
-.pollTitle input[type="text"] {
- width:99%;
-}
-
-.pollAnim, #comments tr {
- background-color:inherit;
- transition-duration:0.8s;
-}
-.pollAnim:hover, #comments tr:hover {
- background:#DDDDDD;
- transition-duration: 0.8s;
-}
-.pollTitle input {
- width:99%;
- margin:auto;
- height:40px;
- font-size:20px;
-}
-
-#poll {
- text-align:center;
-}
-#poll table {
- margin:auto;
- margin-bottom:8px;
-}
-
-#poll tr td > .btn-large {
- height:60px;
- width:80px;
-}
-
-
-.pollChoice {
- min-width:150px;
- padding-left:5px;
- padding-right:5px;
- padding-top:10px;
- padding-bottom:5px;
- text-align:center;
- border:1px solid #DDD;
- }
-
-.pollChoice input[type=text]{
- height:25px;
- width:140px;
- }
-
-.pollChoice input[type=checkbox]{
- width:25px;
- height:25px;
- }
-
-.pollChoice.voteTrue {
- background-color:rgba(0,255,0,0.5);
-}
-
-.pollChoice.voteFalse {
- background-color:rgba(255,0,0,0.5);
-}
-
-.right-inner-addon .glyphicon-input {
- position: absolute;
- right: 30px;
- top:10px;
- pointer-events: none;
-}
-
-.fixe-input .ng-hide {
- display:inline-block !important;
- visibility:hidden;
-}
-
-.pollBigChoice {
- border-bottom:1px solid #DDDDDD;
- text-align:right;
-}
-.pollBigChoice h3 {
- background-color:rgba(0,0,0,0.1);
- padding:5px;
- height:40px;
-}
-.pollBigChoice button {
- height:30px;
-}
-.pollBigChoice p {
- text-align:justify;
- white-space:pre-line;
-}
-.pollBigChoice textarea {
- width:99%;
-}
-.pollBigChoice h3 input[type=text] {
- width:99%;
- text-align:right;
-}
-.pollBigChoice .pollChoiceInput {
- margin-top:20px;
- text-align:center;
-}
-
-.pollBigVote {
- float:right;
- margin-top:5px;
-}
-
-.alert-float {
- position: fixed;
- left:20%;
- width:60%;
- z-index: 100000;
- opacity: 0.9;
-}
-
-.danger {
- color: #a94442;
-}
-
-.fakeLink {
- cursor:pointer;
-}
-
-.input-mini {
- font-size: 8pt;
- height:16px;
- margin:0px;
- padding:0px;
-}
-
-#comments {
- margin-top:30px;
- width:100%;
- border-collapse:collapse;
-}
-
-#comments tr td {
- border-bottom:1px solid #DDD;
- padding-top:5px;
- padding-bottom:15px;
- padding-left:5px;
- padding-right:5px;
- vertical-align:top;
-}
-
-#comments tr>td:first-child {
- width:200px;
- border-right:1px solid #DDD;
-}
-
-.container .control-group .form-control, .container .control-group .control-label {
- margin-bottom:15px;
- vertical-align:center;
-}
-
-.voterList {
- width:100%;
- margin-top:25px;
- margin-bottom:15px;
- border:3px solid #DDD;
-}
-
-.voterList tr th, .voterList tr td {
- padding-top:8px;
- padding-bottom:8px;
- padding-left:5px;
- padding-right:5px;
- border:1px solid #DDD;
-}
-
-.voterList tr th.weight, .voterList tr td.weight {
- width:92px;
-}
-
-.voterList tr th.weight input, .voterList tr td.weight input {
- width:80px;
-}
-
-.voterList tr td.action {
- width:53px;
-}
-
-hr {
- border-top:1px solid #CCCCCC;
-}
-
-.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/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index ac2b420..256a92b 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -46,6 +46,12 @@ var translateFR = {
'poll.link.edit' : 'Lien d\'édition',
'poll.link.vote' : 'Lien de partage pour le vote',
+'poll.link.result' : 'Lien du résultat du sondage',
+'poll.link.clone' : 'Cloner le sondage',
+'poll.link.export' : 'Exporter le sondage',
+'poll.link.close' : 'Fermer les votes du sondage',
+'poll.link.delete' : 'Supprimer le sondage',
+'poll.link.hide' : 'Minifier le cadre',
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index a07a804..23582be 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -26,7 +26,14 @@
<link rel="stylesheet" type="text/css" href="lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="lib/jqplot/jquery.jqplot.min.css" />
- <link rel="stylesheet" type="text/css" href="css/style.css"/>
+ <!-- TODO : compile less to css
+ $ lessc -x less/style.less css/style.css
+ ou
+ $ mvn compile
+ -->
+ <link rel="stylesheet/less" type="text/css" href="less/style.less" />
+ <script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>
+ <!--<link rel="stylesheet" type="text/css" href="css/style.css"/>-->
<script language="javascript" type="text/javascript" src="js/conf.js"></script>
@@ -47,17 +54,17 @@
<script language="javascript" type="text/javascript" src="lib/angular-animate/angular-animate.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
- <script language=javascript" type="text/javascript" src="js/app.js"></script>
- <script language=javascript" type="text/javascript" src="js/directives.js"></script>
- <script language=javascript" type="text/javascript" src="js/services.js"></script>
- <script language=javascript" type="text/javascript" src="js/controllers/pollCtrl.js"></script>
- <script language=javascript" type="text/javascript" src="js/controllers/userCtrl.js"></script>
- <script language=javascript" type="text/javascript" src="js/controllers/favoriteListCtrl.js"></script>
- <script language=javascript" type="text/javascript" src="js/controllers/localeCtrl.js"></script>
- <script language=javascript" type="text/javascript" src="js/controllers/alertCtrl.js"></script>
-
- <script language=javascript" type="text/javascript" src="i18n/fr.js"></script>
- <script language=javascript" type="text/javascript" src="i18n/en.js"></script>
+ <script language="javascript" type="text/javascript" src="js/app.js"></script>
+ <script language="javascript" type="text/javascript" src="js/directives.js"></script>
+ <script language="javascript" type="text/javascript" src="js/services.js"></script>
+ <script language="javascript" type="text/javascript" src="js/controllers/pollCtrl.js"></script>
+ <script language="javascript" type="text/javascript" src="js/controllers/userCtrl.js"></script>
+ <script language="javascript" type="text/javascript" src="js/controllers/favoriteListCtrl.js"></script>
+ <script language="javascript" type="text/javascript" src="js/controllers/localeCtrl.js"></script>
+ <script language="javascript" type="text/javascript" src="js/controllers/alertCtrl.js"></script>
+
+ <script language="javascript" type="text/javascript" src="i18n/fr.js"></script>
+ <script language="javascript" type="text/javascript" src="i18n/en.js"></script>
</head>
<body>
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 917f491..ca5257e 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -103,7 +103,6 @@ angular.module('pollControllers', [])
});
pollDeferred.promise.then(function () {
- console.log($location);
var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
$scope.globalVariables.linkHome = baseUrl;
$scope.globalVariables.linkVote = baseUrl;
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
new file mode 100644
index 0000000..b6c8c79
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -0,0 +1,438 @@
+@import "variables.less";
+
+#pollenMenu {
+ position:fixed;
+ width:100%;
+ height:50px;
+ top:0px;
+ left:0px;
+}
+#content {
+ margin-top:60px;
+}
+
+@media screen and (max-width:770px) {
+ #content, #pollenMenu, #pollenMenu .container-fluid, #poll-link {
+ width:770px !important;
+ }
+}
+
+.navbar .dropdown-menu {
+ padding: 0;
+ padding-top: 15px;
+ padding-bottom: 5px;
+ left:auto;
+ right:0px;
+
+ &.form {
+ width:250px;
+
+ > form {
+ margin: 0;
+ }
+ }
+
+ .form-actions {
+ padding: 15px 20px 20px;
+ margin-bottom: 0;
+ border-radius: 0 0 6px 6px;
+ }
+
+ .control-group {
+ padding: 0 15px;
+ margin-bottom: 5px;
+ }
+}
+
+@media screen and (min-width: (@responsive-large-width + 1px)) {
+ @width-max : 300px;
+ @width-min : 35px;
+
+ #poll-link {
+ position:fixed;
+ top:0px;
+ left:0px;
+ width: @width-max;
+ height:100%;
+ padding-top:60px;
+ padding-left:5px;
+ padding-right:5px;
+ border-right:2px solid @borderColor;
+ background-color: @gray-lighter;
+ overflow:hidden;
+ z-index:50;
+
+ &.mini-link-remove {
+ -webkit-transition:width linear @short-time-transition;
+ transition:width linear @short-time-transition;
+
+ ul li .text, ul li input {
+ display: none;
+ opacity:0;
+ }
+ }
+
+ &.mini-link {
+ -webkit-transition:width linear @short-time-transition;
+ transition:width linear @short-time-transition;
+
+ width: @width-min;
+
+ ul li {
+ margin-bottom:3px;
+ font-size:1.2em;
+
+ .text, input {
+ display:none;
+ }
+
+ &.toMini {
+ text-align:left;
+ }
+ }
+ }
+
+ ul {
+ list-style-type:none;
+ margin-left:0px;
+ padding-left:0px;
+
+ li {
+ margin-bottom:30px;
+ font-size:1.2em;
+
+ &.empty {
+ display:none;
+ }
+ &.toMini {
+ text-align:right;
+ }
+ }
+ }
+ }
+
+ #poll-content {
+ margin-right:0px;
+ margin-left: @width-max;
+
+ &.maxi-content-remove {
+ -webkit-transition:margin linear @short-time-transition;
+ transition:margin linear @short-time-transition;
+ }
+ &.maxi-content {
+ margin-left: @width-min;
+
+ -webkit-transition:margin linear @short-time-transition;
+ transition:margin linear @short-time-transition;
+ }
+
+ }
+}
+
+@media screen and (max-width: @responsive-large-width) {
+ @foot-padding : 1.8%;
+ @foot-height : 80px;
+ @responsive-height: 600px;
+
+ #poll-link {
+ text-align:center;
+ position:fixed;
+ bottom:0px;
+ left:0px;
+ width:100%;
+ height:@foot-height;
+ border-top:2px solid @borderColor;
+ background-color:@gray-lighter;
+ overflow:hidden;
+ z-index:50;
+
+ ul {
+ list-style-type:none;
+ display:inline-block;
+ margin:0px;
+ padding-left: @foot-padding;
+ padding-right: @foot-padding;
+ text-align:left;
+
+ li.toMini {
+ display:none;
+ }
+ }
+
+ input {
+ display:none;
+ }
+
+ @media (max-height: @responsive-height) {
+ position:relative;
+ background-color:inherit;
+ border-color: @borderColor;
+ }
+ }
+
+ #poll-content {
+ margin-bottom: @foot-height + 15px;
+
+ @media (max-height: @responsive-height) {
+ margin-bottom:0px;
+ }
+ }
+}
+
+
+.pollTitle, .pollDesc {
+ margin-top:15px;
+ min-height:60px;
+ border-radius:5px;
+ padding-left:5px;
+ margin-bottom:30px;
+}
+
+.pollAnim {
+ background-color:inherit;
+ transition-duration:@time-transition;
+
+ &:hover {
+ background:@borderColor;
+ transition-duration: @time-transition;
+ }
+}
+
+#poll {
+ text-align:center;
+
+ table {
+ margin:auto;
+ margin-bottom:8px;
+ }
+}
+
+.btn-large {
+ height:60px;
+ width:80px;
+}
+
+
+.pollChoice {
+ min-width:150px;
+ padding-left:5px;
+ padding-right:5px;
+ padding-top:10px;
+ padding-bottom:5px;
+ text-align:center;
+ border:1px solid @borderColor;
+
+
+ input[type=text]{
+ height:25px;
+ width:140px;
+ }
+ input[type=checkbox]{
+ width:25px;
+ height:25px;
+ }
+
+ .voteTrue {
+ background-color:@brand-success;
+ }
+ .voteFalse {
+ background-color:@brand-danger;
+ }
+}
+
+.right-inner-addon .glyphicon-input {
+ position: absolute;
+ right: 30px;
+ top:10px;
+ pointer-events: none;
+}
+
+.fixe-input .ng-hide {
+ display:inline-block !important;
+ visibility:hidden;
+}
+
+.pollBigChoice {
+ border-bottom:1px solid @borderColor;
+ text-align:right;
+
+ h3 {
+ background-color:rgba(0,0,0,0.1);
+ padding:5px;
+ height:40px;
+
+ input[type=text] {
+ width:99%;
+ text-align:right;
+ }
+ }
+
+ button {
+ height:30px;
+ }
+
+ p {
+ text-align:justify;
+ white-space:pre-line;
+ }
+ textarea {
+ width:99%;
+ }
+
+ .pollChoiceInput {
+ margin-top:20px;
+ text-align:center;
+ }
+}
+
+.pollBigVote {
+ float:right;
+ margin-top:5px;
+}
+
+.alert-float {
+ position: fixed;
+ left:20%;
+ width:60%;
+ z-index: 100000;
+ opacity: 0.9;
+}
+
+.danger {
+ color: @danger-color;
+ transition-duration:@short-time-transition;
+
+ &:hover {
+ color: @danger-hover-color;
+ transition-duration:@short-time-transition;
+ }
+}
+
+a {
+ transition-duration:@short-time-transition;
+
+ &:hover {
+ transition-duration:@short-time-transition;
+ }
+}
+
+.fakeLink {
+ cursor:pointer;
+}
+
+.input-mini {
+ font-size: 8pt;
+ height:16px;
+ margin:0px;
+ padding:0px;
+}
+
+#comments {
+ margin-top:30px;
+ width:100%;
+ border-collapse:collapse;
+
+ tr {
+ background-color:inherit;
+ transition-duration:@time-transition;
+
+ &:hover {
+ background:@borderColor;
+ transition-duration: @time-transition;
+ }
+
+ td {
+ border-bottom:1px solid @borderColor;
+ padding-top:5px;
+ padding-bottom:15px;
+ padding-left:5px;
+ padding-right:5px;
+ vertical-align:top;
+ }
+
+ &>td:first-child {
+ width:200px;
+ border-right:1px solid @borderColor;
+ }
+ }
+}
+
+.container .control-group .form-control, .container .control-group .control-label {
+ margin-bottom:15px;
+ vertical-align:center;
+}
+
+.voterList {
+ @width-input : 92px;
+ @width-action : 53px;
+
+ width:100%;
+ margin-top:25px;
+ margin-bottom:15px;
+ border:3px solid @borderColor;
+
+ tr th, tr td {
+ padding-top:8px;
+ padding-bottom:8px;
+ padding-left:5px;
+ padding-right:5px;
+ border:1px solid @borderColor;
+
+ &.weight {
+ width: @width-input;
+ }
+
+ &.action {
+ width:@width-action;
+ }
+ }
+}
+
+hr {
+ border-top:1px solid #CCCCCC;
+}
+
+.table-result {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top:5px;
+ margin-bottom:15px;
+
+ tr {
+ td, th {
+ padding:8px;
+ border: 1px solid @borderColor;
+ }
+ transition-duration: @time-transition;
+
+ &:hover {
+ background: @borderColor;
+ transition-duration: @time-transition;
+ }
+ }
+}
+
+.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) @short-time-transition;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) @short-time-transition;
+}
+
+.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/less/variables.less b/pollen-ui-angular/src/main/webapp/less/variables.less
new file mode 100644
index 0000000..31cd251
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/less/variables.less
@@ -0,0 +1,12 @@
+@import "../lib/bootstrap/less/variables.less";
+
+@time-transition : 0.8s;
+@short-time-transition : 0.2s;
+@long-time-transition : 1.6s;
+
+@borderColor : #dddddd;
+
+@danger-color : @brand-danger;
+@danger-hover-color : darken(@danger-color, 15%);
+
+@responsive-large-width : 1024px;
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-link.html b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
index f959584..0551923 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-link.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
@@ -19,25 +19,60 @@
#L%
-->
<ul>
+ <li class="toMini" ng-click="globalVariables.minify = !globalVariables.minify">
+ <a class="fakeLink" ng-show="globalVariables.minify"><span class="glyphicon glyphicon-chevron-right"></span></a>
+ <a class="fakeLink" ng-hide="globalVariables.minify"><span class="glyphicon glyphicon-chevron-left"></span></a>
+ </li>
<li>
- <a href="{{globalVariables.linkVote}}">{{ 'poll.link.vote' | translate }}</a>
+ <a href="{{globalVariables.linkVote}}">
+ <span class="glyphicon glyphicon-link" title="{{ 'poll.link.vote' | translate }}"></span>
+ <span class="text">{{ 'poll.link.vote' | translate }}</span>
+ </a>
<input type="text" select-on-click value="{{globalVariables.linkVote}}" readonly class="form-control input-mini"/>
</li>
<li>
- <a href="{{globalVariables.linkResult}}">{{ 'poll.link.result' | translate }}</a>
+ <a href="{{globalVariables.linkResult}}">
+ <span class="glyphicon glyphicon-stats" title="{{ 'poll.link.result' | translate }}"></span>
+ <span class="text">{{ 'poll.link.result' | translate }}</span>
+ </a>
<input type="text" select-on-click value="{{globalVariables.linkResult}}" readonly class="form-control input-mini"/>
</li>
+ <li class="empty"> </li>
</ul>
<ul>
<li>
- <a href="{{globalVariables.linkEdit}}">{{ 'poll.link.edit' | translate }}</a>
+ <a href="{{globalVariables.linkEdit}}">
+ <span class="glyphicon glyphicon-pencil" title="{{ 'poll.link.edit' | translate }}"></span>
+ <span class="text">{{ 'poll.link.edit' | translate }}</span>
+ </a>
<input type="text" select-on-click value="{{globalVariables.linkEdit}}" readonly class="form-control input-mini"/>
</li>
- <li><a class="fakeLink">{{ 'poll.link.clone' | translate }} (disabled)</a></li>
- <li><a class="fakeLink">{{ 'poll.link.export' | translate }} (disabled)</a></li>
+ <li>
+ <a class="fakeLink">
+ <span class="glyphicon glyphicon-transfer" title="{{ 'poll.link.clone' | translate }}"></span>
+ <span class="text">{{ 'poll.link.clone' | translate }} (disabled)</span>
+ </a>
+ </li>
+ <li>
+ <a class="fakeLink">
+ <span class="glyphicon glyphicon-export" title="{{ 'poll.link.export' | translate }}"></span>
+ <span class="text">{{ 'poll.link.export' | translate }} (disabled)</span>
+ </a>
+ </li>
</ul>
<ul>
- <li><a class="fakeLink danger">{{ 'poll.link.close' | translate }}</a></li>
- <li><a class="fakeLink danger" ng-click="deletePoll()">{{ 'poll.link.delete' | translate }}</a></li>
+ <li>
+ <a class="fakeLink danger">
+ <span class="glyphicon glyphicon-remove" title="{{ 'poll.link.close' | translate }}"></span>
+ <span class="text">{{ 'poll.link.close' | translate }}</span>
+ </a>
+ </li>
+ <li>
+ <a class="fakeLink danger" ng-click="deletePoll()">
+ <span class="glyphicon glyphicon-trash" title="{{ 'poll.link.delete' | translate }}"></span>
+ <span class="text">{{ 'poll.link.delete' | translate }}</span>
+ </a>
+ </li>
+ <li class="empty"> </li>
</ul>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html
index 5956368..d5005b3 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@ -19,7 +19,7 @@
#L%
-->
-<div id="poll-content">
+<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify}">
<ul class="nav nav-tabs">
<li ng-class="{active: tab == 'home'}"><a href="{{globalVariables.linkHome || '#/poll/create/home' }}" ng-click="tab = 'home'"> <span class="glyphicon glyphicon-home"></span> </a></li>
<li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'">{{ 'poll.tab.vote' | translate }}</a></li>
@@ -43,6 +43,6 @@
<div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'"></div>
- <div ng-include="'./partials/poll-link.html'" id="poll-link" ></div>
+</div>
-</div>
\ No newline at end of file
+<div ng-include="'./partials/poll-link.html'" id="poll-link" ng-class="{'mini-link': globalVariables.minify}"></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
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 d504e8c607af605d4f42bfa660111807a39762a0
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jun 26 18:04:06 2014 +0200
refont home tab
---
pollen-ui-angular/src/main/webapp/css/style.css | 99 ++++++++++++++++++++++
pollen-ui-angular/src/main/webapp/i18n/en.js | 4 +-
pollen-ui-angular/src/main/webapp/i18n/fr.js | 4 +-
pollen-ui-angular/src/main/webapp/index.html | 4 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 37 ++++----
.../src/main/webapp/partials/poll-comment.html | 4 +-
.../src/main/webapp/partials/poll-link.html | 34 +++++---
.../src/main/webapp/partials/poll.html | 4 +-
8 files changed, 153 insertions(+), 37 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/css/style.css b/pollen-ui-angular/src/main/webapp/css/style.css
index 7047243..ea6da2c 100644
--- a/pollen-ui-angular/src/main/webapp/css/style.css
+++ b/pollen-ui-angular/src/main/webapp/css/style.css
@@ -20,6 +20,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+#pollenMenu {
+ position:fixed;
+ width:100%;
+ height:50px;
+ top:0px;
+ left:0px;
+}
+#content {
+ margin-top:60px;
+}
+
+@media screen and (max-width:770px) {
+ #content, #pollenMenu, #pollenMenu .container-fluid, #poll-link {
+ width:770px !important;
+ }
+}
+
.navbar .dropdown-menu.form {
width:250px;
}
@@ -92,6 +109,81 @@ i.icon-collapse {
color: rgb(150, 150, 150);
}
+
+@media screen and (min-width: 1025px) {
+ #poll-link {
+ position:fixed;
+ top:0px;
+ left:0px;
+ width:300px;
+ height:100%;
+ padding-top:60px;
+ padding-left:5px;
+ padding-right:5px;
+ border-right:2px solid #EEE;
+ background-color:#DDD;
+ overflow:hidden;
+ z-index:50;
+ }
+
+ #poll-link ul {
+ list-style-type:none;
+ margin-left:0px;
+ padding-left:0px;
+ }
+
+ #poll-link ul li {
+ margin-bottom:15px;
+ }
+
+ #poll-content {
+ margin-right:0px;
+ margin-left:300px;
+ }
+}
+
+@media screen and (max-width: 1024px) {
+ #poll-link {
+ text-align:center;
+ position:fixed;
+ bottom:0px;
+ left:0px;
+ width:100%;
+ height:80px;
+ border-top:2px solid #EEE;
+ background-color:#DDD;
+ overflow:hidden;
+ z-index:50;
+ }
+
+ #poll-link ul {
+ display:inline-block;
+ margin-left:3.247%;
+ margin-right:3.247%;
+ }
+
+ #poll-link input {
+ display:none;
+ }
+
+ #poll-content {
+ margin-bottom:80px;
+ }
+
+ @media screen and (max-height:600px) {
+ #poll-link {
+ position:relative;
+ background-color:inherit;
+ border-color: #DDD;
+ }
+ #poll-content {
+ margin-bottom:0px;
+ }
+ }
+
+}
+
+
.pollTitle, .pollDesc {
margin-top:15px;
min-height:60px;
@@ -222,6 +314,13 @@ i.icon-collapse {
cursor:pointer;
}
+.input-mini {
+ font-size: 8pt;
+ height:16px;
+ margin:0px;
+ padding:0px;
+}
+
#comments {
margin-top:30px;
width:100%;
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 650853b..d6f2bd2 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -44,8 +44,8 @@ var translateEN = {
'poll.tab.conf' : 'Configuration',
'poll.tab.participant' : 'Participants',
-'poll.link.edit' : 'Edit Url:',
-'poll.link.vote' : 'Vote Url:',
+'poll.link.edit' : 'Edit Url',
+'poll.link.vote' : 'Vote Url',
'poll.edit' : 'Click to edit',
'poll.desc' : 'Description is optional. This message will not visible in vote page.',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 0222bd1..ac2b420 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -44,8 +44,8 @@ var translateFR = {
'poll.tab.conf' : 'Configuration',
'poll.tab.participant' : 'Participants',
-'poll.link.edit' : 'Lien d\'édition :',
-'poll.link.vote' : 'Lien de partage pour le vote :',
+'poll.link.edit' : 'Lien d\'édition',
+'poll.link.vote' : 'Lien de partage pour le vote',
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 922dc6d..a07a804 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -62,7 +62,7 @@
</head>
<body>
-<nav class="navbar navbar-inverse navbar-static-top">
+<nav id="pollenMenu" class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Pollen</a>
@@ -157,7 +157,7 @@
<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>
+<div ng-view class='container-fluid' id="content"></div>
</body>
</html>
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 9c353ac..917f491 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -103,7 +103,8 @@ angular.module('pollControllers', [])
});
pollDeferred.promise.then(function () {
- var baseUrl = window.location.origin+window.location.pathname;
+ console.log($location);
+ var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
$scope.globalVariables.linkHome = baseUrl;
$scope.globalVariables.linkVote = baseUrl;
$scope.globalVariables.linkComment = baseUrl;
@@ -209,6 +210,23 @@ angular.module('pollControllers', [])
return false;
}
+ $scope.deletePoll = function () {
+ if (angular.isDefined($scope.data.poll.id)) {
+ var confirmMessage;
+ $translate('action.message.confirmDelete').then(function (msg) {
+ confirmMessage = msg;
+ }).then( function () {
+ var confirmDelete = confirm(confirmMessage);
+ if (confirmDelete == true) {
+ $scope.data.poll.$remove({permission:$scope.globalVariables.pollToken}, function() {
+ $rootScope.$broadcast('newSuccess', 'poll.deleted');
+ $location.path('/');
+ });
+ }
+ });
+ }
+ };
+
}])
.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$timeout', '$routeParams', function ($scope, $controller, $modal, $timeout, $routeParams) {
@@ -763,20 +781,6 @@ angular.module('pollControllers', [])
});
}
- $scope.deletePoll = function () {
- var confirmMessage;
- $translate('action.message.confirmDelete').then(function (msg) {
- confirmMessage = msg;
- }).then( function () {
- var confirmDelete = confirm(confirmMessage);
- if (confirmDelete == true) {
- $scope.data.poll.$remove({permission:$scope.globalVariables.pollToken}, function() {
- $rootScope.$broadcast('newSuccess', 'poll.deleted');
- $location.path('/');
- });
- }
- });
- };
}])
.controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate',
@@ -845,7 +849,7 @@ angular.module('pollControllers', [])
var sendVote = angular.copy($scope.data.vote);
if ($scope.voteCountingIsBoolean()) {
angular.forEach(sendVote.choice, function (choice) {
- choice.voteValue = $scope.getChoiceValue(choice.voteValue);
+ choice.voteValue = (choice.voteValue)?1.0:0.0;
});
}
@@ -976,6 +980,7 @@ angular.module('pollControllers', [])
});
$scope.postComment = function () {
+ delete $scope.restError;
var commentPromise
if (angular.isDefined($scope.comment.id)) {
// edit
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 6966b23..a584ca5 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -30,7 +30,7 @@
<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" focus-me="comment.id != null" />
+ <input type="text" ng-model="comment.authorName" class="form-control" focus-me="comment.id != null || restError['author.name'] !== undefined" />
</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 ck-editor ng-model="comment.text" focus-me="comment.id != null"></textarea>
+ <textarea ck-editor ng-model="comment.text" focus-me="comment.id != null || restError.text[0] !== undefined"></textarea>
</div>
</div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-link.html b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
index fc2b4cb..f959584 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-link.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
@@ -18,16 +18,26 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<div>
- <h1>{{data.poll.title}}</h1>
- <h2>Sondage:</h2>
+<ul>
+ <li>
+ <a href="{{globalVariables.linkVote}}">{{ 'poll.link.vote' | translate }}</a>
+ <input type="text" select-on-click value="{{globalVariables.linkVote}}" readonly class="form-control input-mini"/>
+ </li>
+ <li>
+ <a href="{{globalVariables.linkResult}}">{{ 'poll.link.result' | translate }}</a>
+ <input type="text" select-on-click value="{{globalVariables.linkResult}}" readonly class="form-control input-mini"/>
+ </li>
+</ul>
+<ul>
+ <li>
+ <a href="{{globalVariables.linkEdit}}">{{ 'poll.link.edit' | translate }}</a>
+ <input type="text" select-on-click value="{{globalVariables.linkEdit}}" readonly class="form-control input-mini"/>
+ </li>
+ <li><a class="fakeLink">{{ 'poll.link.clone' | translate }} (disabled)</a></li>
+ <li><a class="fakeLink">{{ 'poll.link.export' | translate }} (disabled)</a></li>
+</ul>
+<ul>
+ <li><a class="fakeLink danger">{{ 'poll.link.close' | translate }}</a></li>
+ <li><a class="fakeLink danger" ng-click="deletePoll()">{{ 'poll.link.delete' | translate }}</a></li>
+</ul>
- <alert type="warning" ng-if="globalVariables.linkEdit && data.poll.permission">
- {{ 'poll.link.edit' | translate }}
- <input type="text" select-on-click value="{{globalVariables.linkEdit}}" readonly class="form-control"/>
- </alert>
- <alert type="success" ng-if="globalVariables.linkVote">
- {{ 'poll.link.vote' | translate }}
- <input type="text" select-on-click value="{{globalVariables.linkVote}}" readonly class="form-control"/>
- </alert>
-</div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html
index b974c20..5956368 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<div>
+<div id="poll-content">
<ul class="nav nav-tabs">
<li ng-class="{active: tab == 'home'}"><a href="{{globalVariables.linkHome || '#/poll/create/home' }}" ng-click="tab = 'home'"> <span class="glyphicon glyphicon-home"></span> </a></li>
<li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'">{{ 'poll.tab.vote' | translate }}</a></li>
@@ -43,4 +43,6 @@
<div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'"></div>
+ <div ng-include="'./partials/poll-link.html'" id="poll-link" ></div>
+
</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
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 8aa48134b0b5361fa35014be0e995e0456c10f64
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jun 26 12:36:13 2014 +0200
fix list Poll
---
.../src/main/webapp/js/controllers/pollCtrl.js | 13 ++++++++-----
pollen-ui-angular/src/main/webapp/js/services.js | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
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 1283f6d..9c353ac 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -728,7 +728,7 @@ angular.module('pollControllers', [])
$scope.pollDeferred.promise.then(function () {
if (angular.isDefined($scope.data.poll.permission)) {
initPoll();
- $scope.pollDeferred.resolve('poll load');
+ $scope.pollDeferred.resolve();
} else {
$location.path('/');
}
@@ -736,7 +736,11 @@ angular.module('pollControllers', [])
$location.path('/');
});
- var oldPoll = angular.copy($scope.data.poll);
+ var oldPoll;
+ $scope.pollDeferred.promise.then(function () {
+ oldPoll = angular.copy($scope.data.poll);
+ $scope.pollDeferred.resolve();
+ });
$scope.autoSavePoll = function () {
if (!angular.equals(oldPoll, $scope.data.poll)) {
$scope.savePoll();
@@ -1115,7 +1119,7 @@ angular.module('pollControllers', [])
.controller('PollListCtrl',
['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll',
function ($scope, $rootScope, $controller, $routeParams, $location, Poll) {
- $controller('PollCtrl', {$scope:$scope});
+ $scope.data = {};
if (angular.isDefined(conf.pollDefaultPageSize)) {
$scope.pageSize = conf.pollDefaultPageSize;
@@ -1123,7 +1127,6 @@ angular.module('pollControllers', [])
else {
$scope.pageSize = -1;
}
- $scope.urlPagination = $scope.setUrl(['page', 'pageSize']);
var paginationParameter = {pageSize:$scope.pageSize};
if (angular.isDefined($routeParams.page)) {
@@ -1136,7 +1139,7 @@ angular.module('pollControllers', [])
}
var initPolls = function () {
- Poll.get({paginationParameter:paginationParameter}, function (data) {
+ Poll.get({paginationParameter:paginationParameter, cmd:$routeParams.cmd}, function (data) {
$scope.data.polls = data.elements
$scope.data.pollsPagination = data.pagination;
}, function (error) {
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index e819aa8..68c3edf 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -25,7 +25,7 @@ angular.module('pollenServices', ['ngResource'])
//////////////////////////////////////
.factory('Poll', ['$resource', function ($resource) {
- return $resource(conf.restURL+'/polls/:pollId', {pollId:'@id'}, {
+ return $resource(conf.restURL+'/polls/:pollId/:cmd', {pollId:'@id'}, {
'skeletonNew' : {
method : 'GET',
url : conf.restURL+'/polls/new'
--
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 0f7ad3cc21773e491158bda5320fb5cdce7dd632
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jun 26 12:05:22 2014 +0200
fix security comment
---
.../pollen/services/service/CommentService.java | 2 +-
pollen-ui-angular/src/main/webapp/js/app.js | 9 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 105 +++++++++++----------
.../src/main/webapp/partials/poll-comment.html | 4 +-
4 files changed, 62 insertions(+), 58 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
index 1141b41..fd1a7f2 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
@@ -46,7 +46,7 @@ public class CommentService extends PollenServiceSupport {
private Function<CommentBean, CommentBean> commentFunction = new Function<CommentBean, CommentBean>() {
@Override
public CommentBean apply(CommentBean input) {
- if (isNotPermitted(PermissionVerb.readComment, input.getEntityId())) {
+ if (isNotPermitted(PermissionVerb.editComment, input.getEntityId())) {
input.setPermission(null);
}
return input;
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 00bbfe7..a8bf214 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -57,16 +57,17 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollC
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {templateUrl: './partials/home.html', controller: "HomeCtrl"})
- .when('/poll/home/:pollId', {templateUrl: './partials/poll.html', controller: "PollCtrl"})
+ .when('/poll/home/:pollId/:pollToken?', {templateUrl: './partials/poll.html', controller: "PollCtrl"})
.when('/poll/create/:tab?', {templateUrl: './partials/poll.html', controller: "PollCreateCtrl"})
- .when('/poll/edit/:pollId/:token?/:tab?', {templateUrl: './partials/poll.html', controller:"PollEditCtrl"})
- .when('/poll/vote/:pollId/:token?', {templateUrl: './partials/poll.html', controller :"PollVoteCtrl"})
+ .when('/poll/edit/:pollId/:pollToken?/:tab?', {templateUrl: './partials/poll.html', controller:"PollEditCtrl"})
+ .when('/poll/vote/:pollId/:voteToken?', {templateUrl: './partials/poll.html', controller :"PollVoteCtrl"})
.when('/poll/result/:pollId/:token?', {templateUrl: './partials/poll.html', controller :"PollResultCtrl"})
- .when('/poll/comment/:pollId/:token?', {templateUrl: './partials/poll.html', controller :"PollCommentCtrl"})
+ .when('/poll/comment/:pollId/:commentToken?', {templateUrl: './partials/poll.html', controller :"PollCommentCtrl"})
.when('/poll/list/:cmd?', {templateUrl: './partials/poll-list.html', controller :"PollListCtrl"})
.when('/user/register', {templateUrl: './partials/user-register.html', controller:"UserRegisterCtrl"})
.when('/user/edit', {templateUrl: './partials/user-edit.html', controller:"UserEditCtrl"})
.when('/user/lostpassword', {templateUrl: './partials/user-lostPassword.html', controller:"UserLostPasswordCtrl"})
+ .when('/user/:userId/:token', {templateUrl: './partials/user-lostPassword.html', controller:"UserLostPasswordCtrl"})
.when('/favoriteList', {templateUrl: './partials/favoriteList-list.html', controller:"FavoriteListCtrl"})
.when('/favoriteList/new', {templateUrl: './partials/favoriteList-edit.html', controller:"FavoriteListEditCtrl"})
.when('/favoriteList/:favoriteListId', {templateUrl: './partials/favoriteList-edit.html', controller:"FavoriteListEditCtrl"})
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 a3e0eda..1283f6d 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -59,22 +59,19 @@ angular.module('pollControllers', [])
* Sauvegarde du token si non connecté
*/
$scope.session = SessionStorage.get();
- if (angular.isUndefined($routeParams.token) && angular.isUndefined($scope.session.id)) { // pas de paramètre url et non connecté
- if (angular.isDefined($scope.session.permission) && $scope.session.permission != '') { // existe une permission
- $scope.globalVariables.permission = $scope.session.permission;
- }
- else if ($scope.session.permission == '') {
- SessionStorage.remove('permission');
+ if (angular.isUndefined($routeParams.pollToken) && angular.isUndefined($scope.session.id)) { // pas de paramètre url et non connecté
+ if (angular.isDefined($scope.session.pollToken) && $scope.session.pollToken != '') { // existe une permission
+ $scope.globalVariables.pollToken = $scope.session.pollToken;
}
}
else if (angular.isDefined($scope.session.id)) { // connecté
- if (angular.isDefined($scope.session.permission)) { // connecté => pas besoin de permission
- SessionStorage.remove('permission');
+ if (angular.isDefined($scope.session.pollToken)) { // connecté => pas besoin de permission
+ SessionStorage.remove('pollToken');
}
}
else { //token dans l'URL
- SessionStorage.save({permission:$routeParams.token});
- $scope.globalVariables.permission = $routeParams.token;
+ SessionStorage.save({pollToken:$routeParams.pollToken});
+ $scope.globalVariables.pollToken = $routeParams.pollToken;
}
}
@@ -88,16 +85,16 @@ angular.module('pollControllers', [])
if (angular.isDefined($routeParams.pollId)) {
var pollDeferred = $q.defer();
$scope.pollDeferred = pollDeferred;
- Poll.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, function (poll) {
+ Poll.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, function (poll) {
$scope.data.poll = poll;
- $scope.globalVariables.permission = poll.permission;
+ $scope.globalVariables.pollToken = poll.permission;
pollDeferred.resolve('read-write poll');
}, function (error) {
Poll.get({pollId:$routeParams.pollId}, function (poll) {
$scope.data.poll = poll;
// clean permission
- SessionStorage.remove('permission');
- delete $scope.globalVariables.permission;
+ SessionStorage.remove('pollToken');
+ delete $scope.globalVariables.pollToken;
pollDeferred.resolve('read-only poll')
}, function (error) {
@@ -118,9 +115,9 @@ angular.module('pollControllers', [])
$scope.globalVariables.linkEdit += '#/poll/edit/'+$routeParams.pollId;
$scope.globalVariables.linkResult += '#/poll/result/'+$routeParams.pollId;
- if (angular.isDefined($scope.globalVariables.permission)) {
- $scope.globalVariables.linkEdit += '/'+$scope.globalVariables.permission;
- $scope.globalVariables.linkResult += '/'+$scope.globalVariables.permission;
+ if (angular.isDefined($scope.globalVariables.pollToken)) {
+ $scope.globalVariables.linkHome += '/'+$scope.globalVariables.pollToken;
+ $scope.globalVariables.linkEdit += '/'+$scope.globalVariables.pollToken;
$scope.globalVariables.linkConf = $scope.globalVariables.linkEdit+'/conf';
$scope.globalVariables.linkParticipant = $scope.globalVariables.linkEdit+'/participant';
}
@@ -191,8 +188,9 @@ angular.module('pollControllers', [])
}
}
+ $timeout(function () {
$scope.$watch('data.poll.voteCountingType', function (newVal, oldVal) {
- if ((newVal == 1 || oldVal == 1) && newVal != oldVal) {
+ if (angular.isDefined(oldVal) && (newVal == 1 || oldVal == 1) && newVal != oldVal) {
console.log('vote Change');
angular.forEach($scope.data.votants, function(votant, key) {
angular.forEach(votant.choice, function (choice) {
@@ -202,6 +200,7 @@ angular.module('pollControllers', [])
});
}
})
+ });
$scope.voteCountingIsBoolean = function () {
if (angular.isDefined($scope.data.poll) && angular.isDefined($scope.data.poll.voteCountingType)) {
@@ -435,7 +434,7 @@ angular.module('pollControllers', [])
////////////////////////////////
$scope.callBackAddChoice = function (choice) {
- PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function (data) {
+ PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, choice, function (data) {
delete choice.restError;
choice.id = data.id;
$rootScope.$broadcast('newSuccess', 'poll.saved');
@@ -445,7 +444,7 @@ angular.module('pollControllers', [])
}
$scope.callBackEditChoice = function (choice) {
- PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, choice, function() {
+ PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, choice, function() {
delete choice.restError;
$rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
@@ -454,7 +453,7 @@ angular.module('pollControllers', [])
}
$scope.deleteChoice = function (choice) {
- PollChoice.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, choiceId: choice.id}, function () {
+ PollChoice.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, choiceId: choice.id}, function () {
$rootScope.$broadcast('newSuccess', 'poll.saved');
var index = $scope.data.choices.indexOf(choice);
if (index > -1) {
@@ -493,11 +492,11 @@ angular.module('pollControllers', [])
});
SessionStorage.remove('voterList');
} else {
- PollVoterList.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, function (voterList) {
+ PollVoterList.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, function (voterList) {
if (voterList.length > 0) {
$scope.data.voterList = [];
angular.forEach(voterList, function (list) {
- PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: list.id}, function (voterListMember) {
+ PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId: list.id}, function (voterListMember) {
var newVoterList = {group:list, members:voterListMember};
$scope.data.voterList.push(newVoterList);
})
@@ -539,10 +538,10 @@ angular.module('pollControllers', [])
pollVoterListPromise.then(function (data) {
$scope.data.favoriteListImport = null;
- PollVoterList.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: data.id},
+ PollVoterList.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId: data.id},
function (vl) {
voterList.group = vl;
- PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: vl.id},
+ PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId: vl.id},
function(members) {
voterList.members = members;
}
@@ -554,7 +553,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) {
+ PollVoterList.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:voterList.group.id}, voterList.group, function (data) {
$rootScope.$broadcast('newSuccess', 'poll.saved');
delete voterList.group.restError;
}, function (error) {
@@ -573,13 +572,13 @@ angular.module('pollControllers', [])
}
});
if (vl.members.length > 0) {
- PollVoterList.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, vl, function (data) {
+ PollVoterList.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, vl, function (data) {
$rootScope.$broadcast('newSuccess', 'poll.saved');
voterList.group.id = data.id;
delete voterList.group.restError;
// Get member Id
- PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId: data.id},
+ PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId: data.id},
function (voterListMember) {
angular.forEach(voterListMember, function(member, key) {
for (var i = 0; i < voterList.members.length; i++) {
@@ -626,9 +625,9 @@ angular.module('pollControllers', [])
var vlMemberPromise;
if (angular.isDefined(vlId)) {
if (angular.isDefined(member.id)) {
- vlMemberPromise = PollVoterListMember.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:vlId}, member).$promise;
+ vlMemberPromise = PollVoterListMember.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:vlId}, member).$promise;
} else {
- vlMemberPromise = PollVoterListMember.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:vlId}, member).$promise;
+ vlMemberPromise = PollVoterListMember.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:vlId}, member).$promise;
}
vlMemberPromise.then(function (data) {
@@ -656,7 +655,7 @@ angular.module('pollControllers', [])
}).then( function () {
var confirmDelete = confirm(confirmMessage);
if (confirmDelete == true) {
- PollVoterList.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:voterList.group.id}, function (data) {
+ PollVoterList.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, 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') {
@@ -683,7 +682,7 @@ angular.module('pollControllers', [])
}).then( function () {
var confirmDelete = confirm(confirmMessage);
if (confirmDelete == true) {
- member.$remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, voterListId:voterList.group.id}, function (data) {
+ member.$remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:voterList.group.id}, function (data) {
var index = voterList.members.indexOf(member);
voterList.members.splice(index, 1);
});
@@ -703,7 +702,7 @@ angular.module('pollControllers', [])
var initPoll = function () {
initVoterList();
- PollChoice.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}).$promise.then(function (choices) {
+ PollChoice.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}).$promise.then(function (choices) {
$scope.data.choices = choices;
$scope.data.vote = {};
$scope.data.vote.choice = $scope.data.choices;
@@ -729,7 +728,7 @@ angular.module('pollControllers', [])
$scope.pollDeferred.promise.then(function () {
if (angular.isDefined($scope.data.poll.permission)) {
initPoll();
- delete $scope.pollDeferred;
+ $scope.pollDeferred.resolve('poll load');
} else {
$location.path('/');
}
@@ -753,7 +752,7 @@ angular.module('pollControllers', [])
$scope.data.poll.endDate = $scope.data.poll.endDate.getTime();
}
- $scope.data.poll.$update({permission:$scope.globalVariables.permission}, function (data) {
+ $scope.data.poll.$update({permission:$scope.globalVariables.pollToken}, function (data) {
$rootScope.$broadcast('newSuccess', 'poll.saved');
}, function (error) {
angular.extend($scope.restError, error.data);
@@ -767,7 +766,7 @@ angular.module('pollControllers', [])
}).then( function () {
var confirmDelete = confirm(confirmMessage);
if (confirmDelete == true) {
- $scope.data.poll.$remove({permission:$scope.globalVariables.permission}, function() {
+ $scope.data.poll.$remove({permission:$scope.globalVariables.pollToken}, function() {
$rootScope.$broadcast('newSuccess', 'poll.deleted');
$location.path('/');
});
@@ -783,13 +782,12 @@ angular.module('pollControllers', [])
$scope.tab = $scope.setTab('vote');
var initPoll = function () {
- PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
+ var pollChoicePromise = PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
$scope.data.choices = choices;
- initVote();
- });
+ }).$promise;
- PollVote.query({pollId:$routeParams.pollId}, function (votes) {
+ PollVote.query({pollId:$routeParams.pollId, permission:$routeParams.voteToken}, function (votes) {
$scope.data.votants = votes;
angular.forEach($scope.data.votants, function (vote) {
angular.forEach(vote.choice, function (choice) {
@@ -805,6 +803,8 @@ angular.module('pollControllers', [])
})
})
});
+
+ $q.all([$scope.pollDeferred.promise, pollChoicePromise]).then(function() { initVote(); });
}
initPoll();
@@ -841,7 +841,7 @@ angular.module('pollControllers', [])
var sendVote = angular.copy($scope.data.vote);
if ($scope.voteCountingIsBoolean()) {
angular.forEach(sendVote.choice, function (choice) {
- choice.voteValue = (choice.voteValue) ? 1.0 : 0.0;
+ choice.voteValue = $scope.getChoiceValue(choice.voteValue);
});
}
@@ -903,10 +903,14 @@ angular.module('pollControllers', [])
}])
.controller('PollCommentCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate',
- function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$location',
+ function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $location) {
$controller('PollCtrl', {$scope:$scope});
+ if (angular.isDefined($routeParams.commentToken)) {
+ $scope.commentToken = $routeParams.commentToken;
+ }
+
$scope.tab = $scope.setTab('comment');
$scope.globalVariables.commentMode = true;
@@ -950,7 +954,7 @@ angular.module('pollControllers', [])
}
var initComments = function () {
- var commentPromise = PollComment.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, paginationParameter:paginationParameter}, function (data) {
+ var commentPromise = PollComment.get({pollId:$routeParams.pollId, permission:$scope.commentToken, paginationParameter:paginationParameter}, function (data) {
$scope.data.comments = data.elements;
$scope.data.commentsPagination = data.pagination;
}).$promise;
@@ -971,18 +975,17 @@ angular.module('pollControllers', [])
var commentPromise
if (angular.isDefined($scope.comment.id)) {
// edit
- commentPromise = PollComment.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, $scope.comment, function (data) {
+ commentPromise = PollComment.update({pollId:$routeParams.pollId}, $scope.comment, function (data) {
paginationParameter.pageNumber = $scope.comment.page;
initComments();
initAuthor();
}).$promise;
} else {
//Add
- commentPromise = PollComment.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, $scope.comment, function (data) {
- // add ID and Permission and push in list of comments
- $scope.comment.id = data.id;
- $scope.comment.permission = data.permission;
- $scope.comment.postDate = new Date();
+ commentPromise = PollComment.add({pollId:$routeParams.pollId}, $scope.comment, function (data) {
+ // save Permission
+ $scope.commentToken = data.permission;
+ $location.url('/poll/comment/'+$routeParams.pollId+'/'+data.permission);
// reload comments
if ($scope.data.commentsPagination.desc) {
@@ -1034,7 +1037,7 @@ angular.module('pollControllers', [])
delete $scope.comment.permission;
}
- PollComment.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission, commentId:comment.id}, function (data) {
+ PollComment.remove({pollId:$routeParams.pollId, commentId:comment.id}, function (data) {
// reload comments
initComments().then(function () {
// if no comment then change page if it's possible
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 ab8f2a1..6966b23 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -63,8 +63,8 @@
<td>
<span class="glyphicon glyphicon-user"></span>{{comment.authorName}}<br/>
<span class="glyphicon glyphicon-calendar"></span>{{comment.postDate | date:globalVariables.dateFormat}}<br/>
- <a class="fakeLink" ng-click="editPost(comment)"><span class="glyphicon glyphicon-pencil" ng-show="comment.id"></span></a>
- <a class="fakeLink" ng-click="deletePost(comment)"><span class="glyphicon glyphicon-trash danger" ng-show="comment.id"></span></a>
+ <a class="fakeLink" ng-click="editPost(comment)" ng-if="comment.permission"><span class="glyphicon glyphicon-pencil" ng-show="comment.id"></span></a>
+ <a class="fakeLink" ng-click="deletePost(comment)" ng-if="comment.permission"><span class="glyphicon glyphicon-trash danger" ng-show="comment.id"></span></a>
</td>
<td>
<div ng-bind-html="toHTML(comment.text)"></div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0