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
July 2014
- 1 participants
- 110 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 b521eedaaebb8549e77842b524e322fb477d83c4
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 15:09:26 2014 +0200
translate datePicker
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 95 +++++++++++++++++++++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 96 ++++++++++++++++++++++
.../src/main/webapp/js/controllers/localeCtrl.js | 21 ++++-
3 files changed, 211 insertions(+), 1 deletion(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 38d01f0..8ae450a 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -119,3 +119,98 @@ var translateEN = {
}
+var i18n_EN = {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+ "MONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "SHORTDAY": [
+ "Sun",
+ "Mon",
+ "Tue",
+ "Wed",
+ "Thu",
+ "Fri",
+ "Sat"
+ ],
+ "SHORTMONTH": [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+ ],
+ "fullDate": "EEEE, MMMM d, y",
+ "longDate": "MMMM d, y",
+ "medium": "MMM d, y h:mm:ss a",
+ "mediumDate": "MMM d, y",
+ "mediumTime": "h:mm:ss a",
+ "short": "M/d/yy h:mm a",
+ "shortDate": "M/d/yy",
+ "shortTime": "h:mm a"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "$",
+ "DECIMAL_SEP": ".",
+ "GROUP_SEP": ",",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "(\u00a4",
+ "negSuf": ")",
+ "posPre": "\u00a4",
+ "posSuf": ""
+ }
+ ]
+ },
+ "id": "en",
+ "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+}
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 85aab6a..86bccd4 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -119,3 +119,99 @@ var translateFR = {
}
+var i18n_FR = {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "dimanche",
+ "lundi",
+ "mardi",
+ "mercredi",
+ "jeudi",
+ "vendredi",
+ "samedi"
+ ],
+ "MONTH": [
+ "janvier",
+ "f\u00e9vrier",
+ "mars",
+ "avril",
+ "mai",
+ "juin",
+ "juillet",
+ "ao\u00fbt",
+ "septembre",
+ "octobre",
+ "novembre",
+ "d\u00e9cembre"
+ ],
+ "SHORTDAY": [
+ "dim.",
+ "lun.",
+ "mar.",
+ "mer.",
+ "jeu.",
+ "ven.",
+ "sam."
+ ],
+ "SHORTMONTH": [
+ "janv.",
+ "f\u00e9vr.",
+ "mars",
+ "avr.",
+ "mai",
+ "juin",
+ "juil.",
+ "ao\u00fbt",
+ "sept.",
+ "oct.",
+ "nov.",
+ "d\u00e9c."
+ ],
+ "fullDate": "EEEE d MMMM y",
+ "longDate": "d MMMM y",
+ "medium": "d MMM y HH:mm:ss",
+ "mediumDate": "d MMM y",
+ "mediumTime": "HH:mm:ss",
+ "short": "dd/MM/yy HH:mm",
+ "shortDate": "dd/MM/yy",
+ "shortTime": "HH:mm"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "\u20ac",
+ "DECIMAL_SEP": ",",
+ "GROUP_SEP": "\u00a0",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "(",
+ "negSuf": "\u00a0\u00a4)",
+ "posPre": "",
+ "posSuf": "\u00a0\u00a4"
+ }
+ ]
+ },
+ "id": "fr",
+ "pluralCat": function (n) { if (n >= 0 && n <= 2 && n != 2) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+}
+
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
index 9805d8b..524e3ef 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
@@ -19,9 +19,23 @@
* #L%
*/
angular.module('localeControllers', [])
-.controller('LocaleCtrl', ['$scope', '$rootScope', '$translate', 'SessionStorage',function ($scope, $rootScope, $translate, SessionStorage) {
+.controller('LocaleCtrl', ['$scope', '$rootScope', '$translate', 'SessionStorage', '$locale', function ($scope, $rootScope, $translate, SessionStorage, $locale) {
$scope.debug = conf.debug;
$scope.locale = SessionStorage.get().locale;
+
+ var locales = [];
+ locales['fr'] = i18n_FR;
+ locales['en'] = i18n_EN;
+
+ var loadLocale = function () {
+ if ($scope.locale == "fr" && angular.isDefined(i18n_FR)) {
+ angular.copy(i18n_FR, $locale);
+ }
+ else if (angular.isDefined(i18n_EN)) {
+ angular.copy(i18n_EN, $locale);
+ }
+ }
+
if (angular.isUndefined($scope.locale)) {
// set locale with browser preference
$scope.locale = navigator.language || navigator.userLanguage;
@@ -35,6 +49,7 @@ angular.module('localeControllers', [])
SessionStorage.save({locale:$scope.locale});
}
$translate.use($scope.locale);
+ loadLocale();
$scope.switchLocale = function (locale) {
//change locale
@@ -42,7 +57,11 @@ angular.module('localeControllers', [])
SessionStorage.save({locale:locale});
$scope.locale = locale;
$translate.use(locale);
+
+ loadLocale();
+
$rootScope.$broadcast('switchLocale');
}
}
+
}])
--
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 de3b686a11dd302e287e4e03596aed8517dc8dc0
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 13:59:40 2014 +0200
delete attributs in scope.choice
---
pollen-ui-angular/src/main/webapp/index.html | 6 +++---
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 +------
pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html | 5 ++---
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 7f154b2..289e79f 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 9bb3187..d038e2c 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -205,7 +205,6 @@ angular.module('pollControllers', [])
choice.value = choice.value.getTime();
}
else if (choice.choiceType == 'IMAGE') {
-
choice.value = choice.value.meta.name+"####"+choice.value.data;
}
@@ -367,8 +366,7 @@ angular.module('pollControllers', [])
var initChoice = function () {
return {
choiceType : $scope.globalVariables.lastType,
- valueText : '',
- valueDate : $scope.globalVariables.lastDate,
+ value : ''
};
}
@@ -441,9 +439,6 @@ angular.module('pollControllers', [])
else if (choice.choiceType == 'IMAGE') {
choice.value = choice.valueImage;
}
- delete choice.valueText;
- delete choice.valueDate;
- delete choice.valueImage
if (!angular.equals(choiceEdit, choice)) {
choiceEdit.value = choice.value;
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
index bb2bf39..a8a06f0 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -55,11 +55,10 @@
</div>
<div class="form-group" ng-if="choice.choiceType == 'IMAGE'">
- <label for="popChoiceImage" class="col-sm-4 control-label">Image : </label>
+ <label class="col-sm-4 control-label">Image : </label>
<div class="col-sm-6">
- <upload-file id="popChoiceImage" ng-model="choice.valueImage" focus-me="choice.choiceType == 'IMAGE'" ></upload-file>
- {{choice.valueImage.meta.name}}
+ <upload-file ng-model="choice.valueImage"></upload-file>
</div>
</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 7f9c31286748528085adcd73d9d920029572f633
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 10:42:41 2014 +0200
update TopiaListenableSupport to TopiaFiresSupport
---
.../org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
index d01cfcf..8d5f5ea 100644
--- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
+++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
@@ -24,16 +24,17 @@ package org.chorem.pollen.persistence;
import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.topia.persistence.internal.HibernateProvider;
import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
+import org.nuiton.topia.persistence.internal.support.TopiaFiresSupport;
import org.nuiton.topia.persistence.support.TopiaListenableSupport;
public class PollenTopiaPersistenceContext extends AbstractPollenTopiaPersistenceContext {
public PollenTopiaPersistenceContext(HibernateProvider hibernateProvider,
- TopiaListenableSupport listenableSupport,
+ TopiaFiresSupport applicationFiresSupport,
TopiaIdFactory topiaIdFactory,
TopiaHibernateSessionRegistry sessionRegistry) {
super(hibernateProvider,
- listenableSupport,
+ applicationFiresSupport,
topiaIdFactory,
sessionRegistry);
}
--
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 3fbb710e24eff5115236067535b56fa7c3a8d349
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jul 8 14:59:31 2014 +0200
resize image and view image in full size
---
pollen-ui-angular/src/main/webapp/index.html | 6 +--
pollen-ui-angular/src/main/webapp/js/directives.js | 34 ++++++++++++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 43 ++++++++++++++++++++--
.../src/main/webapp/less/variables.less | 4 +-
.../src/main/webapp/partials/inline-poll.html | 2 +-
.../src/main/webapp/partials/zoomImage.html | 7 ++++
6 files changed, 87 insertions(+), 9 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 34ec952..7f154b2 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/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index a006325..755eb81 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -434,6 +434,10 @@ angular.module('pollenDirective', [])
}])
+//////////////////////////////////////
+///// UPLOAD FILE /////
+//////////////////////////////////////
+
.directive("uploadFile", function () {
return {
restrict : "E",
@@ -446,7 +450,6 @@ angular.module('pollenDirective', [])
var reader = new FileReader();
reader.onload = function (loadEvent) {
scope.$apply(function () {
-// scope.ngModel.data = loadEvent.target.result;
scope.ngModel = { meta: changeEvent.target.files[0], data: loadEvent.target.result};
});
}
@@ -455,4 +458,33 @@ angular.module('pollenDirective', [])
}
}
+})
+
+//////////////////////////////////////
+///// ZOOM IMAGE /////
+//////////////////////////////////////
+
+.directive("zoomImage", function () {
+ return {
+ restrict : "E",
+ scope : {
+ image : "=",
+ name : "="
+ },
+ transclude : true,
+ templateUrl : "partials/zoomImage.html",
+ link : function (scope, element, attrs) {
+ scope.showImage = false;
+
+ var toggleZoom = function () {
+ scope.$apply(function() {
+ scope.showImage = !scope.showImage;
+ });
+ };
+
+ element.bind("click", function (event) {
+ toggleZoom();
+ });
+ }
+ }
})
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 5e6e25b..f61e193 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -11,9 +11,9 @@
margin-top:60px;
}
-@media screen and (max-width:770px) {
+@media screen and (max-width: @responsive-min-width) {
#content, #pollenMenu, #pollenMenu .container-fluid, #poll-link {
- width:770px !important;
+ width:@responsive-min-width !important;
}
}
@@ -132,7 +132,6 @@
@media screen and (max-width: @responsive-large-width) {
@foot-padding : 1.8%;
@foot-height : 80px;
- @responsive-height: 600px;
#poll-link {
text-align:center;
@@ -432,6 +431,44 @@ hr {
margin-bottom:15px;
}
+
+.full {
+ position:fixed;
+ top:0%;
+ left:0%;
+ width:100%;
+ height:100%;
+ margin:0px;
+ padding:0px;
+ z-index:5000;
+ text-align:center;
+ background-color:rgba(0,0,0,0.5);
+
+ .full-content {
+ display:inline-block;
+ max-width:100%;
+ max-height:100%;
+ margin-top:1.25%;
+ margin-bottom:0px;
+ margin-left:1.25%;
+ margin-right:1.25%;
+ padding:8px;
+ background-color:@borderColor;
+ border-radius:8px;
+
+ span {
+ display:block;
+ padding-top:2px;
+ }
+ img {
+ max-width:95% !important;
+ max-height:95% !important;
+ padding:0;
+ margin:0;
+ }
+ }
+}
+
.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;
diff --git a/pollen-ui-angular/src/main/webapp/less/variables.less b/pollen-ui-angular/src/main/webapp/less/variables.less
index 31cd251..18b3ea0 100644
--- a/pollen-ui-angular/src/main/webapp/less/variables.less
+++ b/pollen-ui-angular/src/main/webapp/less/variables.less
@@ -9,4 +9,6 @@
@danger-color : @brand-danger;
@danger-hover-color : darken(@danger-color, 15%);
-@responsive-large-width : 1024px;
\ No newline at end of file
+@responsive-large-width : 1024px;
+@responsive-min-width : 770px;
+@responsive-height: 600px;
\ No newline at end of file
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 4801314..af8c658 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -56,7 +56,7 @@
<info-error error="choice.restError.value[0]" data="choice.value"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
<br/>
- <img ng-attr-src="{{choice.value.data}}" />
+ <zoom-image image="choice.value.data" name="choice.value.meta.name"></zoom-image>
</div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/zoomImage.html b/pollen-ui-angular/src/main/webapp/partials/zoomImage.html
new file mode 100644
index 0000000..43db544
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/partials/zoomImage.html
@@ -0,0 +1,7 @@
+<div><img ng-attr-src="{{image}}" /></div>
+<div ng-show="showImage" class="full">
+ <div class="full-content">
+ <span>{{name}}</span>
+ <img ng-attr-src="{{image}}" />
+ </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 d73a42e650cbc181eb22bf3b361e2c1216f452d5
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 17:25:58 2014 +0200
add choice type Image
---
pollen-persistence/src/main/xmi/pollen.properties | 1 +
.../chorem/pollen/services/bean/ChoiceBean.java | 11 ++--
.../pollen/services/service/ChoiceService.java | 14 ++---
.../src/main/webapp/js/controllers/pollCtrl.js | 59 ++++++++++++++++------
pollen-ui-angular/src/main/webapp/js/directives.js | 28 +++++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 5 ++
.../src/main/webapp/partials/inline-poll.html | 16 +++++-
.../src/main/webapp/partials/poll-popupChoice.html | 20 ++++++--
.../src/main/webapp/partials/poll-result.html | 2 +-
9 files changed, 121 insertions(+), 35 deletions(-)
diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties
index 0b26c1f..8a4f95e 100644
--- a/pollen-persistence/src/main/xmi/pollen.properties
+++ b/pollen-persistence/src/main/xmi/pollen.properties
@@ -30,6 +30,7 @@ model.tagValue.hibernateAttributeType.String=string
# Text
org.chorem.pollen.persistence.entity.Poll.attribute.description.tagValue.hibernateAttributeType=text
org.chorem.pollen.persistence.entity.Choice.attribute.description.tagValue.hibernateAttributeType=text
+org.chorem.pollen.persistence.entity.Choice.attribute.name.tagValue.hibernateAttributeType=text
org.chorem.pollen.persistence.entity.Comment.attribute.text.tagValue.hibernateAttributeType=text
# clef naturelle non modifiable sur PollenToken.token
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
index 99c7fb6..fa0b5fa 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
@@ -75,8 +75,8 @@ public class ChoiceBean extends PollenBean<Choice> {
case IMAGE:
- throw new IllegalStateException("Not implemented");
- //break;
+ setValue(entity.getName());
+ break;
}
setDescription(entity.getDescription());
@@ -109,8 +109,11 @@ public class ChoiceBean extends PollenBean<Choice> {
case IMAGE:
- throw new IllegalStateException("Not implemented");
- //break;
+ if ( getValue() != null ) {
+ entity.setName(getValue());
+ }
+
+ break;
}
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index f47aa77..ae476f4 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -237,24 +237,24 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
toSave.setName(choice.getValue());
- toSave.setDescription(choice.getDescription());
- toSave.setCreator(poll.getCreator());
break;
case DATE:
toSave.setName(choice.getValue());
- toSave.setDescription(choice.getDescription());
- toSave.setCreator(poll.getCreator());
break;
case IMAGE:
- throw new IllegalStateException("Not implemented");
+ toSave.setName(choice.getValue());
+
}
+ toSave.setDescription(choice.getDescription());
+ toSave.setCreator(poll.getCreator());
+
return toSave;
}
@@ -328,8 +328,8 @@ public class ChoiceService extends PollenServiceSupport {
break;
case IMAGE:
-
- throw new IllegalStateException("Not implemented");
+ // TODO : verify picture
+ break;
}
}
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 8395de8..9bb3187 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -200,6 +200,31 @@ angular.module('pollControllers', [])
}
}
+ $scope.preSendChoice = function (choice) {
+ if (choice.choiceType == 'DATE') {
+ choice.value = choice.value.getTime();
+ }
+ else if (choice.choiceType == 'IMAGE') {
+
+ choice.value = choice.value.meta.name+"####"+choice.value.data;
+ }
+
+ return choice;
+ }
+
+ $scope.postReceiveChoice = function (choice) {
+ if (choice.choiceType == 'DATE') {
+ choice.value = new Date(Number(choice.value));
+ }
+ else if (choice.choiceType == 'IMAGE') {
+ var tmp = choice.value.split("####");
+
+ choice.value = {meta:{name:tmp[0]}, data : tmp[1]};
+ }
+
+ return choice;
+ }
+
$timeout(function () {
$scope.$watch('data.poll.voteCountingType', function (newVal, oldVal) {
if (newVal != oldVal && oldVal !== undefined) {
@@ -386,6 +411,9 @@ angular.module('pollControllers', [])
else if (choice.choiceType == 'DATE') {
choice.valueDate = choice.value;
}
+ else if (choice.choiceType == 'IMAGE') {
+ choice.valueImage = choice.value;
+ }
// set default date
if (angular.isUndefined(choice.valueDate)) {
@@ -410,8 +438,12 @@ angular.module('pollControllers', [])
choice.value = choice.valueDate;
$scope.globalVariables.lastDate = angular.copy(choice.valueDate);
}
+ else if (choice.choiceType == 'IMAGE') {
+ choice.value = choice.valueImage;
+ }
delete choice.valueText;
delete choice.valueDate;
+ delete choice.valueImage
if (!angular.equals(choiceEdit, choice)) {
choiceEdit.value = choice.value;
@@ -510,9 +542,7 @@ angular.module('pollControllers', [])
poll.choice = angular.copy($scope.data.choices);
angular.forEach(poll.choice, function(choice) {
- if (choice.choiceType == 'DATE') {
- choice.value = choice.value.getTime();
- }
+ choice = $scope.preSendChoice(choice);
});
if (angular.isDate(poll.beginDate)) {
@@ -571,9 +601,7 @@ angular.module('pollControllers', [])
$scope.callBackAddChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (saveChoice.choiceType == 'DATE') {
- saveChoice.value = saveChoice.value.getTime();
- }
+ saveChoice = $scope.preSendChoice(saveChoice);
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function (data) {
delete choice.restError;
@@ -587,9 +615,7 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (saveChoice.choiceType == 'DATE') {
- saveChoice.value = saveChoice.value.getTime();
- }
+ saveChoice = $scope.preSendChoice(saveChoice);
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function() {
delete choice.restError;
@@ -860,9 +886,7 @@ angular.module('pollControllers', [])
PollChoice.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}).$promise.then(function (choices) {
$scope.data.choices = choices;
angular.forEach(choices, function (ch) {
- if (ch.choiceType == 'DATE') {
- ch.value = new Date(Number(ch.value));
- }
+ ch = $scope.postReceiveChoice(ch);
})
$scope.data.vote = {};
$scope.data.vote.choice = $scope.data.choices;
@@ -932,9 +956,7 @@ angular.module('pollControllers', [])
var pollChoicePromise = PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
angular.forEach(choices, function (ch) {
- if (ch.choiceType == 'DATE') {
- ch.value = new Date(Number(ch.value));
- }
+ ch = $scope.postReceiveChoice(ch);
});
$scope.data.choices = choices;
@@ -1230,6 +1252,9 @@ angular.module('pollControllers', [])
var choicesDeferred = $q.defer();
PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
$scope.data.choices = choices;
+ angular.forEach(choices, function (choice) {
+ choice = $scope.postReceiveChoice(choice);
+ });
choicesDeferred.resolve('choices load');
});
@@ -1264,6 +1289,10 @@ angular.module('pollControllers', [])
scores.push([$filter('date')(value.choice.value, $scope.globalVariables.dateFormat), value.scoreValue]);
break;
+ case 'IMAGE':
+ scores.push([value.choice.value.meta.name, value.scoreValue]);
+ break;
+
default:
scores.push([key, value.scoreValue]);
}
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index f3ef921..a006325 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -144,7 +144,7 @@ angular.module('pollenDirective', [])
}
});
- element.bind('blur', function () {
+ element.bind('blur change', function () {
$timeout (function () {
scope.$apply(attrs.ngExit);
}, 150);
@@ -431,4 +431,28 @@ angular.module('pollenDirective', [])
})
}
}
-}])
\ No newline at end of file
+}])
+
+
+.directive("uploadFile", function () {
+ return {
+ restrict : "E",
+ scope: {
+ ngModel: "="
+ },
+ template:'<input type="file" />',
+ link: function (scope, element, attrs) {
+ element.bind("change", function (changeEvent) {
+ var reader = new FileReader();
+ reader.onload = function (loadEvent) {
+ scope.$apply(function () {
+// scope.ngModel.data = loadEvent.target.result;
+ scope.ngModel = { meta: changeEvent.target.files[0], data: loadEvent.target.result};
+ });
+ }
+ reader.readAsDataURL( changeEvent.target.files[0] );
+ });
+
+ }
+ }
+})
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 8f39e9b..5e6e25b 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -211,6 +211,11 @@
height:60px;
width:80px;
}
+
+ img {
+ max-width:200px;
+ max-height:200px;
+ }
}
}
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 abaf068..4801314 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -24,7 +24,9 @@
<table id="poll-inline">
<!-- begin print choices -->
<tr>
- <td><button ng-click="bigVersion()" class="btn btn-default" >Big version</button></td>
+ <td>
+ <!--<button ng-click="bigVersion()" class="btn btn-default" >Big version</button>-->
+ </td>
<td ng-repeat="choice in data.choices" class="pollChoice pollAnim" ng-mouseenter="showEditHover = true" ng-mouseleave="showEditHover = false">
<div ng-if="choice.choiceType == 'TEXT'" edit-me="showEdit" >
<div ng-hide="showEdit && !globalVariables.voted" class="fixe-input" title="{{choice.description}}">
@@ -48,6 +50,18 @@
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
+ <div ng-if="choice.choiceType == 'IMAGE'">
+ <div class="fixe-input" title="{{choice.description}}">
+ {{choice.value.meta.name}}
+ <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
+ <input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
+ <br/>
+ <img ng-attr-src="{{choice.value.data}}" />
+
+ </div>
+
+
+ </div>
</td>
<td ng-if="!globalVariables.voted && globalVariables.editMode"><button class="btn btn-default btn-large" ng-click="addChoice()"> <span class="glyphicon glyphicon-plus"></span> </button></td>
</tr>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
index b81131d..bb2bf39 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -31,28 +31,38 @@
<div class="col-sm-8 btn-group">
<button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'TEXT'">Text</button>
<button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'DATE'">Date</button>
- <button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'IMAGE'" disabled>Image</button>
+ <button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'IMAGE'">Image</button>
</div>
</div>
<div class="form-group" ng-if="choice.choiceType == 'TEXT'">
- <label for="popNameChoiceCheck" class="col-sm-4 control-label">Nom du Choix : </label>
+ <label for="popChoiceText" class="col-sm-4 control-label">Nom du Choix : </label>
<div class="col-sm-6">
- <input id="popNameChoiceCheck" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
+ <input id="popChoiceText" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
</div>
</div>
<div class="form-group" ng-if="choice.choiceType == 'DATE'">
- <label for="popNameChoiceDate" class="col-sm-4 control-label">Date : </label>
+ <label for="popChoiceDate" class="col-sm-4 control-label">Date : </label>
<div class="col-sm-6">
<div class="right-inner-addon ">
<i class="glyphicon glyphicon-calendar glyphicon-input"></i>
- <input id="popNameChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.valueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
+ <input id="popChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.valueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
</div>
</div>
</div>
+
+ <div class="form-group" ng-if="choice.choiceType == 'IMAGE'">
+ <label for="popChoiceImage" class="col-sm-4 control-label">Image : </label>
+
+ <div class="col-sm-6">
+ <upload-file id="popChoiceImage" ng-model="choice.valueImage" focus-me="choice.choiceType == 'IMAGE'" ></upload-file>
+ {{choice.valueImage.meta.name}}
+ </div>
+ </div>
+
<div class="form-group">
<label for="popDescChoice" class="col-sm-4 control-label">Description : </label>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-result.html b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
index dd918ea..6965664 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-result.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
@@ -24,7 +24,7 @@
<th>{{ 'poll.result.score' | translate }}</th>
</tr>
<tr ng-repeat="score in data.result.scores">
- <th> {{ score.choice.name || (score.choice.date | date:globalVariables.dateFormat) }} </th>
+ <th> {{ score.choice.value.meta.name || (score.choice.value | date:globalVariables.dateFormat) || score.choice.value }} </th>
<td>
{{score.scoreValue}}
</td>
--
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 d3a66fccd63101da4f9bde59a1d0e9f3142b5ec6
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 12:43:36 2014 +0200
fix test : bad name error
---
.../java/org/chorem/pollen/services/service/PollServiceTest.java | 4 ++--
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
index e3c43d2..448e5a8 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
@@ -169,7 +169,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
Assert.fail();
} catch (InvalidFormException e) {
// missing choice name
- assertErrorKeyFound(e, "choice[0].name");
+ assertErrorKeyFound(e, "choice[0].value");
}
choice1.setValue("A");
@@ -187,7 +187,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
Assert.fail();
} catch (InvalidFormException e) {
// duplicated choice name
- assertErrorKeyFound(e, "choice[1].name");
+ assertErrorKeyFound(e, "choice[1].value");
}
choice2.setValue("B");
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 4f2620b..8395de8 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -510,7 +510,6 @@ angular.module('pollControllers', [])
poll.choice = angular.copy($scope.data.choices);
angular.forEach(poll.choice, function(choice) {
- console.log(choice);
if (choice.choiceType == 'DATE') {
choice.value = choice.value.getTime();
}
@@ -932,6 +931,12 @@ angular.module('pollControllers', [])
}
var pollChoicePromise = PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
+ angular.forEach(choices, function (ch) {
+ if (ch.choiceType == 'DATE') {
+ ch.value = new Date(Number(ch.value));
+ }
+ });
+
$scope.data.choices = choices;
}).$promise;
--
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 20e64cb2096b24afb43df85926eb0f9099ea19f4
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 11:40:13 2014 +0200
change choiceBean
---
.../org/chorem/pollen/rest/api/PollApiTest.java | 22 ++----
.../rest/api/converter/JsonArrayConverterTest.java | 8 +-
.../rest/api/converter/JsonConverterTest.java | 4 +-
.../chorem/pollen/services/bean/ChoiceBean.java | 32 +++-----
.../pollen/services/service/ChoiceService.java | 18 ++---
.../pollen/services/service/PollServiceTest.java | 56 +++++++-------
.../services/service/VoteCountingServiceTest.java | 4 +-
.../services/service/VoterListServiceTest.java | 4 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 85 ++++++++++++++++------
.../src/main/webapp/partials/inline-poll.html | 13 ++--
.../src/main/webapp/partials/poll-popupChoice.html | 4 +-
11 files changed, 138 insertions(+), 112 deletions(-)
diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java
index 7bd1100..37cf5b1 100644
--- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java
+++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java
@@ -23,16 +23,10 @@ package org.chorem.pollen.rest.api;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.fluent.Request;
-import org.chorem.pollen.persistence.entity.Choice;
-import org.chorem.pollen.persistence.entity.ChoiceImpl;
-import org.chorem.pollen.persistence.entity.ChoiceType;
-import org.chorem.pollen.persistence.entity.CommentVisibility;
-import org.chorem.pollen.persistence.entity.Poll;
-import org.chorem.pollen.persistence.entity.PollImpl;
-import org.chorem.pollen.persistence.entity.PollType;
-import org.chorem.pollen.persistence.entity.ResultVisibility;
-import org.chorem.pollen.persistence.entity.VoteVisibility;
+import org.chorem.pollen.persistence.entity.*;
import org.chorem.pollen.services.PollenFixtures;
+import org.chorem.pollen.services.bean.ChoiceBean;
+import org.chorem.pollen.services.bean.PollenBeans;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -127,14 +121,14 @@ public class PollApiTest extends AbstractPollenRestApiTest {
poll.setVoteCountingType(1);
poll.setTitle("title");
- List<Choice> choices = new ArrayList<>();
- Choice choice1 = new ChoiceImpl();
+ List<ChoiceBean> choices = new ArrayList<>();
+ ChoiceBean choice1 = new ChoiceBean();
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("choiceA");
+ choice1.setValue("choiceA");
choices.add(choice1);
- Choice choice2 = new ChoiceImpl();
+ ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("choiceB");
+ choice2.setValue("choiceB");
choices.add(choice2);
String choiceStr = getJsonHelper().toJson(choices);
diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java
index 78294be..649e8a6 100644
--- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java
+++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java
@@ -32,8 +32,8 @@ public class JsonArrayConverterTest {
@Test
public void convertToType() throws Exception {
- String choicesStr = "[ {id: \"AAAA\", name: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " +
- " {id: \"BBBB\", name: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]";
+ String choicesStr = "[ {id: \"AAAA\", value: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " +
+ " {id: \"BBBB\", value: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]";
JsonArrayConverter converter = JsonArrayConverter.newConverter(new DefaultTopiaIdFactory(), ChoiceBean.class);
@@ -42,12 +42,12 @@ public class JsonArrayConverterTest {
Assert.assertEquals(2, choices.length);
Assert.assertNotNull(choices[0]);
- Assert.assertEquals("choice1", choices[0].getName());
+ Assert.assertEquals("choice1", choices[0].getValue());
Assert.assertEquals(ChoiceType.TEXT, choices[0].getChoiceType());
Assert.assertEquals(1, choices[0].getChoiceOrder());
Assert.assertNotNull(choices[1]);
- Assert.assertEquals("choice2", choices[1].getName());
+ Assert.assertEquals("choice2", choices[1].getValue());
Assert.assertEquals(ChoiceType.IMAGE, choices[1].getChoiceType());
Assert.assertEquals(2, choices[1].getChoiceOrder());
diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java
index 35bd59d..eea755d 100644
--- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java
+++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java
@@ -64,8 +64,8 @@ public class JsonConverterTest {
public void convertEntity() {
String pollStr = "{topiaCreateDate: 1399033089600, title: \"pollTitle\", " +
- "choice: [ {name: \"choice1\", choiceType: \"TEXT\"}, " +
- "{name: \"choice2\", choiceType: \"IMAGE\"} ], voteVisibility: \"ANONYMOUS\", " +
+ "choice: [ {value: \"choice1\", choiceType: \"TEXT\"}, " +
+ "{value: \"choice2\", choiceType: \"IMAGE\"} ], voteVisibility: \"ANONYMOUS\", " +
"commentVisibility:\"NOBODY\", pollType: \"FREE\" }";
JsonConverter<Poll> converter = JsonConverter.newEntityConverter(new DefaultTopiaIdFactory(), Poll.class);
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
index 7e40513..99c7fb6 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
@@ -39,9 +39,7 @@ public class ChoiceBean extends PollenBean<Choice> {
protected int choiceOrder;
- protected String name;
-
- protected Date date;
+ protected String value;
protected ChoiceType choiceType;
@@ -68,13 +66,11 @@ public class ChoiceBean extends PollenBean<Choice> {
switch (entity.getChoiceType()) {
case TEXT:
- setName(entity.getName());
- setDate(null);
+ setValue(entity.getName());
break;
case DATE:
- setName(null);
- setDate(new Date(Long.parseLong(entity.getName())));
+ setValue(entity.getName());
break;
case IMAGE:
@@ -100,13 +96,13 @@ public class ChoiceBean extends PollenBean<Choice> {
if (choiceType != null) {
switch (choiceType) {
case TEXT:
- entity.setName(getName());
+ entity.setName(getValue());
break;
case DATE:
- if ( getDate() != null ) {
- entity.setName(String.valueOf(getDate().getTime()));
+ if ( getValue() != null ) {
+ entity.setName(getValue());
}
break;
@@ -134,20 +130,12 @@ public class ChoiceBean extends PollenBean<Choice> {
this.permission = permission;
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Date getDate() {
- return date;
+ public String getValue() {
+ return value;
}
- public void setDate(Date date) {
- this.date = date;
+ public void setValue(String value) {
+ this.value = value;
}
public ChoiceType getChoiceType() {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index 72852b0..f47aa77 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -236,7 +236,7 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
- toSave.setName(choice.getName());
+ toSave.setName(choice.getValue());
toSave.setDescription(choice.getDescription());
toSave.setCreator(poll.getCreator());
@@ -244,7 +244,7 @@ public class ChoiceService extends PollenServiceSupport {
case DATE:
- toSave.setName(String.valueOf(choice.getDate().getTime()));
+ toSave.setName(choice.getValue());
toSave.setDescription(choice.getDescription());
toSave.setCreator(poll.getCreator());
@@ -293,36 +293,36 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
- String choiceName = choice.getName();
+ String choiceName = choice.getValue();
boolean nameNotBlank = checkNotBlank(errors,
- "name",
+ "value",
choiceName,
l(getLocale(), "pollen.error.choice.choiceNameEmpty"));
if (nameNotBlank) {
boolean nameAdded = choiceNames.add(choiceName);
- check(errors, "name", nameAdded, l(getLocale(), "pollen.error.choice.choiceNameExist"));
+ check(errors, "value", nameAdded, l(getLocale(), "pollen.error.choice.choiceNameExist"));
}
break;
case DATE:
- Date choiceDate = choice.getDate();
+ Date choiceDate = new Date(Long.parseLong(choice.getValue()));
boolean dateNotBlank;
if (choiceDate == null) {
- dateNotBlank = checkNotBlank(errors, "date", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
+ dateNotBlank = checkNotBlank(errors, "value", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
}
else {
dateNotBlank = checkNotBlank(errors,
- "date",
+ "value",
String.valueOf(choiceDate),
l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
}
if (dateNotBlank) {
boolean dateAdded = choiceNames.add(String.valueOf(choiceDate.getTime()));
- check(errors, "date", dateAdded, l(getLocale(), "pollen.error.choice.choiceDateExist"));
+ check(errors, "value", dateAdded, l(getLocale(), "pollen.error.choice.choiceDateExist"));
}
break;
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
index ce07c29..e3c43d2 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
@@ -85,13 +85,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean choice1 = new ChoiceBean();
choices.add(choice1);
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("B");
+ choice2.setValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
@@ -117,7 +117,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
Assert.assertEquals(createdChoice1, reloadedChoice1);
- Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+ Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
@@ -128,7 +128,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
Assert.assertEquals(createdChoice2, reloadedChoice2);
- Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+ Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
}
@@ -172,13 +172,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
assertErrorKeyFound(e, "choice[0].name");
}
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("A");
+ choice2.setValue("A");
choice2.setDescription("Choice B");
choices.add(choice2);
@@ -190,7 +190,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
assertErrorKeyFound(e, "choice[1].name");
}
- choice2.setName("B");
+ choice2.setValue("B");
PollenEntityRef<Poll> createdPoll = service.createPoll(poll, choices);
@@ -205,7 +205,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// Assert.assertNotNull(createdPoll.getCreator());
// Assert.assertNotNull(createdPoll.getCreator().getTopiaId());
-// Assert.assertNull(createdPoll.getCreator().getName());
+// Assert.assertNull(createdPoll.getCreator().getValue());
// Assert.assertNull(createdPoll.getCreator().getEmail());
// Assert.assertNull(createdPoll.getComment());
// Assert.assertNull(createdPoll.getVote());
@@ -224,7 +224,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
Assert.assertEquals(createdChoice1, reloadedChoice1);
- Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+ Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
ChoiceBean createdChoice2 = createdChoices.get(1);
@@ -234,7 +234,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
Assert.assertEquals(createdChoice2, reloadedChoice2);
- Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+ Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
}
@@ -253,13 +253,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean choice1 = new ChoiceBean();
// choices.add(choice1);
// choice1.setChoiceType(ChoiceType.TEXT);
-// choice1.setName("A");
+// choice1.setValue("A");
// choice1.setDescription("Choice A");
//
//
// ChoiceBean choice2 = new ChoiceBean();
// choice2.setChoiceType(ChoiceType.TEXT);
-// choice2.setName("B");
+// choice2.setValue("B");
// choice2.setDescription("Choice B");
// choices.add(choice2);
//
@@ -289,7 +289,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//
//// Assert.assertNotNull(createdPoll.getCreator());
//// Assert.assertNotNull(createdPoll.getCreator().getTopiaId());
-//// Assert.assertNull(createdPoll.getCreator().getName());
+//// Assert.assertNull(createdPoll.getCreator().getValue());
//// Assert.assertNull(createdPoll.getCreator().getEmail());
//
// List<ChoiceBean> createdChoices = choiceService.getChoices(createdPollId);
@@ -304,7 +304,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
// Assert.assertEquals(createdChoice1, reloadedChoice1);
//
-// Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+// Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
// Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice1.getCreator());
//
@@ -315,7 +315,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
// Assert.assertEquals(createdChoice2, reloadedChoice2);
//
-// Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+// Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
// Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice2.getCreator());
//
@@ -330,7 +330,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// VoterListBean reloadedVoterList = voterListService.getVoterList(createdPollId, createdVoterList.getEntityId());
// Assert.assertEquals(createdVoterList, reloadedVoterList);
//
-// Assert.assertEquals(voterList.getName(), createdVoterList.getName());
+// Assert.assertEquals(voterList.getValue(), createdVoterList.getValue());
// Assert.assertEquals(voterList.getWeight(), createdVoterList.getWeight(), 0);
//
// Assert.assertNotNull(createdVoterList.getMember());
@@ -350,14 +350,14 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//
// ChoiceBean choice1 = new ChoiceBean();
// choice1.setChoiceType(ChoiceType.TEXT);
-// choice1.setName("A");
+// choice1.setValue("A");
// choice1.setDescription("Choice A");
//
// choices.add(choice1);
//
// ChoiceBean choice2 = new ChoiceBean();
// choice2.setChoiceType(ChoiceType.TEXT);
-// choice2.setName("B");
+// choice2.setValue("B");
// choice2.setDescription("Choice B");
//
// choices.add(choice2);
@@ -387,7 +387,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// assertErrorKeyFound(e, "voterList[0].name", "voterList[0].weight", "voterList[0].member");
// }
//
-// voterList.setName("voterList1");
+// voterList.setValue("voterList1");
// voterList.setWeight(1);
//
// VoterListMemberBean voterListMember1 = new VoterListMemberBean();
@@ -402,7 +402,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// assertErrorKeyFound(e, "voterList[0].member[0].name", "voterList[0].member[0].email", "voterList[0].member[0].weight");
// }
//
-// voterListMember1.setName("voter1");
+// voterListMember1.setValue("voter1");
// voterListMember1.setWeight(0.3);
// voterListMember1.setEmail("voter1_pollen.org");
//
@@ -417,7 +417,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// voterListMember1.setEmail("voter1(a)pollen.org");
//
// VoterListMemberBean voterListMember2 = new VoterListMemberBean();
-// voterListMember2.setName("voter1");
+// voterListMember2.setValue("voter1");
// voterListMember2.setWeight(0.7);
// voterListMember2.setEmail("voter1(a)pollen.org");
// voterList.addMember(voterListMember2);
@@ -431,7 +431,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// assertErrorKeyFound(e, "voterList[0].member[1].name", "voterList[0].member[1].email");
// }
//
-// voterListMember2.setName("voter2");
+// voterListMember2.setValue("voter2");
// voterListMember2.setEmail("voter2(a)pollen.org");
//
// PollenEntityRef<Poll> createdPoll = service.createPoll(poll, choices);
@@ -457,7 +457,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//
//// Assert.assertNotNull(createdPoll.getCreator());
//// Assert.assertNotNull(createdPoll.getCreator().getTopiaId());
-//// Assert.assertNull(createdPoll.getCreator().getName());
+//// Assert.assertNull(createdPoll.getCreator().getValue());
//// Assert.assertNull(createdPoll.getCreator().getEmail());
//// Assert.assertNull(createdPoll.getComment());
//// Assert.assertNull(createdPoll.getVote());
@@ -474,7 +474,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
// Assert.assertEquals(createdChoice1, reloadedChoice1);
//
-// Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+// Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
// Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice1.getCreator());
//
@@ -485,7 +485,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
// Assert.assertEquals(createdChoice2, reloadedChoice2);
//
-// Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+// Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
// Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice2.getCreator());
//
@@ -500,7 +500,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// VoterListBean reloadedVoterList = voterListService.getVoterList(createdPollId, createdVoterList.getEntityId());
// Assert.assertEquals(createdVoterList, reloadedVoterList);
//
-// Assert.assertEquals(voterList.getName(), createdVoterList.getName());
+// Assert.assertEquals(voterList.getValue(), createdVoterList.getValue());
// Assert.assertEquals(voterList.getWeight(), createdVoterList.getWeight(), 0);
//
// Assert.assertNotNull(createdVoterList.getMember());
@@ -513,7 +513,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//// VoterListMember reloadedVoterListMember1 = voterListService.getMember(createdPoll.getTopiaId(), createdVoterList.getTopiaId(), createdVoterListMember1.getTopiaId());
//// Assert.assertEquals(createdVoterListMember1, reloadedVoterListMember1);
////
-//// Assert.assertEquals(reloadedVoterListMember1.getName(), createdVoterListMember1.getName());
+//// Assert.assertEquals(reloadedVoterListMember1.getValue(), createdVoterListMember1.getValue());
//// Assert.assertEquals(reloadedVoterListMember1.getEmail(), createdVoterListMember1.getEmail());
//// Assert.assertEquals(reloadedVoterListMember1.getWeight(), createdVoterListMember1.getWeight(), 0);
////
@@ -525,7 +525,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//// VoterListMember reloadedVoterListMember2 = voterListService.getMember(createdPoll.getTopiaId(), createdVoterList.getTopiaId(), createdVoterListMember2.getTopiaId());
//// Assert.assertEquals(createdVoterListMember2, reloadedVoterListMember2);
////
-//// Assert.assertEquals(reloadedVoterListMember2.getName(), createdVoterListMember2.getName());
+//// Assert.assertEquals(reloadedVoterListMember2.getValue(), createdVoterListMember2.getValue());
//// Assert.assertEquals(reloadedVoterListMember2.getEmail(), createdVoterListMember2.getEmail());
//// Assert.assertEquals(reloadedVoterListMember2.getWeight(), createdVoterListMember2.getWeight(), 0);
//
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java
index e06ce45..d7f1703 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java
@@ -83,13 +83,13 @@ public class VoteCountingServiceTest extends AbstractPollenServiceTest {
ChoiceBean choice1 = new ChoiceBean();
choices.add(choice1);
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("B");
+ choice2.setValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java
index 23c3976..1fcc304 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java
@@ -100,12 +100,12 @@ public class VoterListServiceTest extends AbstractPollenServiceTest {
ChoiceBean choice1 = new ChoiceBean();
choices.add(choice1);
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("B");
+ choice2.setValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
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 a7ec70c..4f2620b 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -341,9 +341,9 @@ angular.module('pollControllers', [])
var initChoice = function () {
return {
- name: '',
- date: $scope.globalVariables.lastDate,
- choiceType: $scope.globalVariables.lastType
+ choiceType : $scope.globalVariables.lastType,
+ valueText : '',
+ valueDate : $scope.globalVariables.lastDate,
};
}
@@ -371,25 +371,54 @@ angular.module('pollControllers', [])
}
}
- var popupChoice = function (choice, title, callBack) {
- var oldChoice = angular.copy(choice);
+ var popupChoice = function (choiceEdit, title, callBack) {
+ var choice = angular.copy(choiceEdit);
+
var modalInstance = $modal.open({
templateUrl : 'partials/poll-popupChoice.html',
controller : PollPopChoiceCtrl,
resolve : {
title : function () { return title;},
- choice : function () { return choice;},
+ choice : function () {
+ if (choice.choiceType == 'TEXT') {
+ choice.valueText = choice.value;
+ }
+ else if (choice.choiceType == 'DATE') {
+ choice.valueDate = choice.value;
+ }
+
+ // set default date
+ if (angular.isUndefined(choice.valueDate)) {
+ choice.valueDate = $scope.globalVariables.lastDate;
+ }
+
+ return choice;
+ },
dateFormat : function () { return $scope.globalVariables.dateFormat;}
}
});
modalInstance.result.then(function (returnChoice) {
- $scope.deleteChoice(returnChoice);
+ $scope.deleteChoice(choiceEdit);
}, function () {
$scope.globalVariables.lastType = choice.choiceType;
- $scope.globalVariables.lastDate = choice.date;
- if (!angular.equals(oldChoice, choice)) {
- callBack(choice);
+
+ if (choice.choiceType == 'TEXT') {
+ choice.value = choice.valueText;
+ }
+ else if (choice.choiceType == 'DATE') {
+ choice.value = choice.valueDate;
+ $scope.globalVariables.lastDate = angular.copy(choice.valueDate);
+ }
+ delete choice.valueText;
+ delete choice.valueDate;
+
+ if (!angular.equals(choiceEdit, choice)) {
+ choiceEdit.value = choice.value;
+ choiceEdit.choiceType = choice.choiceType;
+ choiceEdit.description = choice.description;
+
+ callBack(choiceEdit);
}
});
}
@@ -481,8 +510,9 @@ angular.module('pollControllers', [])
poll.choice = angular.copy($scope.data.choices);
angular.forEach(poll.choice, function(choice) {
- if (angular.isDate(choice.date)) {
- choice.date = choice.date.getTime();
+ console.log(choice);
+ if (choice.choiceType == 'DATE') {
+ choice.value = choice.value.getTime();
}
});
@@ -542,8 +572,8 @@ angular.module('pollControllers', [])
$scope.callBackAddChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (angular.isDate(saveChoice.date)) {
- saveChoice.date = saveChoice.date.getTime();
+ if (saveChoice.choiceType == 'DATE') {
+ saveChoice.value = saveChoice.value.getTime();
}
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function (data) {
@@ -558,8 +588,8 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (angular.isDate(saveChoice.date)) {
- saveChoice.date = saveChoice.date.getTime();
+ if (saveChoice.choiceType == 'DATE') {
+ saveChoice.value = saveChoice.value.getTime();
}
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function() {
@@ -578,9 +608,17 @@ angular.module('pollControllers', [])
$scope.data.choices.splice(index,1);
}
}, function (error) {
- angular.extend($scope.restError, error.data);
- if (angular.isDefined(error.data.choice)) {
- $rootScope.$broadcast('newError', error.data.choice[0]);
+ if (error.status == 400) {
+ angular.extend($scope.restError, error.data);
+ if (angular.isDefined(error.data.choice)) {
+ $rootScope.$broadcast('newError', error.data.choice[0]);
+ }
+ }
+ else {
+ var index = $scope.data.choices.indexOf(choice);
+ if (index > -1) {
+ $scope.data.choices.splice(index,1);
+ }
}
});
};
@@ -822,6 +860,11 @@ angular.module('pollControllers', [])
PollChoice.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}).$promise.then(function (choices) {
$scope.data.choices = choices;
+ angular.forEach(choices, function (ch) {
+ if (ch.choiceType == 'DATE') {
+ ch.value = new Date(Number(ch.value));
+ }
+ })
$scope.data.vote = {};
$scope.data.vote.choice = $scope.data.choices;
});
@@ -1209,11 +1252,11 @@ angular.module('pollControllers', [])
switch (value.choice.choiceType) {
case 'TEXT':
- scores.push([value.choice.name, value.scoreValue]);
+ scores.push([value.choice.value, value.scoreValue]);
break;
case 'DATE':
- scores.push([$filter('date')(value.choice.date, $scope.globalVariables.dateFormat), value.scoreValue]);
+ scores.push([$filter('date')(value.choice.value, $scope.globalVariables.dateFormat), value.scoreValue]);
break;
default:
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 6061367..abaf068 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -28,22 +28,23 @@
<td ng-repeat="choice in data.choices" class="pollChoice pollAnim" ng-mouseenter="showEditHover = true" ng-mouseleave="showEditHover = false">
<div ng-if="choice.choiceType == 'TEXT'" edit-me="showEdit" >
<div ng-hide="showEdit && !globalVariables.voted" class="fixe-input" title="{{choice.description}}">
- {{ choice.name || ('poll.edit' | translate) }}
- <info-error error="choice.restError.name[0]" data="choice.name"></info-error>
+ {{ choice.value || ('poll.edit' | translate) }}
+ <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/></div>
<div ng-show="showEdit && !globalVariables.voted">
- <input type="text" class="form-control" ng-model="choice.name" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/>
+ <input type="text" class="form-control" ng-model="choice.value" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/>
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
<div ng-if="choice.choiceType == 'DATE'" edit-me="showEdit" >
<div ng-hide="!globalVariables.voted && showEdit || isOpen" class="fixe-input" title="{{choice.description}}">
- {{ (choice.date | date:globalVariables.dateFormat) || ('poll.edit' | translate) }}
- <info-error error="choice.restError.date[0]" data="choice.date"></info-error>
+ {{ (choice.value | date:globalVariables.dateFormat) || ('poll.edit' | translate) }}
+ <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
</div>
<div ng-show="!globalVariables.voted && showEdit || isOpen" >
- <input type="text" class="form-control" ng-model="choice.date" focus-me="showEdit" datepicker-popup="{{globalVariables.dateFormat}}" is-open="isOpen" ng-exit="showEdit = false" ng-click="isOpen = true" auto-save="saveChoice(choice)" required/>
+
+ <input type="text" class="form-control" ng-model="choice.value" focus-me="showEdit" datepicker-popup="{{globalVariables.dateFormat}}" is-open="isOpen" ng-exit="showEdit = false" ng-click="isOpen = true" auto-save="saveChoice(choice)" required/>
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
index 3264210..b81131d 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -39,7 +39,7 @@
<label for="popNameChoiceCheck" class="col-sm-4 control-label">Nom du Choix : </label>
<div class="col-sm-6">
- <input id="popNameChoiceCheck" type="text" ng-model="choice.name" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
+ <input id="popNameChoiceCheck" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
</div>
</div>
@@ -49,7 +49,7 @@
<div class="col-sm-6">
<div class="right-inner-addon ">
<i class="glyphicon glyphicon-calendar glyphicon-input"></i>
- <input id="popNameChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.date" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
+ <input id="popNameChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.valueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
</div>
</div>
</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 6001ab6c994f2d04f9d7b216a3e581bc300c89c8
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 11:38:46 2014 +0200
eugene 2.11-SNAPSHOT to 2.12-SNAPSHOT
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index b38a5f7..828fae2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,7 +163,7 @@
<webmotionVersion>2.4.1-SNAPSHOT</webmotionVersion>
<nuitonI18nVersion>3.1</nuitonI18nVersion>
- <eugenePluginVersion>2.11-SNAPSHOT</eugenePluginVersion>
+ <eugenePluginVersion>2.12-SNAPSHOT</eugenePluginVersion>
<topiaVersion>3.0-SNAPSHOT</topiaVersion>
<nuitonWebVersion>1.17-SNAPSHOT</nuitonWebVersion>
--
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 b4694b38abfa84ae7ded37198b63e6b351061976
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 4 15:21:46 2014 +0200
Change the title based on the current page
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 15 +++++--
pollen-ui-angular/src/main/webapp/i18n/fr.js | 19 ++++++---
pollen-ui-angular/src/main/webapp/index.html | 7 ++--
pollen-ui-angular/src/main/webapp/js/app.js | 2 +-
.../main/webapp/js/controllers/favoriteListCtrl.js | 6 ++-
.../src/main/webapp/js/controllers/mainCtrl.js | 8 ++++
.../src/main/webapp/js/controllers/pollCtrl.js | 47 +++++++++++++++-------
.../src/main/webapp/js/controllers/userCtrl.js | 24 +++++++----
pollen-ui-angular/src/main/webapp/js/directives.js | 33 +++++++++++++++
.../src/main/webapp/partials/poll-comment.html | 2 +-
.../src/main/webapp/partials/user-edit.html | 2 +-
.../main/webapp/partials/user-lostPassword.html | 2 +-
.../src/main/webapp/partials/user-register.html | 2 +-
13 files changed, 126 insertions(+), 43 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index e4643f8..38d01f0 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -1,9 +1,16 @@
var translateEN = {
-'title.forgotPassword' : 'Forget Password',
-'title.register' : 'Register',
-'title.editUser' : 'Edit Profile',
-'title.comment' : 'Comment',
+'title.home' : 'Home',
+'title.poll.create' : 'Create new poll',
+'title.poll.edit' : 'Edit poll',
+'title.poll.vote' : 'Vote',
+'title.poll.comment' : 'Comment',
+'title.poll.result' : 'Result of poll',
+'title.poll.list' : 'List of poll',
+'title.user.register' : 'Register',
+'title.user.edit' : 'Edit Profile',
+'title.user.forgotPassword' : 'Forget Password',
+'title.user.list' : 'List of user',
'newPoll' : 'New Poll',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index d6c1c7c..85aab6a 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -1,9 +1,16 @@
var translateFR = {
-'title.forgotPassword' : 'Récupération du Mot de Passe',
-'title.register' : 'Inscription',
-'title.editUser' : 'Modification de votre profile',
-'title.comment' : 'Laisser un Commentaire',
+'title.home' : 'Accueil',
+'title.poll.create' : 'Création d\'un nouveau sondage',
+'title.poll.edit' : 'Edition du sondage',
+'title.poll.vote' : 'Voter',
+'title.poll.comment' : 'Laisser un Commentaire',
+'title.poll.result' : 'Résultat du sondage',
+'title.poll.list' : 'Liste des sondages',
+'title.user.register' : 'Inscription',
+'title.user.edit' : 'Modification de votre profile',
+'title.user.forgotPassword' : 'Récupération du Mot de Passe',
+'title.user.list' : 'Liste des utilisateurs',
'newPoll' : 'Nouveau Sondage',
@@ -49,14 +56,14 @@ var translateFR = {
'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.close' : 'Clore les votes du sondage',
'poll.link.delete' : 'Supprimer le sondage',
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
'poll.saved' : 'Sondage sauvegardé',
'poll.cloned' : 'Sondage cloné',
-'poll.closed' : 'Sondage fermé',
+'poll.closed' : 'Sondage clos',
'poll.deleted' : 'Sondage supprimé',
'poll.restricted.name' : 'Nom du votant',
'poll.restricted.mail' : 'Courriel du votant',
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index a995313..34ec952 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -19,9 +19,9 @@
#L%
-->
-<html ng-app="pollen">
+<html ng-app="pollen" ng-controller="MainCtrl">
<head>
- <title>Pollen</title>
+ <title>{{ title || "Pollen" }}</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="lib/bootstrap/dist/css/bootstrap.min.css" />
@@ -41,7 +41,7 @@
<script language="javascript" type="text/javascript" src="lib/jqplot/jquery.jqplot.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.barRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
- <script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"> </script>
+ <script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.pointLabels.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.highlighter.min.js"></script>
@@ -57,6 +57,7 @@
<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/mainCtrl.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>
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 8c3d08f..28ff905 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'alertControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
+var pollen = angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'alertControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
.config(['$httpProvider', function($httpProvider) {
// edit header for locale and sessionToken
$httpProvider.interceptors.push('httpInterceptor');
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
index b531a7a..932e82c 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
@@ -19,10 +19,12 @@
* #L%
*/
angular.module('favoriteListControllers', [])
-.controller('FavoriteListCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams',
- function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams) {
+.controller('FavoriteListCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', 'Page',
+ function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, Page) {
$scope.data = {};
+ Page.setTitle('user.favoriteList');
+
var paginationParameter = {pageSize: conf.favoriteListDefaultPageSize};
if (angular.isUndefined(paginationParameter.pageSize)) {
paginationParameter.pageSize = -1;
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
new file mode 100644
index 0000000..d0ccb2a
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
@@ -0,0 +1,8 @@
+pollen.controller('MainCtrl', ['$scope', 'Page',
+ function ($scope, Page) {
+
+ $scope.$on('titleChange', function () {
+ $scope.title = Page.title();
+ })
+}])
+
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 e050af6..a7ec70c 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -19,13 +19,14 @@
* #L%
*/
angular.module('pollControllers', [])
-.controller('HomeCtrl', ['$scope', 'Poll', function ($scope, Poll) {
+.controller('HomeCtrl', ['$scope', 'Poll', 'Page', function ($scope, Poll, Page) {
+ Page.setTitle('title.home');
Poll.skeletonNew();
}])
.controller('PollCtrl',
- ['$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', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll', 'Page',
+ function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, Page) {
$scope.setTab = function (defaultValue) {
if (angular.isDefined($routeParams.tab)) {
return $routeParams.tab;
@@ -215,6 +216,10 @@ angular.module('pollControllers', [])
});
}
})
+
+ $scope.$watch('data.poll.title', function (newVal) {
+ Page.setValue($scope.data.poll.title);
+ });
});
$scope.voteCountingIsBoolean = function () {
@@ -452,10 +457,12 @@ angular.module('pollControllers', [])
});
}])
-.controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList',
- function ( $scope, $rootScope, $controller, $location, Poll, SessionStorage, PollVoterList) {
+.controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList', 'Page',
+ function ( $scope, $rootScope, $controller, $location, Poll, SessionStorage, PollVoterList, Page) {
$controller('PollAdminCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.create');
+
$scope.globalVariables.create = true;
var initPoll = function () {
@@ -520,10 +527,12 @@ angular.module('pollControllers', [])
}])
-.controller('PollEditCtrl', ['$scope', '$rootScope', '$controller', '$routeParams', '$location', '$timeout', '$translate', 'Poll', 'PollChoice', 'PollVote', 'PollVoterList', 'PollVoterListMember', 'FavoriteList', 'SessionStorage',
- function ( $scope, $rootScope, $controller, $routeParams, $location, $timeout, $translate, Poll, PollChoice, PollVote, PollVoterList, PollVoterListMember, FavoriteList, SessionStorage) {
+.controller('PollEditCtrl', ['$scope', '$rootScope', '$controller', '$routeParams', '$location', '$timeout', '$translate', 'Poll', 'PollChoice', 'PollVote', 'PollVoterList', 'PollVoterListMember', 'FavoriteList', 'SessionStorage', 'Page',
+ function ( $scope, $rootScope, $controller, $routeParams, $location, $timeout, $translate, Poll, PollChoice, PollVote, PollVoterList, PollVoterListMember, FavoriteList, SessionStorage, Page) {
$controller('PollAdminCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.edit');
+
$scope.globalVariables.edit = true;
////////////////////////////////
@@ -866,10 +875,12 @@ angular.module('pollControllers', [])
}])
-.controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$location',
- function ($scope, $rootScope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $location) {
+.controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$location', 'Page',
+ function ($scope, $rootScope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $location, Page) {
$controller('PollCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.vote');
+
$scope.tab = $scope.setTab('vote');
var initPoll = function () {
@@ -1000,10 +1011,12 @@ angular.module('pollControllers', [])
}])
.controller('PollCommentCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$location',
- function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $location) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$location', 'Page',
+ function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $location, Page) {
$controller('PollCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.comment');
+
if (angular.isDefined($routeParams.commentToken)) {
$scope.commentToken = $routeParams.commentToken;
}
@@ -1151,10 +1164,12 @@ angular.module('pollControllers', [])
}])
-.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter',
- function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter) {
+.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', 'Page',
+ function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, Page) {
$controller('PollCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.result');
+
$scope.translateTitle = {
'0' : "{{ 'poll.result.title.zero' | translate }}",
'one' : "{{ 'poll.result.title.one' | translate }}",
@@ -1222,10 +1237,12 @@ angular.module('pollControllers', [])
}])
.controller('PollListCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll',
- function ($scope, $rootScope, $controller, $routeParams, $location, Poll) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll', 'Page',
+ function ($scope, $rootScope, $controller, $routeParams, $location, Poll, Page) {
$scope.data = {};
+ Page.setTitle('title.poll.list');
+
if (angular.isDefined(conf.pollDefaultPageSize)) {
$scope.pageSize = conf.pollDefaultPageSize;
}
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
index 4935fad..a64dad8 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -19,8 +19,9 @@
* #L%
*/
angular.module('userControllers', [])
- .controller('UserRegisterCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage',
- function ($scope, $rootScope, $location, User, SessionStorage) {
+.controller('UserRegisterCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage', 'Page',
+ function ($scope, $rootScope, $location, User, SessionStorage, Page) {
+ Page.setTitle('title.user.register');
if (angular.isDefined(SessionStorage.get().user)) {
$rootScope.$broadcast('newError', 'user.error.logout.mandatory');
@@ -44,8 +45,10 @@
}
}])
-.controller('UserLostPasswordCtrl', ['$scope', '$rootScope', '$translate', '$location', 'SessionStorage', 'UserLostPassword',
- function ($scope, $rootScope, $translate, $location, SessionStorage, UserLostPassword) {
+.controller('UserLostPasswordCtrl', ['$scope', '$rootScope', '$translate', '$location', 'SessionStorage', 'UserLostPassword', 'Page',
+ function ($scope, $rootScope, $translate, $location, SessionStorage, UserLostPassword, Page) {
+ Page.setTitle('title.user.forgotPassword');
+
if (angular.isDefined(SessionStorage.get().user)) {
$rootScope.$broadcast('newError', 'user.error.logout.mandatory');
$location.url('/');
@@ -73,7 +76,10 @@
-.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', 'User', 'SessionStorage', function ($scope, $rootScope, $routeParams, $route, $location, User, SessionStorage) {
+.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', 'User', 'SessionStorage', 'Page',
+ function ($scope, $rootScope, $routeParams, $route, $location, User, SessionStorage, Page) {
+ Page.setTitle('title.user.edit');
+
if (angular.isUndefined($scope.data)) {
$scope.data = {user:{}};
}
@@ -108,8 +114,11 @@
}
}])
-.controller('UserListCtrl', ['$scope', '$routeParams', 'User',
- function ($scope, $routeParams, User) {
+.controller('UserListCtrl', ['$scope', '$routeParams', 'User', 'Page',
+ function ($scope, $routeParams, User, Page) {
+
+ Page.setTitle('title.user.list');
+
if (angular.isUndefined($scope.data)) {
$scope.data = {user:{}};
}
@@ -132,7 +141,6 @@
}
User.get({paginationParameter:paginationParameter}, function (data) {
- console.log(data);
$scope.data.users = data.elements;
$scope.data.usersPagination = data.pagination
});
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index ad58548..f3ef921 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -21,6 +21,39 @@
angular.module('pollenDirective', [])
//////////////////////////////////////
+///// PAGE /////
+//////////////////////////////////////
+
+.factory('Page', ['$rootScope', '$filter', function ($rootScope, $filter) {
+ var title = '';
+ var value;
+ return {
+ title : function () {
+ var makeTitle = "Pollen";
+ if (title != '') {
+ makeTitle += " - " + $filter('translate')(title);
+
+ }
+
+ if (value !== undefined) {
+ makeTitle += " - " + value;
+ }
+
+ return makeTitle;
+ },
+ setTitle: function(newTitle, newValue) {
+ title = newTitle;
+ value = newValue;
+ $rootScope.$broadcast('titleChange');
+ },
+ setValue: function(newValue) {
+ value = newValue;
+ $rootScope.$broadcast('titleChange');
+ }
+ };
+}])
+
+//////////////////////////////////////
///// FOCUS ME /////
//////////////////////////////////////
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 a584ca5..841eb54 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -20,7 +20,7 @@
-->
<div>
<h1>{{ data.poll.title }}</h1>
- <h2>{{ 'title.comment' | translate }}</h2>
+ <h2>{{ 'title.poll.comment' | translate }}</h2>
<!-- begin for add comment -->
<form class="form-horizontal" ng-submit="postComment()" novalidate>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-edit.html b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
index 765d96e..1d75891 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-edit.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<h2> {{ 'title.editUser' | translate }} </h2>
+<h2> {{ 'title.user.edit' | translate }} </h2>
<form class="horizontal-form" ng-submit="editUser()">
<div class="control-group">
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html b/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
index dd28daa..d1bb5f5 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<h2>{{ 'title.forgotPassword' | translate }}</h2>
+<h2>{{ 'title.user.forgotPassword' | translate }}</h2>
<form ng-submit="submit()" class="form-horizontal">
<div class="control-group">
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-register.html b/pollen-ui-angular/src/main/webapp/partials/user-register.html
index ea75471..b9e5c36 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-register.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-register.html
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<h2>{{ 'title.register' | translate }}</h2>
+<h2>{{ 'title.user.register' | translate }}</h2>
<form ng-submit="submit()" class="form-horizontal">
<div class="control-group">
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
04 Jul '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 47449ac9d41fa45daf13a09c36a57433081ce176
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 4 10:43:07 2014 +0200
change findByTopiaId() by forTopiaIdEquals().findUnique()
---
.../java/org/chorem/pollen/services/service/ChoiceService.java | 2 +-
.../java/org/chorem/pollen/services/service/CommentService.java | 4 ++--
.../org/chorem/pollen/services/service/FavoriteListService.java | 4 ++--
.../main/java/org/chorem/pollen/services/service/PollService.java | 2 +-
.../java/org/chorem/pollen/services/service/PollenUserService.java | 2 +-
.../main/java/org/chorem/pollen/services/service/VoteService.java | 6 +++---
.../java/org/chorem/pollen/services/service/VoterListService.java | 4 ++--
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 ++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 4 ++--
9 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index 1d97812..72852b0 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -184,7 +184,7 @@ public class ChoiceService extends PollenServiceSupport {
protected Choice getChoice(Poll poll, String choiceId) {
- Choice result = getChoiceDao().findByTopiaId(choiceId);
+ Choice result = getChoiceDao().forTopiaIdEquals(choiceId).findUnique();
if (!poll.equals(result.getPoll())) {
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 5ecf45b..c9437d2 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
@@ -146,7 +146,7 @@ public class CommentService extends PollenServiceSupport {
protected Comment getComment(Poll poll, String commentId) {
- Comment result = getCommentDao().findByTopiaId(commentId);
+ Comment result = getCommentDao().forTopiaIdEquals(commentId).findUnique();
if (!poll.equals(result.getPoll())) {
@@ -177,7 +177,7 @@ public class CommentService extends PollenServiceSupport {
if (commentExists) {
- toSave = getCommentDao().findByTopiaId(comment.getEntityId());
+ toSave = getCommentDao().forTopiaIdEquals(comment.getEntityId()).findUnique();
} else {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
index 0e3e8a6..503e32e 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
@@ -290,7 +290,7 @@ public class FavoriteListService extends PollenServiceSupport {
protected FavoriteList getFavoriteList0(PollenUser user, String favoriteListId) {
- FavoriteList result = getFavoriteListDao().findByTopiaId(favoriteListId);
+ FavoriteList result = getFavoriteListDao().forTopiaIdEquals(favoriteListId).findUnique();
if (!user.equals(result.getPollenUser())) {
@@ -311,7 +311,7 @@ public class FavoriteListService extends PollenServiceSupport {
protected FavoriteListMember getFavoriteListMember0(FavoriteList favoriteList, String memberId) {
- FavoriteListMember result = getFavoriteListMemberDao().findByTopiaId(memberId);
+ FavoriteListMember result = getFavoriteListMemberDao().forTopiaIdEquals(memberId).findUnique();
if (!favoriteList.equals(result.getFavoriteList())) {
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 e35d911..6261e08 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
@@ -374,7 +374,7 @@ public class PollService extends PollenServiceSupport {
protected Poll getPoll0(String pollId) {
- return getPollDao().findByTopiaId(pollId);
+ return getPollDao().forTopiaIdEquals(pollId).findUnique();
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
index 4191c45..484d3c9 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
@@ -309,7 +309,7 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer
protected PollenUser getUser0(String userId) {
- PollenUser pollenUser = getPollenUserDao().findByTopiaId(userId);
+ PollenUser pollenUser = getPollenUserDao().forTopiaIdEquals(userId).findUnique();
return pollenUser;
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
index dad35e2..2acc2ad 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
@@ -271,7 +271,7 @@ public class VoteService extends PollenServiceSupport {
protected Vote getVote(Poll poll, String voteId) {
- Vote result = getVoteDao().findByTopiaId(voteId);
+ Vote result = getVoteDao().forTopiaIdEquals(voteId).findUnique();
if (!poll.equals(result.getPoll())) {
@@ -292,7 +292,7 @@ public class VoteService extends PollenServiceSupport {
protected VoteToChoice getVoteToChoice(Vote vote, String voteToChoiceId) {
- VoteToChoice result = getVoteToChoiceDao().findByTopiaId(voteToChoiceId);
+ VoteToChoice result = getVoteToChoiceDao().forTopiaIdEquals(voteToChoiceId).findUnique();
if (!vote.containsVoteToChoice(result)) {
@@ -321,7 +321,7 @@ public class VoteService extends PollenServiceSupport {
String choiceId = source.getChoiceId().getEntityId();
- Choice choiceLoaded = getChoiceDao().findByTopiaId(choiceId);
+ Choice choiceLoaded = getChoiceDao().forTopiaIdEquals(choiceId).findUnique();
result.setChoice(choiceLoaded);
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
index 4fc2f9c..327b8af 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
@@ -333,7 +333,7 @@ public class VoterListService extends PollenServiceSupport {
protected VoterList getVoterList0(Poll poll, String voterListId) {
- VoterList result = getVoterListDao().findByTopiaId(voterListId);
+ VoterList result = getVoterListDao().forTopiaIdEquals(voterListId).findUnique();
if (!poll.equals(result.getPoll())) {
@@ -366,7 +366,7 @@ public class VoterListService extends PollenServiceSupport {
protected VoterListMember getVoterListMember0(VoterList voterList, String memberId) {
- VoterListMember result = getVoterListMemberDao().findByTopiaId(memberId);
+ VoterListMember result = getVoterListMemberDao().forTopiaIdEquals(memberId).findUnique();
if (!voterList.equals(result.getVoterList())) {
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 dd4bbef..e050af6 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -115,7 +115,12 @@ angular.module('pollControllers', [])
})
pollDeferred.promise.then(function () {
- var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
+ var baseUrl = window.location.protocol+'//'+window.location.hostname;
+ if (window.location.port != "") {
+ baseUrl += ':'+window.location.port;
+ }
+ baseUrl += window.location.pathname;
+
$scope.globalVariables.baseUrl = baseUrl;
$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
index 13d64d0..8f39e9b 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -311,7 +311,7 @@
color: @danger-color;
transition-duration:@short-time-transition;
- &:hover {
+ &:hover, &:focus {
color: @danger-hover-color;
transition-duration:@short-time-transition;
}
@@ -320,7 +320,7 @@
a {
transition-duration:@short-time-transition;
- &:hover {
+ &:hover, &:focus {
transition-duration:@short-time-transition;
}
}
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0