Pollen-commits
Threads by month
- ----- 2026 -----
- August
- July
- 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
- 109 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 e5d2a42e3e907596df2d796cb382d929724e39a0
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 17 17:57:39 2014 +0200
add license
---
.../src/main/webapp/js/controllers/mainCtrl.js | 20 ++++++++++++
pollen-ui-angular/src/main/webapp/less/style.less | 21 ++++++++++++
.../src/main/webapp/less/variables.less | 21 ++++++++++++
.../src/main/webapp/partials/big-poll.html | 38 ++++++++++------------
.../main/webapp/partials/favoriteList-edit.html | 21 ++++++++++++
.../main/webapp/partials/favoriteList-list.html | 21 ++++++++++++
.../src/main/webapp/partials/home.html | 1 +
.../src/main/webapp/partials/inline-poll.html | 38 ++++++++++------------
.../src/main/webapp/partials/poll-list.html | 20 ++++++++++++
.../src/main/webapp/partials/poll-result.html | 21 ++++++++++++
.../src/main/webapp/partials/user-list.html | 20 ++++++++++++
.../src/main/webapp/partials/user-login.html | 21 ++++++++++++
12 files changed, 223 insertions(+), 40 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
index 38d47af..0e9ba5e 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Pollen :: UI (Angular)
+ * %%
+ * Copyright (C) 2009 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
'use strict';
angular.module('PollenMainControllers', ['pollenServices']).controller('MainCtrl', ['$scope', 'Page',
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 1aa0d5a..97829fe 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -1,3 +1,24 @@
+/*
+ * #%L
+ * Pollen :: UI (Angular)
+ * %%
+ * Copyright (C) 2009 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
@import "variables.less";
#pollenMenu {
diff --git a/pollen-ui-angular/src/main/webapp/less/variables.less b/pollen-ui-angular/src/main/webapp/less/variables.less
index 18b3ea0..77ce45a 100644
--- a/pollen-ui-angular/src/main/webapp/less/variables.less
+++ b/pollen-ui-angular/src/main/webapp/less/variables.less
@@ -1,3 +1,24 @@
+/*
+ * #%L
+ * Pollen :: UI (Angular)
+ * %%
+ * Copyright (C) 2009 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
@import "../lib/bootstrap/less/variables.less";
@time-transition : 0.8s;
diff --git a/pollen-ui-angular/src/main/webapp/partials/big-poll.html b/pollen-ui-angular/src/main/webapp/partials/big-poll.html
index 9dc5c09..bdb698f 100644
--- a/pollen-ui-angular/src/main/webapp/partials/big-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/big-poll.html
@@ -1,24 +1,22 @@
<!--
- ~
- ~ #%L
- ~ Pollen :: UI (Angular)
- ~ %%
- ~ Copyright (C) 2009 - 2014 CodeLutin
- ~ %%
- ~ This program is free software: you can redistribute it and/or modify
- ~ it under the terms of the GNU Affero General Public License as published by
- ~ the Free Software Foundation, either version 3 of the License, or
- ~ (at your option) any later version.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ~ GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Affero General Public License
- ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
- ~ #L%
- ~
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
-->
<div ng-repeat="choice in data.choices" class="row pollBigChoice">
diff --git a/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html b/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html
index 47f66fa..0e9e581 100644
--- a/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html
+++ b/pollen-ui-angular/src/main/webapp/partials/favoriteList-edit.html
@@ -1,3 +1,24 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+
<h1> {{ 'user.favoriteList' | translate }} </h1>
<div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/favoriteList-list.html b/pollen-ui-angular/src/main/webapp/partials/favoriteList-list.html
index 8d87f3d..3995423 100644
--- a/pollen-ui-angular/src/main/webapp/partials/favoriteList-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/favoriteList-list.html
@@ -1,3 +1,24 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+
<h1> {{ 'user.favoriteList' | translate }} </h1>
<div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/home.html b/pollen-ui-angular/src/main/webapp/partials/home.html
index 846d330..54b879a 100644
--- a/pollen-ui-angular/src/main/webapp/partials/home.html
+++ b/pollen-ui-angular/src/main/webapp/partials/home.html
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
+
<div>
<img src="img/pollen.png"/>
</div>
\ 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 f42f38f..4290225 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -1,24 +1,22 @@
<!--
- ~
- ~ #%L
- ~ Pollen :: UI (Angular)
- ~ %%
- ~ Copyright (C) 2009 - 2014 CodeLutin
- ~ %%
- ~ This program is free software: you can redistribute it and/or modify
- ~ it under the terms of the GNU Affero General Public License as published by
- ~ the Free Software Foundation, either version 3 of the License, or
- ~ (at your option) any later version.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ~ GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Affero General Public License
- ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
- ~ #L%
- ~
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
-->
<table id="poll-inline">
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-list.html b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
index 1d61471..6217c3c 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
@@ -1,3 +1,23 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
<div ng-if="!data.polls[0]"><h1>{{ 'poll.error.listEmpty' | translate }}</h1></div>
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 3f8a503..9e69c58 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-result.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
@@ -1,3 +1,24 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+
<h1>{{data.poll.title}}</h1>
<h2> <ng-pluralize count="data.result.nbVotant" when="translateTitle"></ng-pluralize> </h2>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-list.html b/pollen-ui-angular/src/main/webapp/partials/user-list.html
index 02867b7..c605945 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-list.html
@@ -1,3 +1,23 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
<div ng-if="!data.users[0]"><h1>{{ 'user.error.listEmpty' | translate }}</h1></div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-login.html b/pollen-ui-angular/src/main/webapp/partials/user-login.html
index e3c18fa..9745533 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-login.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-login.html
@@ -1,3 +1,24 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+
<form id='loginForm' ng-submit="login()">
<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
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 65cd880fe6177531cb580d5b2c28b6628ff87940
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 17 17:21:41 2014 +0200
add defaut case in choicetype
---
.../chorem/pollen/services/bean/ChoiceBean.java | 24 ++++++++++------------
.../pollen/services/service/ChoiceService.java | 18 +++++++---------
2 files changed, 18 insertions(+), 24 deletions(-)
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 40e8691..aa0bf6b 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
@@ -61,20 +61,19 @@ public class ChoiceBean extends PollenBean<Choice> {
}
+
+ //TODO agarandel 17/07/14 : review code : is switch case required
switch (entity.getChoiceType()) {
case TEXT:
- setChoiceValue(entity.getChoiceValue());
- break;
-
case DATE:
- setChoiceValue(entity.getChoiceValue());
- break;
-
case IMAGE:
setChoiceValue(entity.getChoiceValue());
break;
+
+ default:
+ throw new UnsupportedOperationException("Unexpected value : " + entity.getChoiceType());
}
setDescription(entity.getDescription());
@@ -92,6 +91,8 @@ public class ChoiceBean extends PollenBean<Choice> {
ChoiceType choiceType = getChoiceType();
if (choiceType != null) {
+
+ //TODO agarandel 17/07/14 : review code : is switch case required
switch (choiceType) {
case TEXT:
entity.setChoiceValue(getChoiceValue());
@@ -99,19 +100,16 @@ public class ChoiceBean extends PollenBean<Choice> {
break;
case DATE:
- if ( getChoiceValue() != null ) {
- entity.setChoiceValue(getChoiceValue());
- }
-
- break;
-
case IMAGE:
if ( getChoiceValue() != null ) {
- entity.setChoiceValue(getChoiceValue());
+ entity.setChoiceValue(getChoiceValue());
}
break;
+
+ default:
+ throw new UnsupportedOperationException("Unexpected value : " + choiceType);
}
}
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 90a2dd2..268a212 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
@@ -28,10 +28,8 @@ import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.chorem.pollen.persistence.entity.*;
import org.chorem.pollen.services.bean.ChoiceBean;
-import org.chorem.pollen.services.bean.PollenEntityId;
import org.chorem.pollen.services.bean.PollenEntityRef;
import org.chorem.pollen.services.service.security.PermissionVerb;
-import org.nuiton.topia.persistence.TopiaIdFactory;
import java.util.ArrayList;
import java.util.Date;
@@ -238,23 +236,18 @@ public class ChoiceService extends PollenServiceSupport {
toSave.setChoiceType(choice.getChoiceType());
+ //TODO agarandel 17/07/14 : review code : is switch case required
switch (toSave.getChoiceType()) {
case TEXT:
-
- toSave.setChoiceValue(choice.getChoiceValue());
-
- break;
-
case DATE:
+ case IMAGE:
toSave.setChoiceValue(choice.getChoiceValue());
-
break;
- case IMAGE:
-
- toSave.setChoiceValue(choice.getChoiceValue());
+ default:
+ throw new UnsupportedOperationException("Unexpected value : " + toSave.getChoiceType());
}
@@ -357,6 +350,9 @@ public class ChoiceService extends PollenServiceSupport {
break;
+ default:
+ throw new UnsupportedOperationException("Unexpected value : " + choice.getChoiceType());
+
}
}
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 17, 2014
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 77cdc92bdb9b7f884640e017b64b8ddc15ed3143
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 17 14:58:57 2014 +0200
choice service : new check when choiceType equal 'IMAGE'
---
.../pollen/services/service/ChoiceService.java | 52 ++++++++++++++--------
.../services/service/PollenResourceService.java | 14 ++++--
.../i18n/pollen-services_en_GB.properties | 2 +
.../i18n/pollen-services_fr_FR.properties | 2 +
.../src/main/webapp/js/controllers/pollCtrl.js | 3 ++
pollen-ui-angular/src/main/webapp/js/directives.js | 5 ++-
6 files changed, 54 insertions(+), 24 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 db64ec1..90a2dd2 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
@@ -33,6 +33,7 @@ import org.chorem.pollen.services.bean.PollenEntityRef;
import org.chorem.pollen.services.service.security.PermissionVerb;
import org.nuiton.topia.persistence.TopiaIdFactory;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -174,12 +175,7 @@ public class ChoiceService extends PollenServiceSupport {
if (choice.getChoiceType() == ChoiceType.IMAGE) {
- PollenEntityId<PollenResource> resourceId = PollenEntityId.newId(PollenResource.class);
- resourceId.setReducedId(choice.getChoiceValue());
- TopiaIdFactory topiaIdFactory = serviceContext.getTopiaApplicationContext().getTopiaIdFactory();
- resourceId.decode(topiaIdFactory);
-
- PollenResource resource = getResourceService().getResource0(resourceId.getEntityId());
+ PollenResource resource = getResourceService().getResourceByShortId(choice.getChoiceValue());
getPollenResourceDao().delete(resource);
}
@@ -317,19 +313,16 @@ public class ChoiceService extends PollenServiceSupport {
break;
case DATE:
- Date choiceDate = new Date(Long.parseLong(choice.getChoiceValue()));
-
- boolean dateNotBlank;
- if (choiceDate == null) {
- dateNotBlank = checkNotBlank(errors, "choiceValue", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
- }
- else {
- dateNotBlank = checkNotBlank(errors,
- "choiceValue",
- String.valueOf(choiceDate),
- l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
+ Date choiceDate = null;
+ if (choice.getChoiceValue() != null) {
+ choiceDate = new Date(Long.parseLong(choice.getChoiceValue()));
}
+ boolean dateNotBlank = checkNotBlank(errors,
+ "choiceValue",
+ String.valueOf(choiceDate),
+ l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
+
if (dateNotBlank) {
boolean dateAdded = choiceNames.add(String.valueOf(choiceDate.getTime()));
check(errors, "choiceValue", dateAdded, l(getLocale(), "pollen.error.choice.choiceDateExist"));
@@ -338,7 +331,30 @@ public class ChoiceService extends PollenServiceSupport {
break;
case IMAGE:
- // TODO : verify picture
+
+ PollenResource resource = getResourceService().getResourceByShortId(choice.getChoiceValue());
+
+ boolean resourceExist = checkNotBlank(errors,
+ "choiceValue",
+ resource.getName(),
+ l(getLocale(), "pollen.error.image.notExist"));
+
+ if (resourceExist) {
+ List<String> contentTypeAccepted = new ArrayList<>();
+ contentTypeAccepted.add("image/bmp");
+ contentTypeAccepted.add("image/gif");
+ contentTypeAccepted.add("image/jpeg");
+ contentTypeAccepted.add("image/png");
+ contentTypeAccepted.add("image/vnd.microsoft.icon");
+
+ boolean isImage = contentTypeAccepted.contains(resource.getContentType());
+
+ check(errors,
+ "choiceValue",
+ isImage,
+ l(getLocale(), "pollen.error.image.badFormat"));
+ }
+
break;
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java
index 0fae9bb..c4f296e 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java
@@ -2,10 +2,8 @@ package org.chorem.pollen.services.service;
import org.chorem.pollen.persistence.entity.PollenResource;
import org.chorem.pollen.services.PollenService;
-import org.chorem.pollen.services.bean.PollenEntityRef;
-import org.chorem.pollen.services.bean.ResourceFileBean;
-import org.chorem.pollen.services.bean.ResourceMetaBean;
-import org.chorem.pollen.services.bean.ResourceStreamBean;
+import org.chorem.pollen.services.bean.*;
+import org.nuiton.topia.persistence.TopiaIdFactory;
import java.io.IOException;
import java.sql.SQLException;
@@ -103,4 +101,12 @@ public class PollenResourceService extends PollenServiceSupport implements Polle
return toSave;
}
+ public PollenResource getResourceByShortId(String shortId) {
+ PollenEntityId<PollenResource> resourceId = PollenEntityId.newId(PollenResource.class);
+ resourceId.setReducedId(shortId);
+ TopiaIdFactory topiaIdFactory = serviceContext.getTopiaApplicationContext().getTopiaIdFactory();
+ resourceId.decode(topiaIdFactory);
+
+ return getResource0(resourceId.getEntityId());
+ }
}
diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties
index 2ec870f..ba4905e 100644
--- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties
+++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties
@@ -29,6 +29,8 @@ pollen.error.favoriteListMember.email.empty=member email can not be empty
pollen.error.favoriteListMember.email.invalid=member email is not valid
pollen.error.favoriteListMember.name.already.used=member name already used
pollen.error.favoriteListMember.name.empty=member name can not be empty
+pollen.error.image.badFormat=Your Image is in bad format
+pollen.error.image.notExist=Image don't exist
pollen.error.poll.choice.mandatory=At least a choice is mandatory
pollen.error.poll.commentVisibility.mandatory=comment visiblity is mandatory
pollen.error.poll.mismatch.freePoll=cant' have a voter list for a free poll
diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties
index 2685800..b37f11a 100644
--- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties
+++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties
@@ -29,6 +29,8 @@ pollen.error.favoriteListMember.email.empty=Le courriel est obligatoire
pollen.error.favoriteListMember.email.invalid=Le courriel du membre est invalide
pollen.error.favoriteListMember.name.already.used=Le nom du membre est déjà utilisé dans cette liste
pollen.error.favoriteListMember.name.empty=Le nom du membre est obligatoire
+pollen.error.image.badFormat=L'image n'est pas du bon format
+pollen.error.image.notExist=L'image n'existe pas sur le serveur
pollen.error.poll.choice.mandatory=Au moins un choix est nécessaire
pollen.error.poll.commentVisibility.mandatory=la visibilité des commentaires est obligatoire
pollen.error.poll.pollType.mandatory=le type de sondage est obligatoire
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 a59d583..95d2ed9 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -581,6 +581,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
if (angular.isDefined(error.data['choice['+index+'].choiceValue'])) {
choice.restError = {choiceValue:error.data['choice['+index+'].choiceValue']};
}
+ else {
+ delete choice.restError;
+ }
});
if (angular.isDefined(error.data.choice)) {
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index 478f369..d1c4c01 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -420,13 +420,14 @@ angular.module('pollenDirective', [])
reader.onload = function (loadEvent) {
var formData = new FormData(element[0].firstChild);
scope.$apply(function () {
- scope.ngModel = { meta: changeEvent.target.files[0], data: loadEvent.target.result};
+ scope.ngModel = { meta: changeEvent.target.files[0] };
});
PollenResource.upload(formData, function (response) {
scope.ngModel.meta.id = response.id;
+ scope.ngModel.id = response.id;
+ scope.ngModel.data = conf.restURL+'/resources/'+response.id;
});
-
}
reader.readAsDataURL( changeEvent.target.files[0] );
});
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
01/02: pom : test karma use maven varible for ignore failure test or skip test
by chorem.org scm July 17, 2014
by chorem.org scm July 17, 2014
July 17, 2014
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 56e9dba6125919f44bb02ef39cdd201e8e34b0bb
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 17 14:36:22 2014 +0200
pom : test karma use maven varible for ignore failure test or skip test
---
pollen-ui-angular/pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index fc9732f..5f53bc8 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -101,9 +101,9 @@
<autoWatch>false</autoWatch>
<singleRun>true</singleRun>
<colors>true</colors>
- <skipKarma>false</skipKarma>
- <skipTests>false</skipTests>
- <karmaFailureIgnore>false</karmaFailureIgnore>
+ <skipKarma>${maven.test.skip}</skipKarma>
+ <skipTests>${maven.test.skip}</skipTests>
+ <karmaFailureIgnore>${maven.test.failure.ignore}</karmaFailureIgnore>
<reporters>dots,junit</reporters>
</configuration>
</plugin>
--
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 df336c121deeaeb1853af174500b95da7e167f26
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 17 10:08:08 2014 +0200
fix install npm + use local node modules
---
pollen-ui-angular/.gitignore | 1 -
pollen-ui-angular/pom.xml | 3 +--
pollen-ui-angular/src/test/karma.conf.js | 2 +-
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/pollen-ui-angular/.gitignore b/pollen-ui-angular/.gitignore
index 1c7c2ba..09447a5 100644
--- a/pollen-ui-angular/.gitignore
+++ b/pollen-ui-angular/.gitignore
@@ -1,6 +1,5 @@
*.iml
node_modules/*
-test_out/*
src/main/webapp/lib
src/main/webapp/css/style.css
src/main/webapp/js/conf.js
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index f224a33..fc9732f 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -49,7 +49,7 @@
<goal>exec</goal>
</goals>
<configuration>
- <executable>bower</executable>
+ <executable>${basedir}/node_modules/bower/bin/bower</executable>
<arguments>
<argument>install</argument>
</arguments>
@@ -96,7 +96,6 @@
<configuration>
<karmaExecutable>${basedir}/node_modules/karma/bin/karma</karmaExecutable>
<configFile>src/test/karma.conf.js</configFile>
- <junitReportFile>target/test-results.xml</junitReportFile>
<reportsDirectory>${project.build.directory}/karma-reports</reportsDirectory>
<browsers>PhantomJS</browsers>
<autoWatch>false</autoWatch>
diff --git a/pollen-ui-angular/src/test/karma.conf.js b/pollen-ui-angular/src/test/karma.conf.js
index 69eca3a..3959745 100644
--- a/pollen-ui-angular/src/test/karma.conf.js
+++ b/pollen-ui-angular/src/test/karma.conf.js
@@ -86,7 +86,7 @@ module.exports = function(config) {
],
junitReporter : {
- outputFile: 'test_out/unit.xml',
+ outputFile: 'target/karma-reports/unit.xml',
suite: 'unit'
},
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
01/01: classic form for poll-setting and translate poll-setting and align on ':' in i18n/*.js
by chorem.org scm July 16, 2014
by chorem.org scm July 16, 2014
July 16, 2014
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 feb2a4820335e86c0171331a31f9071602b53b5a
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 16 17:41:05 2014 +0200
classic form for poll-setting and translate poll-setting and align on ':' in i18n/*.js
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 250 +++++++++++----------
pollen-ui-angular/src/main/webapp/i18n/fr.js | 249 ++++++++++----------
pollen-ui-angular/src/main/webapp/less/style.less | 4 +
.../src/main/webapp/partials/poll-settings.html | 186 ++++++++++-----
4 files changed, 401 insertions(+), 288 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 968332e..1dafd4f 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -1,119 +1,140 @@
var translateEN = {
-'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',
-
-'admin' : 'Administration',
-'admin.listPoll' : 'List of Polls',
-'admin.listUser' : 'List of Users',
-'admin.config' : 'Configuration',
-
-'user.edit' : 'Profile',
-'user.listPollCreated' : 'Created Poll',
-'user.listPollParticiped' : 'Participed Poll',
-'user.listPollInvited' : 'Invited Poll',
-
-'user.name' : 'Name',
-'user.mail' : 'e-mail',
-'user.password' : 'Password',
-'user.password2' : 'Confirm',
-'user.passwordNew' : 'New password',
-'user.passwordCurrent' : 'Current password',
-'user.rememberMe' : 'Remember Me',
-'user.forgotPassword' : 'Forgot Password',
-'user.register.success' : 'Register with success',
-'user.edit.success' : 'Save with success',
-'user.forgotPassword.success' : 'Password send by email',
-'user.favoriteList' : 'Favorite list',
-'user.error.password.diff' : 'Passwords not equal',
-'user.error.mail.notFound' : 'E-mail not found',
-'user.error.mail.empty' : 'E-mail can not be empty',
-'user.error.login' : 'Error in e-mail or password',
-'user.error.login.mandatory' : 'You must be connected',
-'user.error.logout.mandatory' : 'You must be disconnected',
-
-'poll.tab.vote' : 'Vote',
-'poll.tab.comment' : 'Comment',
-'poll.tab.result' : 'Result',
-'poll.tab.create' : 'Create',
-'poll.tab.edit' : 'Edit',
-'poll.tab.conf' : 'Configuration',
-'poll.tab.participant' : 'Participants',
-
-'poll.link.edit' : 'Edit poll',
-'poll.link.vote' : 'Vote',
-'poll.link.result' : 'Result of poll',
-'poll.link.clone' : 'Clone this poll',
-'poll.link.export' : 'Export this poll',
-'poll.link.close' : 'Close this poll',
-'poll.link.delete' : 'Delete this poll',
-
-'poll.edit' : 'Click to edit',
-'poll.desc' : 'Description is optional. This message will not visible in vote page.',
-'poll.saved' : 'Poll saved.',
-'poll.cloned' : 'Poll cloned',
-'poll.closed' : 'Poll closed',
-'poll.deleted' : 'Poll deleted',
-'poll.restricted.name' : 'Name',
-'poll.restricted.mail' : 'E-mail',
-'poll.restricted.weight' : 'Weight',
-'poll.restricted.free' : 'Free',
-'poll.restricted.restricted' : 'Restricted',
-'poll.restricted.group' : 'Group',
-'poll.restricted.pollType' : 'Who can vote ?',
-'poll.result.choice' : 'Choice',
-'poll.result.score' : 'Score',
-'poll.result.title.zero' : 'No result',
-'poll.result.title.one' : 'Result : One voter',
-'poll.result.title.other' : 'Result : {{nbVoter}} Voters',
-'poll.error.listEmpty' : 'No poll find',
-
-'vote.added' : 'Vote added.',
-
-'comment' : 'Comment',
-'comment.added' : 'Comment added.',
-'comment.order.toDesc' : 'Ordered by newer date',
-'comment.order.toAsc' : 'Ordered by older date',
-
-'action.logout' : 'Logout',
-'action.login' : 'Login',
-'action.register' : 'Register',
-'action.recovered' : 'Recovered',
-'action.send' : 'Send',
-'action.return' : 'Return',
-'action.cancel' : 'Cancel',
-'action.save' : 'Save',
-'action.edit' : 'Edit',
-'action.delete' : 'Delete',
-'action.vote' : 'Vote',
-'action.comment' : 'Comment',
-'action.restricted.addVoter' : 'Add a Voter',
-'action.restricted.deleteVoter' : 'Delete the Voter',
-'action.restricted.addGroup' : 'Add a Group',
-'action.restricted.deleteGroup' : 'Delete the Group',
-'action.restricted.notify' : 'Notify',
-'action.favoriteList.import.addGroup' : 'Import in new group',
-'action.favoriteList.import.inGroup' : 'Import in this group',
-'action.favoriteList.add' : 'Add favorite list',
-'action.favoriteList.delete' : 'Delete the favorite list',
-'action.favoriteList.addMember' : 'Add a member',
-'action.favoriteList.deleteMember' : 'Delete the member',
-
-'action.message.confirmDelete' : 'Are you sure to delete it?',
-'action.message.confirmClose' : 'Are you sure to close it?',
-
-'error.forbidden' : 'Access forbidden',
+'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',
+
+'admin' : 'Administration',
+'admin.listPoll' : 'List of Polls',
+'admin.listUser' : 'List of Users',
+'admin.config' : 'Configuration',
+
+'user.edit' : 'Profile',
+'user.listPollCreated' : 'Created Poll',
+'user.listPollParticiped' : 'Participed Poll',
+'user.listPollInvited' : 'Invited Poll',
+
+'user.name' : 'Name',
+'user.mail' : 'e-mail',
+'user.password' : 'Password',
+'user.password2' : 'Confirm',
+'user.passwordNew' : 'New password',
+'user.passwordCurrent' : 'Current password',
+'user.rememberMe' : 'Remember Me',
+'user.forgotPassword' : 'Forgot Password',
+'user.register.success' : 'Register with success',
+'user.edit.success' : 'Save with success',
+'user.forgotPassword.success' : 'Password send by email',
+'user.favoriteList' : 'Favorite list',
+'user.error.password.diff' : 'Passwords not equal',
+'user.error.mail.notFound' : 'E-mail not found',
+'user.error.mail.empty' : 'E-mail can not be empty',
+'user.error.login' : 'Error in e-mail or password',
+'user.error.login.mandatory' : 'You must be connected',
+'user.error.logout.mandatory' : 'You must be disconnected',
+
+'poll.tab.vote' : 'Vote',
+'poll.tab.comment' : 'Comment',
+'poll.tab.result' : 'Result',
+'poll.tab.create' : 'Create',
+'poll.tab.edit' : 'Edit',
+'poll.tab.conf' : 'Configuration',
+'poll.tab.participant' : 'Participants',
+
+'poll.link.edit' : 'Edit poll',
+'poll.link.vote' : 'Vote',
+'poll.link.result' : 'Result of poll',
+'poll.link.clone' : 'Clone this poll',
+'poll.link.export' : 'Export this poll',
+'poll.link.close' : 'Close this poll',
+'poll.link.delete' : 'Delete this poll',
+
+'poll.edit' : 'Click to edit',
+'poll.desc' : 'Description is optional. This message will not visible in vote page.',
+'poll.saved' : 'Poll saved.',
+'poll.cloned' : 'Poll cloned',
+'poll.closed' : 'Poll closed',
+'poll.deleted' : 'Poll deleted',
+'poll.restricted.name' : 'Name',
+'poll.restricted.mail' : 'E-mail',
+'poll.restricted.weight' : 'Weight',
+'poll.restricted.free' : 'Free',
+'poll.restricted.restricted' : 'Restricted',
+'poll.restricted.group' : 'Group',
+'poll.restricted.pollType' : 'Who can vote ?',
+'poll.result.choice' : 'Choice',
+'poll.result.score' : 'Score',
+'poll.result.title.zero' : 'No result',
+'poll.result.title.one' : 'Result : One voter',
+'poll.result.title.other' : 'Result : {{nbVoter}} Voters',
+'poll.config.title.poll' : 'Global config',
+'poll.config.title.choice' : 'Choice config',
+'poll.config.title.vote' : 'Vote config',
+'poll.config.label.beginDate' : 'Begin date',
+'poll.config.label.endDate' : 'End date',
+'poll.config.label.resultVisibility' : 'Result visibility',
+'poll.config.label.continuousResults' : 'Continuous results',
+'poll.config.label.choiceAddAllowed' : 'Add choice allowed',
+'poll.config.label.beginChoiceDate' : 'Add choice begin date',
+'poll.config.label.endChoiceDate' : 'Add choice end date',
+'poll.config.label.limitedVote' : 'Limited choice',
+'poll.config.label.maxChoiceNumber' : 'Max number of choice',
+'poll.config.label.voteCountingType' : 'Vote counting Type',
+'poll.config.label.voteVisibility' : 'Vote visibility',
+'poll.config.label.anonymousVoteAllowed' : 'Anonymous vote allowed',
+'poll.config.label.commentVisibility' : 'Comment visibility',
+'poll.config.value.visibility.everybody' : 'Everybody',
+'poll.config.value.visibility.voter' : 'Voter',
+'poll.config.value.visibility.creator' : 'Creator',
+'poll.config.value.visibility.anonymous' : 'Anonymous',
+'poll.config.value.visibility.nobody' : 'Nobody',
+'poll.error.listEmpty' : 'No poll find',
+
+'vote.added' : 'Vote added.',
+
+'comment' : 'Comment',
+'comment.added' : 'Comment added.',
+'comment.order.toDesc' : 'Ordered by newer date',
+'comment.order.toAsc' : 'Ordered by older date',
+
+'action.logout' : 'Logout',
+'action.login' : 'Login',
+'action.register' : 'Register',
+'action.recovered' : 'Recovered',
+'action.send' : 'Send',
+'action.return' : 'Return',
+'action.cancel' : 'Cancel',
+'action.save' : 'Save',
+'action.edit' : 'Edit',
+'action.delete' : 'Delete',
+'action.vote' : 'Vote',
+'action.comment' : 'Comment',
+'action.restricted.addVoter' : 'Add a Voter',
+'action.restricted.deleteVoter' : 'Delete the Voter',
+'action.restricted.addGroup' : 'Add a Group',
+'action.restricted.deleteGroup' : 'Delete the Group',
+'action.restricted.notify' : 'Notify',
+'action.favoriteList.import.addGroup' : 'Import in new group',
+'action.favoriteList.import.inGroup' : 'Import in this group',
+'action.favoriteList.add' : 'Add favorite list',
+'action.favoriteList.delete' : 'Delete the favorite list',
+'action.favoriteList.addMember' : 'Add a member',
+'action.favoriteList.deleteMember' : 'Delete the member',
+
+'action.message.confirmDelete' : 'Are you sure to delete it?',
+'action.message.confirmClose' : 'Are you sure to close it?',
+
+'error.forbidden' : 'Access forbidden',
}
@@ -217,3 +238,4 @@ var i18n_EN = {
"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 0b24993..bdb25c6 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -1,119 +1,140 @@
var translateFR = {
-'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',
-
-'admin' : 'Administration',
-'admin.listPoll' : 'Liste des Sondages',
-'admin.listUser' : 'Liste des Utilisateurs',
-'admin.config' : 'Configuration',
-
-'user.edit' : 'Profile',
-'user.listPollCreated' : 'Sondage Crée',
-'user.listPollParticiped' : 'Sondage Participé',
-'user.listPollInvited' : 'Sondage invité',
-
-'user.name' : 'Votre Nom',
-'user.mail' : 'Courriel',
-'user.password' : 'Mot de passe',
-'user.password2' : 'Confirmation',
-'user.passwordNew' : 'Nouveau Mot de passe',
-'user.passwordCurrent' : 'Mot de passe Actuel',
-'user.rememberMe' : 'Connexion automatique',
-'user.forgotPassword' : 'Mot de passe oublié',
-'user.register.success' : 'Compte enregisté, un mail de validation vient d\'être envoyé..',
-'user.edit.success' : 'Modification effectuée..',
-'user.forgotPassword.success' : 'Un mail de changement de mot de passe vient d\'être envoyé..',
-'user.favoriteList' : 'Liste de Diffusion Favorite',
-'user.error.password.diff' : 'Mot de passe différent',
-'user.error.mail.notFound' : 'Courriel n\'a pas été trouvé',
-'user.error.mail.empty' : 'Courriel ne peux pas être vide',
-'user.error.login' : 'Erreur sur le nom d\'utilisateur ou le mot de passe',
-'user.error.login.mandatory' : 'Accès refusé, vous devez êtes connecté(e)',
-'user.error.logout.mandatory' : 'Accès refusé, vous êtes connecté(e)',
-
-'poll.tab.vote' : 'Voter',
-'poll.tab.comment' : 'Commenter',
-'poll.tab.result' : 'Résultat',
-'poll.tab.create' : 'Créer',
-'poll.tab.edit' : 'Éditer',
-'poll.tab.conf' : 'Configuration',
-'poll.tab.participant' : 'Participants',
-
-'poll.link.edit' : 'Lien d\'édition',
-'poll.link.vote' : 'Lien de partage pour le vote',
-'poll.link.result' : 'Lien du résultat du sondage',
-'poll.link.clone' : 'Cloner le sondage',
-'poll.link.export' : 'Exporter le 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 clos',
-'poll.deleted' : 'Sondage supprimé',
-'poll.restricted.name' : 'Nom du votant',
-'poll.restricted.mail' : 'Courriel du votant',
-'poll.restricted.weight' : 'Poids',
-'poll.restricted.free' : 'Libre',
-'poll.restricted.restricted' : 'Restreint',
-'poll.restricted.group' : 'Groupe',
-'poll.restricted.pollType' : 'Qui peut voter ?',
-'poll.result.choice' : 'Choix',
-'poll.result.score' : 'Score',
-'poll.result.title.zero' : 'Aucun Résultat',
-'poll.result.title.one' : 'Résultat : Un votant',
-'poll.result.title.other' : 'Résultat : {{nbVoter}} Votants',
-'poll.error.listEmpty' : 'Aucun sondage trouvé',
-
-'vote.added' : 'Vote effectué',
-
-'comment' : 'Commentaire',
-'comment.added' : 'Commentaire effectué',
-'comment.order.toDesc' : 'Ordonner par le plus récent',
-'comment.order.toAsc' : 'Ordonner par ordre chronologique',
-
-'action.logout' : 'Se Deconnecter',
-'action.login' : 'Se Connecter',
-'action.register' : 'S\'enregistrer',
-'action.recovered' : 'Récupérer',
-'action.send' : 'Envoyer',
-'action.return' : 'Retour',
-'action.cancel' : 'Annuler',
-'action.save' : 'Sauvegarder',
-'action.edit' : 'Modifier',
-'action.delete' : 'Supprimer',
-'action.vote' : 'Voter',
-'action.comment' : 'Commenter',
-'action.restricted.addVoter' : 'Ajouter un Votant',
-'action.restricted.deleteVoter' : 'Supprimer le Votant',
-'action.restricted.addGroup' : 'Ajouter un Groupe de Votant',
-'action.restricted.deleteGroup' : 'Supprimer le Groupe de Votant',
-'action.restricted.notify' : 'Envoyer un mail',
-'action.favoriteList.import.addGroup' : 'Importer dans un nouveau groupe',
-'action.favoriteList.import.inGroup' : 'Importer dans ce groupe',
-'action.favoriteList.add' : 'Créer une nouvelle liste de diffusion',
-'action.favoriteList.delete' : 'Supprimer la liste de diffusion',
-'action.favoriteList.addMember' : 'Ajouter un membre',
-'action.favoriteList.deleteMember' : 'Supprimer le membre',
-
-'action.message.confirmDelete' : 'Êtes vous sûr de vouloir le supprimer?',
-'action.message.confirmClose' : 'Êtes vous sûr de vouloir le fermer?',
-
-'error.forbidden' : 'Accès interdit',
+'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',
+
+'admin' : 'Administration',
+'admin.listPoll' : 'Liste des Sondages',
+'admin.listUser' : 'Liste des Utilisateurs',
+'admin.config' : 'Configuration',
+
+'user.edit' : 'Profile',
+'user.listPollCreated' : 'Sondage Crée',
+'user.listPollParticiped' : 'Sondage Participé',
+'user.listPollInvited' : 'Sondage invité',
+
+'user.name' : 'Votre Nom',
+'user.mail' : 'Courriel',
+'user.password' : 'Mot de passe',
+'user.password2' : 'Confirmation',
+'user.passwordNew' : 'Nouveau Mot de passe',
+'user.passwordCurrent' : 'Mot de passe Actuel',
+'user.rememberMe' : 'Connexion automatique',
+'user.forgotPassword' : 'Mot de passe oublié',
+'user.register.success' : 'Compte enregisté, un mail de validation vient d\'être envoyé..',
+'user.edit.success' : 'Modification effectuée..',
+'user.forgotPassword.success' : 'Un mail de changement de mot de passe vient d\'être envoyé..',
+'user.favoriteList' : 'Liste de Diffusion Favorite',
+'user.error.password.diff' : 'Mot de passe différent',
+'user.error.mail.notFound' : 'Courriel n\'a pas été trouvé',
+'user.error.mail.empty' : 'Courriel ne peux pas être vide',
+'user.error.login' : 'Erreur sur le nom d\'utilisateur ou le mot de passe',
+'user.error.login.mandatory' : 'Accès refusé, vous devez êtes connecté(e)',
+'user.error.logout.mandatory' : 'Accès refusé, vous êtes connecté(e)',
+
+'poll.tab.vote' : 'Voter',
+'poll.tab.comment' : 'Commenter',
+'poll.tab.result' : 'Résultat',
+'poll.tab.create' : 'Créer',
+'poll.tab.edit' : 'Éditer',
+'poll.tab.conf' : 'Configuration',
+'poll.tab.participant' : 'Participants',
+
+'poll.link.edit' : 'Lien d\'édition',
+'poll.link.vote' : 'Lien de partage pour le vote',
+'poll.link.result' : 'Lien du résultat du sondage',
+'poll.link.clone' : 'Cloner le sondage',
+'poll.link.export' : 'Exporter le 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 clos',
+'poll.deleted' : 'Sondage supprimé',
+'poll.restricted.name' : 'Nom du votant',
+'poll.restricted.mail' : 'Courriel du votant',
+'poll.restricted.weight' : 'Poids',
+'poll.restricted.free' : 'Libre',
+'poll.restricted.restricted' : 'Restreint',
+'poll.restricted.group' : 'Groupe',
+'poll.restricted.pollType' : 'Qui peut voter ?',
+'poll.result.choice' : 'Choix',
+'poll.result.score' : 'Score',
+'poll.result.title.zero' : 'Aucun Résultat',
+'poll.result.title.one' : 'Résultat : Un votant',
+'poll.result.title.other' : 'Résultat : {{nbVoter}} Votants',
+'poll.config.title.poll' : 'Configuration globale',
+'poll.config.title.choice' : 'Configuration des choix',
+'poll.config.title.vote' : 'Configuration des votes',
+'poll.config.label.beginDate' : 'Date de début',
+'poll.config.label.endDate' : 'Date de fin',
+'poll.config.label.resultVisibility' : 'Visibilité des résultats',
+'poll.config.label.continuousResults' : 'Résultat continue',
+'poll.config.label.choiceAddAllowed' : 'Ajout de choix par les votants',
+'poll.config.label.beginChoiceDate' : 'Date de début d\'ajout de choix',
+'poll.config.label.endChoiceDate' : 'Date de fin d\'ajout de choix',
+'poll.config.label.limitedVote' : 'Limiter les votes',
+'poll.config.label.maxChoiceNumber' : 'Nombre max de vote',
+'poll.config.label.voteCountingType' : 'Type de Scrutin',
+'poll.config.label.voteVisibility' : 'Visibilité des votes',
+'poll.config.label.anonymousVoteAllowed' : 'Autoriser les votes anonymes',
+'poll.config.label.commentVisibility' : 'Visibilité des commentaires',
+'poll.config.value.visibility.everybody' : 'Public',
+'poll.config.value.visibility.voter' : 'Votants / Participants',
+'poll.config.value.visibility.creator' : 'Créateur',
+'poll.config.value.visibility.anonymous' : 'Anonyme',
+'poll.config.value.visibility.nobody' : 'Personne',
+'poll.error.listEmpty' : 'Aucun sondage trouvé',
+
+'vote.added' : 'Vote effectué',
+
+'comment' : 'Commentaire',
+'comment.added' : 'Commentaire effectué',
+'comment.order.toDesc' : 'Ordonner par le plus récent',
+'comment.order.toAsc' : 'Ordonner par ordre chronologique',
+
+'action.logout' : 'Se Deconnecter',
+'action.login' : 'Se Connecter',
+'action.register' : 'S\'enregistrer',
+'action.recovered' : 'Récupérer',
+'action.send' : 'Envoyer',
+'action.return' : 'Retour',
+'action.cancel' : 'Annuler',
+'action.save' : 'Sauvegarder',
+'action.edit' : 'Modifier',
+'action.delete' : 'Supprimer',
+'action.vote' : 'Voter',
+'action.comment' : 'Commenter',
+'action.restricted.addVoter' : 'Ajouter un Votant',
+'action.restricted.deleteVoter' : 'Supprimer le Votant',
+'action.restricted.addGroup' : 'Ajouter un Groupe de Votant',
+'action.restricted.deleteGroup' : 'Supprimer le Groupe de Votant',
+'action.restricted.notify' : 'Envoyer un mail',
+'action.favoriteList.import.addGroup' : 'Importer dans un nouveau groupe',
+'action.favoriteList.import.inGroup' : 'Importer dans ce groupe',
+'action.favoriteList.add' : 'Créer une nouvelle liste de diffusion',
+'action.favoriteList.delete' : 'Supprimer la liste de diffusion',
+'action.favoriteList.addMember' : 'Ajouter un membre',
+'action.favoriteList.deleteMember' : 'Supprimer le membre',
+
+'action.message.confirmDelete' : 'Êtes vous sûr de vouloir le supprimer?',
+'action.message.confirmClose' : 'Êtes vous sûr de vouloir le fermer?',
+
+'error.forbidden' : 'Accès interdit',
}
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 847dba8..1aa0d5a 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -128,6 +128,10 @@
transition:margin linear @short-time-transition;
}
+ label.label-block {
+ display:block !important;
+ }
+
}
}
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-settings.html b/pollen-ui-angular/src/main/webapp/partials/poll-settings.html
index 99df8ab..1ea211e 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-settings.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-settings.html
@@ -20,10 +20,10 @@
-->
<h1>{{data.poll.title}}</h1>
<form class="form-horizontal" novalidate>
- <h4>Confiuration global</h4>
+ <h4>{{ 'poll.config.title.poll' | translate }}</h4>
- <div class="form-group">
- <label class="col-sm-4 control-label" for="beginDate">Date de début : </label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label" for="beginDate">{{ 'poll.config.label.beginDate' | translate }}</label>
<div class="col-sm-8">
<input id="beginDate" class="form-control" type="text"
datepicker-popup="dd/MM/yyyy"
@@ -36,8 +36,8 @@
</div>
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label" for="endDate">Date de fin : </label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label" for="endDate">{{ 'poll.config.label.endDate' | translate }}</label>
<div class="col-sm-8">
<input id="endDate" class="form-control" type="text"
datepicker-popup="dd/MM/yyyy"
@@ -49,42 +49,56 @@
</div>
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label">Résultat : </label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label">{{ 'poll.config.label.resultVisibility' | translate }}</label>
<div class="col-sm-8">
- <label><input type="radio" ng-model="data.poll.resultVisibility" name="resultVisibility" value="EVERYBODY" auto-save="autoSavePoll()" /> Public</label>
- <label><input type="radio" ng-model="data.poll.resultVisibility" name="resultVisibility" value="VOTER" auto-save="autoSavePoll()" /> Participants</label>
- <label><input type="radio" ng-model="data.poll.resultVisibility" name="resultVisibility" value="CREATOR" auto-save="autoSavePoll()" /> Créateur</label>
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.resultVisibility"
+ name="resultVisibility"
+ value="EVERYBODY"
+ auto-save="autoSavePoll()" />
+ {{ 'poll.config.value.visibility.everybody' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.resultVisibility"
+ name="resultVisibility"
+ value="VOTER"
+ auto-save="autoSavePoll()" />
+ {{ 'poll.config.value.visibility.voter' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.resultVisibility"
+ name="resultVisibility"
+ value="CREATOR"
+ auto-save="autoSavePoll()" />
+ {{ 'poll.config.value.visibility.creator' | translate }}
+ </label>
</div>
- <!--
- <div class="col-sm-8 btn-group">
- <button type="button" class="btn btn-success" ng-model="data.poll.resultVisibility" btn-radio="'EVERYBODY'">Public</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.resultVisibility" btn-radio="'VOTER'">Participants</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.resultVisibility" btn-radio="'CREATOR'">Créateur</button>
- </div>
- -->
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label">Résultat continue : </label>
- <div class="col-sm-8 btn-group">
- <button class="btn btn-default" ng-model="data.poll.continuousResults" btn-radio="true" auto-save="autoSavePoll()" >Oui</button>
- <button class="btn btn-default" ng-model="data.poll.continuousResults" btn-radio="false" auto-save="autoSavePoll()" >Non</button>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label" for="formContinuousResults">{{ 'poll.config.label.continuousResults' | translate }}</label>
+ <div class="col-sm-8">
+ <input type="checkbox" id="formContinuousResults" ng-model="data.poll.continuousResults" auto-save="autoSavePoll()" />
</div>
</div>
- <h4>Configuration des Choix</h4>
+ <h4>{{ 'poll.config.title.choice' | translate }}</h4>
- <div class="form-group">
- <label class="col-sm-4 control-label">Ajout de choix par les votants :</label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label" for="formChoiceAddAllowed">{{ 'poll.config.label.choiceAddAllowed' | translate }}</label>
<div class="col-sm-8 btn-group">
- <button class="btn btn-default" ng-model="data.poll.choiceAddAllowed" btn-radio="true" auto-save="autoSavePoll()" >Oui</button>
- <button class="btn btn-default" ng-model="data.poll.choiceAddAllowed" btn-radio="false" auto-save="autoSavePoll()" >Non</button>
+ <input type="checkbox" id="formChoiceAddAllowed" ng-model="data.poll.choiceAddAllowed" auto-save="autoSavePoll()" />
</div>
</div>
- <div class="form-group" ng-show="data.poll.choiceAddAllowed">
- <label class="col-sm-4 control-label" for="beginChoiceDate">Date de début : </label>
+ <div class="form-group row" ng-show="data.poll.choiceAddAllowed">
+ <label class="col-sm-4 control-label" for="beginChoiceDate">{{ 'poll.config.label.beginChoiceDate' | translate }}</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="beginChoiceDate"
datepicker-popup="dd/MM/yyyy"
@@ -96,8 +110,8 @@
auto-save="autoSavePoll()" />
</div>
</div>
- <div class="form-group" ng-if="data.poll.choiceAddAllowed" for="endChoiceDate">
- <label class="col-sm-4 control-label">Date de fin : </label>
+ <div class="form-group row" ng-if="data.poll.choiceAddAllowed">
+ <label class="col-sm-4 control-label" for="endChoiceDate">{{ 'poll.config.label.endChoiceDate' | translate }}</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="endChoiceDate"
datepicker-popup="dd/MM/yyyy"
@@ -110,58 +124,110 @@
</div>
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label">Limiter les votes :</label>
- <div class="col-sm-8 btn-group">
- <button class="btn btn-default" ng-model="data.poll.limitedVote" btn-radio="true" auto-save="autoSavePoll()">Oui</button>
- <button class="btn btn-default" ng-model="data.poll.limitedVote" btn-radio="false" auto-save="autoSavePoll()">Non</button>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label">{{ 'poll.config.label.limitedVote' | translate }}</label>
+ <div class="col-sm-8">
+ <input type="checkbox" id="formLimitedVote" ng-model="data.poll.limitedVote" auto-save="autoSavePoll()" />
</div>
</div>
- <div class="form-group" ng-show="data.poll.limitedVote">
- <label class="col-sm-4 control-label" for="popMaxChoiceNumber">Nombre de vote :</label>
+ <div class="form-group row" ng-show="data.poll.limitedVote">
+ <label class="col-sm-4 control-label" for="popMaxChoiceNumber">{{ 'poll.config.label.maxChoiceNumber' | translate }}</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="popMaxChoiceNumber" ng-model="data.poll.maxChoiceNumber" auto-save="autoSavePoll()" />
</div>
</div>
- <h4> Configuration des Réponses </h4>
+ <h4>{{ 'poll.config.title.vote' | translate }}</h4>
- <div class="form-group">
- <label class="col-sm-4 control-label">Type : </label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label">{{ 'poll.config.label.voteCountingType' | translate }}</label>
<div class="col-sm-8">
- <div class="btn-group">
-
- <button ng-repeat="voteCountingType in data.allVoteCountingType" type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="{{voteCountingType.id}}" auto-save="autoSavePoll()">{{voteCountingType.name}}</button>
-
- </div>
+ <label class="label-block" ng-repeat="voteCountingType in data.allVoteCountingType">
+ <input type="radio"
+ ng-model="data.poll.voteCountingType"
+ value="{{voteCountingType.id}}"
+ auto-save="autoSavePoll()" />
+ {{voteCountingType.name}}
+ </label>
+ <hr/>
<p ng-bind-html="toHTML(voteCountingTypeHelper)"></p>
</div>
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label">Visibilité : </label>
- <div class="col-sm-8 btn-group">
- <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" auto-save="autoSavePoll()" btn-radio="'EVERYBODY'">Public</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" auto-save="autoSavePoll()" btn-radio="'VOTER'">Participants</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" auto-save="autoSavePoll()" btn-radio="'CREATOR'">Créateur</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" auto-save="autoSavePoll()" btn-radio="'ANONYMOUS'">Anonyme</button>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label">{{ 'poll.config.label.voteVisibility' | translate }}</label>
+ <div class="col-sm-8">
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.voteVisibility"
+ auto-save="autoSavePoll()"
+ value="EVERYBODY" />
+ {{ 'poll.config.value.visibility.everybody' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.voteVisibility"
+ auto-save="autoSavePoll()"
+ value="VOTER" />
+ {{ 'poll.config.value.visibility.voter' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.voteVisibility"
+ auto-save="autoSavePoll()"
+ value="CREATOR" />
+ {{ 'poll.config.value.visibility.creator' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.voteVisibility"
+ auto-save="autoSavePoll()"
+ value="ANONYMOUS" />
+ {{ 'poll.config.value.visibility.anonymous' | translate }}
+ </label>
</div>
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label">Autoriser les votes anonymes :</label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label">{{ 'poll.config.label.anonymousVoteAllowed' | translate }}</label>
<div class="col-sm-8 btn-group">
<button class="btn btn-default" ng-model="data.poll.anonymousVoteAllowed" btn-radio="true" auto-save="autoSavePoll()">Oui</button>
<button class="btn btn-default" ng-model="data.poll.anonymousVoteAllowed" btn-radio="false" auto-save="autoSavePoll()">Non</button>
</div>
</div>
- <div class="form-group">
- <label class="col-sm-4 control-label">Visibiliter des commentaires :</label>
+ <div class="form-group row">
+ <label class="col-sm-4 control-label">{{ 'poll.config.label.commentVisibility' | translate }}</label>
<div class="col-sm-8">
- <label><input type="radio" ng-model="data.poll.commentVisibility" name="commentVisibility" value="EVERYBODY" auto-save="autoSavePoll()" /> Public</label>
- <label><input type="radio" ng-model="data.poll.commentVisibility" name="commentVisibility" value="VOTER" auto-save="autoSavePoll()" /> Participants</label>
- <label><input type="radio" ng-model="data.poll.commentVisibility" name="commentVisibility" value="NOBODY" auto-save="autoSavePoll()" /> Personne</label>
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.commentVisibility"
+ name="commentVisibility"
+ value="EVERYBODY"
+ auto-save="autoSavePoll()" />
+ {{ 'poll.config.value.visibility.everybody' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.commentVisibility"
+ name="commentVisibility"
+ value="VOTER"
+ auto-save="autoSavePoll()" />
+ {{ 'poll.config.value.visibility.voter' | translate }}
+ </label>
+
+ <label class="label-block">
+ <input type="radio"
+ ng-model="data.poll.commentVisibility"
+ name="commentVisibility"
+ value="NOBODY"
+ auto-save="autoSavePoll()" />
+ {{ 'poll.config.value.visibility.nobody' | translate }}
+ </label>
</div>
</div>
</form>
--
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 f096df389586548ac9d43af982c5bf38552a527f
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 16 15:29:20 2014 +0200
add unit test for alert
---
.../src/main/webapp/js/controllers/alertCtrl.js | 22 +++---
.../src/test/unit/alertControllersTest.js | 78 ++++++++++++++++++++++
.../src/test/unit/pollControllersTest.js | 27 +++++++-
3 files changed, 114 insertions(+), 13 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
index 81a5802..d388b25 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -27,45 +27,47 @@ angular.module('alertControllers', [])
if (angular.isUndefined($scope.data)) {
$scope.data = {}
}
- $scope.data.alerts = [];
+
+ $scope.data.alerts = [];
$scope.$on('newError', function (event, error, timeout) {
var alert = {msg:error, type:'danger', glyphicon:'glyphicon-remove'};
if (angular.isDefined(timeout)) {
- addAlert(alert, timeout);
+ $scope.addAlert(alert, timeout);
} else {
- addAlert(alert, conf.defaultAlertTimeError);
+ $scope.addAlert(alert, conf.defaultAlertTimeError);
}
});
$scope.$on('newWarning', function (event, warning, timeout) {
var alert = {msg:warning, type:'warning', glyphicon:'glyphicon-warning-sign'};
if (angular.isDefined(timeout)) {
- addAlert(alert, timeout);
+ $scope.addAlert(alert, timeout);
} else {
- addAlert(alert, conf.defaultAlertTimeWarning);
+ $scope.addAlert(alert, conf.defaultAlertTimeWarning);
}
});
+
$scope.$on('newSuccess', function (event, success, timeout) {
var alert = {msg:success, type:'success', glyphicon:'glyphicon-ok'};
if (angular.isDefined(timeout)) {
- addAlert(alert, timeout);
+ $scope.addAlert(alert, timeout);
} else {
- addAlert(alert, conf.defaultAlertTimeSuccess);
+ $scope.addAlert(alert, conf.defaultAlertTimeSuccess);
}
});
$scope.$on('newInfo', function (event, info, timeout) {
var alert = {msg:info, type:'info', glyphicon:'glyphicon-info-sign'};
if (angular.isDefined(timeout)) {
- addAlert(alert, timeout);
+ $scope.addAlert(alert, timeout);
} else {
- addAlert(alert, conf.defaultAlertTimeInfo);
+ $scope.addAlert(alert, conf.defaultAlertTimeInfo);
}
});
- var addAlert = function (alert, timeout) {
+ $scope.addAlert = function (alert, timeout) {
var alertNotExist = true;
angular.forEach($scope.data.alerts, function (oneAlert, key) {
if (angular.equals(oneAlert.msg, alert.msg) && angular.equals(oneAlert.type, alert.type)) {
diff --git a/pollen-ui-angular/src/test/unit/alertControllersTest.js b/pollen-ui-angular/src/test/unit/alertControllersTest.js
new file mode 100644
index 0000000..91b760a
--- /dev/null
+++ b/pollen-ui-angular/src/test/unit/alertControllersTest.js
@@ -0,0 +1,78 @@
+'use strict';
+
+///////////////////////////////
+//// TEST printAlertCtrl ////
+///////////////////////////////
+
+describe('Alert controller', function () {
+ var rootScope;
+ var $timeout;
+ var $scope = {};
+ var ctrl = null;
+
+ beforeEach(module('alertControllers'));
+ beforeEach(inject(function($rootScope, $controller) {
+ rootScope = $rootScope;
+ $scope = $rootScope.$new();
+ ctrl = $controller('printAlertCtrl', {$scope: $scope});
+ spyOn($rootScope, '$broadcast').andCallThrough();
+ }));
+
+ beforeEach(inject(function($injector) {
+ $timeout = $injector.get('$timeout');
+ }));
+
+
+ it('should load printAlertCtrl', function () {
+ expect(ctrl).toBeDefined();
+ expect(ctrl).not.toBeNull();
+ });
+
+ it('should init alerts array', function () {
+ expect($scope.data.alerts.length).toBeGreaterThan(-1);
+ });
+
+ it('should can add an alert', function () {
+ var nbAlert = $scope.data.alerts.length;
+ var alert = {msg:'message alert', type:'type'};
+
+ $scope.addAlert(alert, -1);
+
+ expect($scope.data.alerts.length).toEqual(nbAlert + 1);
+ });
+
+ it('should can delete my alert', function () {
+ var nbAlert = $scope.data.alerts.length;
+ var alert = {msg:'message alert', type:'type'};
+
+ $scope.addAlert(alert, -1);
+ $scope.hideAlert(alert);
+
+ expect($scope.data.alerts.length).toEqual(nbAlert);
+ });
+
+ it('should can\'t duplicate alert ', function () {
+ var nbAlert = $scope.data.alerts.length;
+ var alert = {msg:'message alert', type:'type'};
+
+ $scope.addAlert(alert, -1);
+ $scope.addAlert(alert, -1);
+
+ expect($scope.data.alerts.length).toEqual(nbAlert + 1);
+ });
+
+ it('should can hide an alert after timeout', function() {
+ var alert = {msg:'message alert', type:'type'};
+ var nbAlert = $scope.data.alerts.length;
+
+ $scope.addAlert(alert, 250);
+
+ // check now is added
+ expect($scope.data.alerts.length).toEqual(nbAlert + 1);
+
+ $timeout.flush();
+
+ // check now is hidden
+ expect($scope.data.alerts.length).toEqual(nbAlert);
+ });
+});
diff --git a/pollen-ui-angular/src/test/unit/pollControllersTest.js b/pollen-ui-angular/src/test/unit/pollControllersTest.js
index d658764..3f23721 100644
--- a/pollen-ui-angular/src/test/unit/pollControllersTest.js
+++ b/pollen-ui-angular/src/test/unit/pollControllersTest.js
@@ -1,8 +1,8 @@
'use strict';
-////////////////////////////
-///// TEST PollCtrl ////
-////////////////////////////
+///////////////////////////////
+//// TEST PollCtrl ////
+///////////////////////////////
describe('Global poll controller', function () {
beforeEach(module('pollControllers'));
@@ -177,6 +177,9 @@ describe('Global poll controller', function () {
});
});
+///////////////////////////////
+//// TEST PollAdminCtrl ////
+///////////////////////////////
describe('Admin poll controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
@@ -258,6 +261,9 @@ describe('Admin poll controller', function () {
});
+///////////////////////////////
+//// TEST PollCreateCtrl ////
+///////////////////////////////
describe('Create poll Controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
@@ -291,6 +297,9 @@ describe('Create poll Controller', function () {
});
});
+///////////////////////////////
+//// TEST PollEditCtrl ////
+///////////////////////////////
describe('Edit poll controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
@@ -349,6 +358,9 @@ describe('Edit poll controller', function () {
});
});
+///////////////////////////////
+//// TEST PollVoteCtrl ////
+///////////////////////////////
describe('Vote poll controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
@@ -406,6 +418,9 @@ describe('Vote poll controller', function () {
});
});
+///////////////////////////////
+//// TEST PollCommentCtrl ////
+///////////////////////////////
describe('Poll comment controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
@@ -462,6 +477,9 @@ describe('Poll comment controller', function () {
});
});
+///////////////////////////////
+//// TEST PollResultCtrl ////
+///////////////////////////////
describe('Poll result controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
@@ -484,6 +502,9 @@ describe('Poll result controller', function () {
});
});
+///////////////////////////////
+//// TEST PollListCtrl ////
+///////////////////////////////
describe('List of poll controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
--
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 feature/unitTest in repository pollen.
See http://git.chorem.org/pollen.git
commit 40ca60aa739b8aedc3f179213f9d667a0b3055ef
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 16 12:25:31 2014 +0200
add test for modules pollControllers
---
.../src/main/webapp/js/controllers/pollCtrl.js | 43 ++--
.../src/test/unit/pollControllersTest.js | 240 +++++++++++++++++++--
2 files changed, 250 insertions(+), 33 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index dafeadf..a59d583 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -540,10 +540,13 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
var initPoll = function () {
Poll.skeletonNew(function (poll) {
$scope.data.poll = poll;
- $scope.data.choices = [];
- $scope.data.vote = {};
- $scope.data.vote.choices = $scope.data.choices;
+ }, function (error) {
+ $scope.data.poll = {};
});
+
+ $scope.data.choices = [];
+ $scope.data.vote = {};
+ $scope.data.vote.choices = $scope.data.choices;
}
initPoll();
@@ -598,8 +601,6 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
Page.setTitle('title.poll.edit');
- $scope.globalVariables.edit = true;
-
////////////////////////////////
//// CHOICE /////
////////////////////////////////
@@ -694,10 +695,11 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
}
};
- var memberIsEmpty = function (member) {
+ $scope.memberIsEmpty = function (member) {
var isEmpty = true;
try {
- if (member.name != '' && member.email != '') {
+ if (angular.isDefined(member.name) && member.name != ''
+ || angular.isDefined(member.email) && member.email != '') {
isEmpty = false;
}
}
@@ -754,7 +756,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
var vl = {group: voterList.group, members:[]};
angular.forEach(voterList.members, function(member, key) {
- if (!memberIsEmpty(member)) {
+ if (!$scope.memberIsEmpty(member)) {
vl.members.push(member);
}
});
@@ -780,7 +782,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
voterList.group.restError = error.data;
var deltaError = 0;
angular.forEach(voterList.members, function (member, key) {
- if (!memberIsEmpty(member)) {
+ if (!$scope.memberIsEmpty(member)) {
var index = key - deltaError;
member.restError = {};
if (angular.isDefined(error.data['member['+index+'].name'])) {
@@ -807,7 +809,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
};
$scope.saveVoterListMember = function (member, voterList) {
- if (!memberIsEmpty(member)) {
+ if (!$scope.memberIsEmpty(member)) {
var vlId = voterList.group.id; // Id Voter list
var vlMemberPromise;
if (angular.isDefined(vlId)) {
@@ -1078,9 +1080,16 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
}
$scope.toggleValue = function (choice, event) {
- if ($scope.data.voteCountingType.renderType == 'checkbox') {
- choice.voteValue = !choice.voteValue;
- event.stopPropagation();
+ if ($scope.voteCountingIsBoolean()) {
+ if (angular.isUndefined(choice.voteValue)) {
+ choice.voteValue = true;
+ }
+ else {
+ choice.voteValue = !choice.voteValue;
+ }
+ if (angular.isDefined(event)) {
+ event.stopPropagation();
+ }
}
}
@@ -1099,7 +1108,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
$scope.tab = $scope.setTab('comment');
- $scope.globalVariables.commentMode = true;
+ //$scope.globalVariables.commentMode = true;
$scope.comment = {text:''};
var initAuthor = function () {
@@ -1110,6 +1119,8 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
else {
$scope.comment.authorName = $scope.session.user.email;
}
+ } else {
+ $scope.comment.authorName = '';
}
}; initAuthor();
@@ -1125,7 +1136,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr
$scope.toggleOrder = function () {
$scope.desc = !$scope.desc;
paginationParameter.desc = $scope.desc;
- paginationParameter.pageNumber = $scope.data.commentsPagination.lastPage - $scope.data.commentsPagination.currentPage;
+ if (angular.isDefined($scope.data.commentsPagination)) {
+ paginationParameter.pageNumber = $scope.data.commentsPagination.lastPage - $scope.data.commentsPagination.currentPage;
+ }
initComments();
}
diff --git a/pollen-ui-angular/src/test/unit/pollControllersTest.js b/pollen-ui-angular/src/test/unit/pollControllersTest.js
index 9b69907..d658764 100644
--- a/pollen-ui-angular/src/test/unit/pollControllersTest.js
+++ b/pollen-ui-angular/src/test/unit/pollControllersTest.js
@@ -4,7 +4,7 @@
///// TEST PollCtrl ////
////////////////////////////
-describe('Test pollCtrl', function () {
+describe('Global poll controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
$scope = {};
@@ -175,10 +175,9 @@ describe('Test pollCtrl', function () {
expect(receiveChoice.choiceType).toEqual('IMAGE');
});
});
-
});
-describe('Test Admin Controller', function () {
+describe('Admin poll controller', function () {
beforeEach(module('pollControllers'));
beforeEach(inject(function($controller) {
$scope = {};
@@ -259,37 +258,242 @@ describe('Test Admin Controller', function () {
});
-describe('load poll controllers', function () {
+describe('Create poll Controller', function () {
beforeEach(module('pollControllers'));
-
- it('should load PollCreateCtrl', inject(function($controller) {
- var ctrl = $controller('PollCreateCtrl', {$scope:{}});
- expect(ctrl).toBeDefined();
+ beforeEach(inject(function($controller) {
+ ctrl = $controller('PollCreateCtrl', {$scope:$scope});
}));
- it('should load PollEditCtrl', inject(function($controller) {
- var ctrl = $controller('PollEditCtrl', {$scope:{}});
+ var $scope = {};
+ var ctrl = null;
+
+ it('should load PollCreateCtrl', function() {
expect(ctrl).toBeDefined();
+ });
+
+ it('should set good default tab', function() {
+ expect($scope.tab).toEqual('edit');
+ });
+
+ it('should be on edited mode', function () {
+ expect($scope.globalVariables.editMode).toBeTruthy();
+ });
+
+ it('should be on create mode', function () {
+ expect($scope.globalVariables.create).toBeTruthy();
+ });
+
+ it('should load base of poll', function () {
+ expect($scope.data.poll).toBeDefined();
+ expect($scope.data.choices).toBeDefined();
+ expect($scope.data.vote).toBeDefined();
+ expect($scope.data.vote.choices).toBeDefined();
+ });
+});
+
+describe('Edit poll controller', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ ctrl = $controller('PollEditCtrl', {$scope:$scope});
}));
- it('should load PollVoteCtrl', inject(function($controller) {
- var ctrl = $controller('PollVoteCtrl', {$scope:{}});
+ var $scope = {};
+ var ctrl = null;
+
+ it('should load PollEditCtrl', function() {
expect(ctrl).toBeDefined();
+ });
+
+ it('should set good default tab', function() {
+ expect($scope.tab).toEqual('edit');
+ });
+
+ it('should be on edited mode', function () {
+ expect($scope.globalVariables.editMode).toBeTruthy();
+ });
+
+ it('should detect is member is empty', function () {
+ var member, isEmpty;
+
+ // is empty
+
+ member = {};
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeTruthy();
+
+ member = {name:''}
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeTruthy();
+
+ member = {email:''}
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeTruthy();
+
+ member = {name:'', email:''}
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeTruthy();
+
+ // is not empty
+
+ member = {name:'memberName'}
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeFalsy();
+
+ member = {email:'member(a)pollen.org'}
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeFalsy();
+
+ member = {name:'memberName', email:'member(a)pollen.org'}
+ isEmpty = $scope.memberIsEmpty(member);
+ expect(isEmpty).toBeFalsy();
+ });
+});
+
+describe('Vote poll controller', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ ctrl = $controller('PollVoteCtrl', {$scope:$scope});
}));
- it('should load PollResultCtrl', inject(function($controller) {
- var ctrl = $controller('PollResultCtrl', {$scope:{}});
+ var ctrl = null;
+ var $scope = {};
+
+ it('should load PollVoteCtrl', function() {
expect(ctrl).toBeDefined();
+ });
+
+ it('should set good default tab', function() {
+ expect($scope.tab).toEqual('vote');
+ });
+
+ it('should not be on edited mode', function () {
+ expect($scope.globalVariables.editMode).toBeFalsy();
+ });
+
+ it('should be toggle choiceValue', function () {
+ // force vote counting on boolean
+ $scope.data.voteCountingType = {renderType:'checkbox'};
+
+ // choice.voteValue init to false
+ runs( function () {
+ var choice = {voteValue : false};
+ $scope.toggleValue(choice);
+ expect(choice.voteValue).toBeTruthy();
+
+ $scope.toggleValue(choice);
+ expect(choice.voteValue).toBeFalsy();
+ });
+
+ // choice.voteValue init to true
+ runs( function () {
+ var choice = {voteValue : true};
+ $scope.toggleValue(choice);
+ expect(choice.voteValue).toBeFalsy();
+
+ $scope.toggleValue(choice);
+ expect(choice.voteValue).toBeTruthy();
+ });
+
+ // choice.voteValue is not defined
+ runs(function () {
+ var choice = {};
+ $scope.toggleValue(choice);
+ expect(choice.voteValue).toBeTruthy();
+
+ $scope.toggleValue(choice);
+ expect(choice.voteValue).toBeFalsy();
+ });
+ });
+});
+
+describe('Poll comment controller', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ ctrl = $controller('PollCommentCtrl', {$scope:$scope});
}));
- it('should load PollCommentCtrl', inject(function($controller) {
- var ctrl = $controller('PollCommentCtrl', {$scope:{}});
+ var ctrl = null;
+ var $scope = {};
+
+ it('should load PollCommentCtrl', function() {
expect(ctrl).toBeDefined();
+ });
+
+ it('should set good default tab', function() {
+ expect($scope.tab).toEqual('comment');
+ });
+
+ it('should not be on edited mode', function () {
+ expect($scope.globalVariables.editMode).toBeFalsy();
+ });
+
+ it('should initialize comment', function () {
+ expect($scope.comment.text).toBeDefined();
+ expect($scope.comment.authorName).toBeDefined();
+ });
+
+ it('should toggle order comments', function () {
+ // order desc
+ runs(function () {
+ $scope.desc = true;
+
+ $scope.toggleOrder();
+
+ expect($scope.desc).toBeFalsy();
+ });
+
+ // order asc
+ runs(function () {
+ $scope.desc = false;
+
+ $scope.toggleOrder();
+
+ expect($scope.desc).toBeTruthy();
+ });
+
+ // order not set
+ runs(function () {
+ delete $scope.desc;
+
+ $scope.toggleOrder();
+
+ expect($scope.desc).toBeTruthy();
+ });
+ });
+});
+
+describe('Poll result controller', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ ctrl = $controller('PollResultCtrl', {$scope:$scope});
}));
- it('should load PollListCtrl', inject(function($controller) {
- var ctrl = $controller('PollListCtrl', {$scope:{}});
+ var ctrl = null;
+ var $scope = {};
+
+ it('should load PollResultCtrl', function() {
expect(ctrl).toBeDefined();
+ });
+
+ it('should set good default tab', function() {
+ expect($scope.tab).toEqual('result');
+ });
+
+ it('should not be on edited mode', function () {
+ expect($scope.globalVariables.editMode).toBeFalsy();
+ });
+});
+
+describe('List of poll controller', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ ctrl = $controller('PollListCtrl', {$scope:$scope});
}));
+ var ctrl = null;
+ var $scope = {};
+
+ it('should load PollListCtrl', function() {
+ expect(ctrl).toBeDefined();
+ });
})
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
01/01: add test : check init variables in pollAdminCtrl and voterList behavior
by chorem.org scm July 15, 2014
by chorem.org scm July 15, 2014
July 15, 2014
This is an automated email from the git hooks/post-receive script.
New commit to branch feature/unitTest in repository pollen.
See http://git.chorem.org/pollen.git
commit 31b1bf28646473745dd83b0e38b4939a5e131562
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 16 00:52:36 2014 +0200
add test : check init variables in pollAdminCtrl and voterList
behavior
---
.../src/test/unit/pollControllersTest.js | 81 ++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/pollen-ui-angular/src/test/unit/pollControllersTest.js b/pollen-ui-angular/src/test/unit/pollControllersTest.js
index f4bb7b3..9b69907 100644
--- a/pollen-ui-angular/src/test/unit/pollControllersTest.js
+++ b/pollen-ui-angular/src/test/unit/pollControllersTest.js
@@ -178,6 +178,87 @@ describe('Test pollCtrl', function () {
});
+describe('Test Admin Controller', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ $scope = {};
+ ctrl = $controller('PollAdminCtrl', {$scope: $scope});
+ }));
+
+ var $scope = {};
+ var ctrl = null;
+
+ it('should load PollAdminCtrl', function() {
+ expect(ctrl).toBeDefined();
+ expect(ctrl).not.toBeNull();
+ });
+
+ it('should set good default tab', function() {
+ expect($scope.tab).toEqual('edit');
+ });
+
+ it('should be on edited mode', function () {
+ expect($scope.globalVariables.editMode).toBeTruthy();
+ });
+
+ it('should init list of voterList group', function() {
+ expect($scope.data.voterList).toBeDefined();
+ expect($scope.data.voterList.length).toBeGreaterThan(-1);
+ })
+
+ it('should add a new group of voterList', function () {
+ $scope.addGroup();
+
+ // check addGroup create is an array
+ expect($scope.data.voterList.length).toBeGreaterThan(0);
+
+ // check addGroup add one group
+ var nbVoterList = $scope.data.voterList.length;
+ $scope.addGroup();
+ expect($scope.data.voterList.length).toEqual(nbVoterList + 1);
+ });
+
+ it('should new group have name, weight', function () {
+ // create one voterList group and get one
+ $scope.addGroup();
+ var voterList = $scope.data.voterList[0];
+
+ expect(voterList.group.name).toBeDefined;
+ expect(voterList.group.weight).toEqual(1.0);
+
+ });
+
+ it('should add a new voter in voterList', function () {
+ // create one voterList and get one
+ $scope.addGroup();
+
+ var voterList = $scope.data.voterList[0];
+
+ // check voterListMembers is an array
+ $scope.addVoter(0);
+ expect(voterList.members.length).toBeGreaterThan(0);
+
+ //check add voterListMembers add one member
+ var nbMember = voterList.members.length;
+ $scope.addVoter(0);
+ expect(voterList.members.length).toEqual(nbMember + 1);
+ });
+
+ it('should new member have name, email and weight', function () {
+ $scope.addGroup();
+ $scope.addVoter(0);
+
+ // get the first member of the first group
+ var member = $scope.data.voterList[0].members[0];
+
+ expect(member.name).toBeDefined();
+ expect(member.email).toBeDefined();
+ expect(member.weight).toEqual(1.0);
+
+ });
+
+});
+
describe('load poll controllers', function () {
beforeEach(module('pollControllers'));
--
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 feature/unitTest in repository pollen.
See http://git.chorem.org/pollen.git
commit 04e53e001a9d1392bf9ec589dc1c3d8c7c098a7b
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jul 15 17:26:39 2014 +0200
fix dependence
---
pollen-ui-angular/bower.json | 3 +++
pollen-ui-angular/package.json | 5 ++++-
pollen-ui-angular/pom.xml | 32 ++++++++++++++++++++++++--------
pollen-ui-angular/src/test/karma.conf.js | 1 +
4 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/pollen-ui-angular/bower.json b/pollen-ui-angular/bower.json
index c2d33f7..7261c1b 100644
--- a/pollen-ui-angular/bower.json
+++ b/pollen-ui-angular/bower.json
@@ -20,5 +20,8 @@
"jqplot": "*",
"ckeditor": "4.4.2",
"less": "1.7.3"
+ },
+ "devDependencies": {
+ "angular-mocks": "1.2.16"
}
}
diff --git a/pollen-ui-angular/package.json b/pollen-ui-angular/package.json
index 5ff1f26..db0d1c6 100644
--- a/pollen-ui-angular/package.json
+++ b/pollen-ui-angular/package.json
@@ -15,5 +15,8 @@
"test": "karma start src/test/karma.conf.js"
},
"author": "garandel",
- "license": "AGPL"
+ "license": "AGPL",
+ "dependencies": {
+ "bower": "^1.3.8"
+ }
}
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index ff50ec3..f224a33 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -26,22 +26,37 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.3.1</version>
<executions>
<execution>
+ <id>npm</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
+ <configuration>
+ <executable>npm</executable>
+ <arguments>
+ <argument>install</argument>
+ </arguments>
+ <workingDirectory>${basedir}</workingDirectory>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>bower</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>bower</executable>
+ <arguments>
+ <argument>install</argument>
+ </arguments>
+ <workingDirectory>${basedir}</workingDirectory>
+ </configuration>
</execution>
</executions>
- <configuration>
- <executable>bower</executable>
- <arguments>
- <argument>install</argument>
- </arguments>
- <workingDirectory>${basedir}</workingDirectory>
- </configuration>
</plugin>
<plugin>
@@ -81,6 +96,7 @@
<configuration>
<karmaExecutable>${basedir}/node_modules/karma/bin/karma</karmaExecutable>
<configFile>src/test/karma.conf.js</configFile>
+ <junitReportFile>target/test-results.xml</junitReportFile>
<reportsDirectory>${project.build.directory}/karma-reports</reportsDirectory>
<browsers>PhantomJS</browsers>
<autoWatch>false</autoWatch>
diff --git a/pollen-ui-angular/src/test/karma.conf.js b/pollen-ui-angular/src/test/karma.conf.js
index 7274e8e..69eca3a 100644
--- a/pollen-ui-angular/src/test/karma.conf.js
+++ b/pollen-ui-angular/src/test/karma.conf.js
@@ -15,6 +15,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
+ 'src/main/webapp/js/conf.js.exemple', // fix conf is not defined for controller
'src/main/webapp/lib/jquery/dist/jquery.min.js',
'src/main/webapp/lib/jqplot/jquery.jqplot.min.js',
'src/main/webapp/lib/jqplot/plugins/jqplot.barRenderer.min.js',
--
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 feature/unitTest in repository pollen.
See http://git.chorem.org/pollen.git
commit e0c165a2e467d453da2cf2e812dcf4f56f59ac68
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jul 15 17:26:39 2014 +0200
fix dependence
---
pollen-ui-angular/bower.json | 3 +++
pollen-ui-angular/package.json | 5 ++++-
pollen-ui-angular/pom.xml | 24 ++++++++++++++++++++----
pollen-ui-angular/src/test/karma.conf.js | 1 +
4 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/pollen-ui-angular/bower.json b/pollen-ui-angular/bower.json
index c2d33f7..7261c1b 100644
--- a/pollen-ui-angular/bower.json
+++ b/pollen-ui-angular/bower.json
@@ -20,5 +20,8 @@
"jqplot": "*",
"ckeditor": "4.4.2",
"less": "1.7.3"
+ },
+ "devDependencies": {
+ "angular-mocks": "1.2.16"
}
}
diff --git a/pollen-ui-angular/package.json b/pollen-ui-angular/package.json
index 5ff1f26..db0d1c6 100644
--- a/pollen-ui-angular/package.json
+++ b/pollen-ui-angular/package.json
@@ -15,5 +15,8 @@
"test": "karma start src/test/karma.conf.js"
},
"author": "garandel",
- "license": "AGPL"
+ "license": "AGPL",
+ "dependencies": {
+ "bower": "^1.3.8"
+ }
}
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index ff50ec3..0695181 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -33,13 +33,28 @@
<goals>
<goal>exec</goal>
</goals>
+ <configuration>
+ <executable>npm</executable>
+ <arguments>
+ <argument>install</argument>
+ </arguments>
+ </configuration>
+ </execution>
+
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>bower</executable>
+ <arguments>
+ <argument>install</argument>
+ </arguments>
+ </configuration>
</execution>
</executions>
<configuration>
- <executable>bower</executable>
- <arguments>
- <argument>install</argument>
- </arguments>
<workingDirectory>${basedir}</workingDirectory>
</configuration>
</plugin>
@@ -81,6 +96,7 @@
<configuration>
<karmaExecutable>${basedir}/node_modules/karma/bin/karma</karmaExecutable>
<configFile>src/test/karma.conf.js</configFile>
+ <junitReportFile>target/test-results.xml</junitReportFile>
<reportsDirectory>${project.build.directory}/karma-reports</reportsDirectory>
<browsers>PhantomJS</browsers>
<autoWatch>false</autoWatch>
diff --git a/pollen-ui-angular/src/test/karma.conf.js b/pollen-ui-angular/src/test/karma.conf.js
index 7274e8e..69eca3a 100644
--- a/pollen-ui-angular/src/test/karma.conf.js
+++ b/pollen-ui-angular/src/test/karma.conf.js
@@ -15,6 +15,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
+ 'src/main/webapp/js/conf.js.exemple', // fix conf is not defined for controller
'src/main/webapp/lib/jquery/dist/jquery.min.js',
'src/main/webapp/lib/jqplot/jquery.jqplot.min.js',
'src/main/webapp/lib/jqplot/plugins/jqplot.barRenderer.min.js',
--
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 feature/unitTest in repository pollen.
See http://git.chorem.org/pollen.git
commit 280bb61fac8049eb03b0748c3e558564bcfddfd4
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jul 15 16:35:34 2014 +0200
add test pollCtrl
---
pollen-ui-angular/.gitignore | 2 +
pollen-ui-angular/package.json | 19 ++
pollen-ui-angular/pom.xml | 27 +++
pollen-ui-angular/src/main/webapp/js/app.js | 4 +-
.../src/main/webapp/js/controllers/alertCtrl.js | 1 +
.../main/webapp/js/controllers/favoriteListCtrl.js | 2 +
.../src/main/webapp/js/controllers/localeCtrl.js | 2 +
.../src/main/webapp/js/controllers/mainCtrl.js | 4 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 135 +++++++------
.../src/main/webapp/js/controllers/userCtrl.js | 4 +-
pollen-ui-angular/src/main/webapp/js/directives.js | 35 +---
pollen-ui-angular/src/main/webapp/js/services.js | 36 ++++
pollen-ui-angular/src/test/karma.conf.js | 97 ++++++++++
.../src/test/unit/pollControllersTest.js | 214 +++++++++++++++++++++
14 files changed, 489 insertions(+), 93 deletions(-)
diff --git a/pollen-ui-angular/.gitignore b/pollen-ui-angular/.gitignore
index a3ec35a..1c7c2ba 100644
--- a/pollen-ui-angular/.gitignore
+++ b/pollen-ui-angular/.gitignore
@@ -1,4 +1,6 @@
*.iml
+node_modules/*
+test_out/*
src/main/webapp/lib
src/main/webapp/css/style.css
src/main/webapp/js/conf.js
diff --git a/pollen-ui-angular/package.json b/pollen-ui-angular/package.json
new file mode 100644
index 0000000..5ff1f26
--- /dev/null
+++ b/pollen-ui-angular/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "Pollen-test",
+ "version": "2.0.0",
+ "description": "",
+ "main": "src/test/karma.conf.js",
+ "devDependencies": {
+ "karma": "^0.12.17",
+ "karma-chrome-launcher": "^0.1.4",
+ "karma-firefox-launcher": "^0.1.3",
+ "karma-jasmine": "^0.1.5",
+ "karma-junit-reporter": "^0.2.2",
+ "karma-phantomjs-launcher": "^0.1.4"
+ },
+ "scripts": {
+ "test": "karma start src/test/karma.conf.js"
+ },
+ "author": "garandel",
+ "license": "AGPL"
+}
diff --git a/pollen-ui-angular/pom.xml b/pollen-ui-angular/pom.xml
index 3239320..ff50ec3 100644
--- a/pollen-ui-angular/pom.xml
+++ b/pollen-ui-angular/pom.xml
@@ -65,6 +65,33 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>com.kelveden</groupId>
+ <artifactId>maven-karma-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <karmaExecutable>${basedir}/node_modules/karma/bin/karma</karmaExecutable>
+ <configFile>src/test/karma.conf.js</configFile>
+ <reportsDirectory>${project.build.directory}/karma-reports</reportsDirectory>
+ <browsers>PhantomJS</browsers>
+ <autoWatch>false</autoWatch>
+ <singleRun>true</singleRun>
+ <colors>true</colors>
+ <skipKarma>false</skipKarma>
+ <skipTests>false</skipTests>
+ <karmaFailureIgnore>false</karmaFailureIgnore>
+ <reporters>dots,junit</reporters>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 28ff905..ef73d67 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -18,7 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-var pollen = angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'alertControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
+'use strict';
+
+angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'PollenMainControllers', '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/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
index a6ea298..81a5802 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js
@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+'use strict';
angular.module('alertControllers', [])
.controller('printAlertCtrl', ['$scope', '$timeout',
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
index 932e82c..1477c4b 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+'use strict';
+
angular.module('favoriteListControllers', [])
.controller('FavoriteListCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', 'Page',
function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, Page) {
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 524e3ef..47667e8 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+'use strict';
+
angular.module('localeControllers', [])
.controller('LocaleCtrl', ['$scope', '$rootScope', '$translate', 'SessionStorage', '$locale', function ($scope, $rootScope, $translate, SessionStorage, $locale) {
$scope.debug = conf.debug;
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
index d0ccb2a..38d47af 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
@@ -1,4 +1,6 @@
-pollen.controller('MainCtrl', ['$scope', 'Page',
+'use strict';
+
+angular.module('PollenMainControllers', ['pollenServices']).controller('MainCtrl', ['$scope', 'Page',
function ($scope, Page) {
$scope.$on('titleChange', function () {
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 4a691b1..dafeadf 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -18,7 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-angular.module('pollControllers', [])
+'use strict';
+
+angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.translate', 'ui.bootstrap'])
.controller('HomeCtrl', ['$scope', 'Poll', 'Page', function ($scope, Poll, Page) {
Page.setTitle('title.home');
Poll.skeletonNew();
@@ -172,13 +174,22 @@ angular.module('pollControllers', [])
}; initTemplateURL();
var lastRoute = $route.current;
- $scope.$on('$locationChangeSuccess', function(event) {
- if (lastRoute.$$route.controller == $route.current.$$route.controller) {
- $route.current = lastRoute;
- }
+ $timeout(function() {
+ $scope.$on('$locationChangeSuccess', function(event) {
+ if (lastRoute.$$route.controller == $route.current.$$route.controller) {
+ $route.current = lastRoute;
+ }
+ });
});
+ $scope.voteCountingIsBoolean = function () {
+ if (angular.isDefined($scope.data.voteCountingType)) {
+ return $scope.data.voteCountingType.renderType == 'checkbox';
+ }
+ return false;
+ }
+
$scope.getChoiceValue = function (choiceValue) {
if ($scope.voteCountingIsBoolean()) {
return (choiceValue)?true:false;
@@ -198,7 +209,12 @@ angular.module('pollControllers', [])
$scope.preSendChoice = function (choice) {
if (choice.choiceType == 'DATE') {
- choice.choiceValue = choice.choiceValue.getTime();
+ if (angular.isDate(choice.choiceValue)) {
+ choice.choiceValue = choice.choiceValue.getTime();
+ }
+ else {
+ choice.choiceValue = null;
+ }
}
else if (choice.choiceType == 'IMAGE') {
try {
@@ -216,7 +232,9 @@ angular.module('pollControllers', [])
choice.choiceValue = new Date(Number(choice.choiceValue));
}
else if (choice.choiceType == 'IMAGE') {
- PollenResource.getMeta({resourceId : choice.choiceValue}, function (data) {
+ var resourceId = choice.choiceValue;
+ choice.choiceValue = {meta:{id:resourceId}, data:conf.restURL+'/resources/'+resourceId, id: resourceId};
+ PollenResource.getMeta({resourceId : resourceId}, function (data) {
choice.choiceValue = {meta:data, data : conf.restURL+'/resources/'+data.id, id : data.id};
});
}
@@ -246,13 +264,6 @@ angular.module('pollControllers', [])
});
});
- $scope.voteCountingIsBoolean = function () {
- if (angular.isDefined($scope.data.voteCountingType)) {
- return $scope.data.voteCountingType.renderType == 'checkbox';
- }
- return false;
- }
-
$scope.deletePoll = function () {
if (angular.isDefined($scope.data.poll.id)) {
var confirmMessage;
@@ -299,7 +310,8 @@ angular.module('pollControllers', [])
}])
-.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$timeout', '$routeParams', 'Poll', function ($scope, $controller, $modal, $timeout, $routeParams, Poll) {
+.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$timeout', '$routeParams', 'Poll',
+ function ($scope, $controller, $modal, $timeout, $routeParams, Poll) {
$controller('PollCtrl', {$scope:$scope});
$scope.tab = $scope.setTab('edit');
@@ -329,26 +341,28 @@ angular.module('pollControllers', [])
$scope.data.voterList = [];
$scope.data.voterList.push(newGroup());
- $scope.$watch('data.poll.pollType', function (newVal, oldVal) {
- if (newVal != oldVal && newVal == 'RESTRICTED') {
- var listMember = [];
- for (var i = 0; i < $scope.data.voterList.length; i++) {
- for (var j = 0; j < $scope.data.voterList[i].members.length; j++) {
- // check if not a empty line
- if ($scope.data.voterList[i].members[j].email != '' || $scope.data.voterList[i].members[j].name != '') {
- listMember.push($scope.data.voterList[i].members[j]);
+ $timeout(function () {
+ $scope.$watch('data.poll.pollType', function (newVal, oldVal) {
+ if (newVal != oldVal && newVal == 'RESTRICTED') {
+ var listMember = [];
+ for (var i = 0; i < $scope.data.voterList.length; i++) {
+ for (var j = 0; j < $scope.data.voterList[i].members.length; j++) {
+ // check if not a empty line
+ if ($scope.data.voterList[i].members[j].email != '' || $scope.data.voterList[i].members[j].name != '') {
+ listMember.push($scope.data.voterList[i].members[j]);
+ }
}
}
- }
- // get the first group
- $scope.data.voterList = $scope.data.voterList.splice(0,1);
+ // get the first group
+ $scope.data.voterList = $scope.data.voterList.splice(0,1);
- // check if one voter is enter in one group
- if (listMember.length > 0) {
- $scope.data.voterList[0].members = listMember;
+ // check if one voter is enter in one group
+ if (listMember.length > 0) {
+ $scope.data.voterList[0].members = listMember;
+ }
}
- }
+ });
});
$scope.addVoter = function (index) {
@@ -502,8 +516,10 @@ angular.module('pollControllers', [])
});
};
- $scope.$on('switchLocale', function() {
- initVoteCountingType();
+ $timeout(function () {
+ $scope.$on('switchLocale', function() {
+ initVoteCountingType();
+ });
});
$timeout(function () {
@@ -527,7 +543,6 @@ angular.module('pollControllers', [])
$scope.data.choices = [];
$scope.data.vote = {};
$scope.data.vote.choices = $scope.data.choices;
- $scope.restRequest = poll;
});
}
initPoll();
@@ -590,7 +605,7 @@ angular.module('pollControllers', [])
////////////////////////////////
$scope.callBackAddChoice = function (choice) {
- saveChoice = angular.copy(choice);
+ var saveChoice = angular.copy(choice);
saveChoice = $scope.preSendChoice(saveChoice);
@@ -604,7 +619,7 @@ angular.module('pollControllers', [])
}
$scope.callBackEditChoice = function (choice) {
- saveChoice = angular.copy(choice);
+ var saveChoice = angular.copy(choice);
saveChoice = $scope.preSendChoice(saveChoice);
@@ -1072,8 +1087,8 @@ angular.module('pollControllers', [])
}])
.controller('PollCommentCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$location', 'Page',
- function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $location, Page) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$timeout', '$location', 'Page',
+ function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $timeout, $location, Page) {
$controller('PollCtrl', {$scope:$scope});
Page.setTitle('title.poll.comment');
@@ -1133,13 +1148,15 @@ angular.module('pollControllers', [])
return commentPromise;
}; initComments();
- $scope.$watch('data.commentsPagination.currentPage', function (newVal, oldVal) {
- if (angular.isDefined(oldVal) && newVal != oldVal) { // Value change
- if (paginationParameter.pageNumber != $scope.data.commentsPagination.currentPage) { // not same page
- paginationParameter.pageNumber = $scope.data.commentsPagination.currentPage;
- initComments();
+ $timeout(function () {
+ $scope.$watch('data.commentsPagination.currentPage', function (newVal, oldVal) {
+ if (angular.isDefined(oldVal) && newVal != oldVal) { // Value change
+ if (paginationParameter.pageNumber != $scope.data.commentsPagination.currentPage) { // not same page
+ paginationParameter.pageNumber = $scope.data.commentsPagination.currentPage;
+ initComments();
+ }
}
- }
+ });
});
$scope.postComment = function () {
@@ -1225,8 +1242,8 @@ angular.module('pollControllers', [])
}])
-.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$route', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', 'Page',
- function ($scope, $q, $controller, $route, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, Page) {
+.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$route', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', '$timeout', 'Page',
+ function ($scope, $q, $controller, $route, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, $timeout, Page) {
$controller('PollCtrl', {$scope:$scope});
Page.setTitle('title.poll.result');
@@ -1240,9 +1257,11 @@ angular.module('pollControllers', [])
$scope.tab = $scope.setTab('result');
$scope.plot = 'chart';
- $scope.$on('switchLocale', function() {
- $route.reload();
- })
+ $timeout(function () {
+ $scope.$on('switchLocale', function() {
+ $route.reload();
+ });
+ });
var choicesDeferred = $q.defer();
PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
@@ -1309,8 +1328,8 @@ angular.module('pollControllers', [])
}])
.controller('PollListCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll', 'Page',
- function ($scope, $rootScope, $controller, $routeParams, $location, Poll, Page) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', '$timeout', '$location', 'Poll', 'Page',
+ function ($scope, $rootScope, $controller, $routeParams, $timeout, $location, Poll, Page) {
$scope.data = {};
Page.setTitle('title.poll.list');
@@ -1342,13 +1361,15 @@ angular.module('pollControllers', [])
});
}; initPolls();
- $scope.$watch('data.pollsPagination.currentPage', function (newVal, oldVal) {
- // check if the current page has changed
- if (angular.isDefined(oldVal) && newVal != oldVal) {
- paginationParameter.pageNumber = $scope.data.pollsPagination.currentPage;
- initPolls();
- }
- });
+ $timeout(function () {
+ $scope.$watch('data.pollsPagination.currentPage', function (newVal, oldVal) {
+ // check if the current page has changed
+ if (angular.isDefined(oldVal) && newVal != oldVal) {
+ paginationParameter.pageNumber = $scope.data.pollsPagination.currentPage;
+ initPolls();
+ }
+ });
+ })
}])
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
index a64dad8..d93ee6a 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -18,7 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
- angular.module('userControllers', [])
+'use strict';
+
+angular.module('userControllers', [])
.controller('UserRegisterCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage', 'Page',
function ($scope, $rootScope, $location, User, SessionStorage, Page) {
Page.setTitle('title.user.register');
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index b5dd14c..478f369 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -18,40 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-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;
- }
+'use strict';
- return makeTitle;
- },
- setTitle: function(newTitle, newValue) {
- title = newTitle;
- value = newValue;
- $rootScope.$broadcast('titleChange');
- },
- setValue: function(newValue) {
- value = newValue;
- $rootScope.$broadcast('titleChange');
- }
- };
-}])
+angular.module('pollenDirective', [])
//////////////////////////////////////
///// FOCUS ME /////
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index 78b6ffa..fc4fef3 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+'use strict';
+
angular.module('pollenServices', ['ngResource'])
//////////////////////////////////////
@@ -417,4 +419,38 @@ angular.module('pollenServices', ['ngResource'])
}
}
}
+}])
+
+
+//////////////////////////////////////
+///// 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');
+ }
+ };
}])
\ No newline at end of file
diff --git a/pollen-ui-angular/src/test/karma.conf.js b/pollen-ui-angular/src/test/karma.conf.js
new file mode 100644
index 0000000..7274e8e
--- /dev/null
+++ b/pollen-ui-angular/src/test/karma.conf.js
@@ -0,0 +1,97 @@
+// Karma configuration
+// Generated on Tue Jul 15 2014 10:21:18 GMT+0200 (CEST)
+
+module.exports = function(config) {
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '../../',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'src/main/webapp/lib/jquery/dist/jquery.min.js',
+ 'src/main/webapp/lib/jqplot/jquery.jqplot.min.js',
+ 'src/main/webapp/lib/jqplot/plugins/jqplot.barRenderer.min.js',
+ 'src/main/webapp/lib/jqplot/plugins/jqplot.pieRenderer.min.js',
+ 'src/main/webapp/lib/jqplot/plugins/jqplot.categoryAxisRenderer.min.js',
+ 'src/main/webapp/lib/jqplot/plugins/jqplot.pointLabels.min.js',
+ 'src/main/webapp/lib/jqplot/plugins/jqplot.highlighter.min.js',
+ 'src/main/webapp/lib/ckeditor/ckeditor.js',
+ 'src/main/webapp/lib/angular/angular.js',
+ 'src/main/webapp/lib/angular-mocks/angular-mocks.js',
+ 'src/main/webapp/lib/angular-bootstrap/ui-bootstrap-tpls.js',
+ 'src/main/webapp/lib/angular-resource/angular-resource.js',
+ 'src/main/webapp/lib/angular-route/angular-route.js',
+ 'src/main/webapp/lib/angular-translate/angular-translate.js',
+ 'src/main/webapp/lib/angular-animate/angular-animate.js',
+ 'src/main/webapp/js/*.js',
+ 'src/main/webapp/js/**/*.js',
+ 'src/main/webapp/i18n/*.js',
+ 'src/test/unit/**/*.js'
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+
+ },
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['progress'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: true,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['Chrome', 'Firefox', 'PhantomJS'],
+
+ plugins : [
+ 'karma-chrome-launcher',
+ 'karma-firefox-launcher',
+ 'karma-phantomjs-launcher',
+ 'karma-jasmine',
+ 'karma-junit-reporter'
+ ],
+
+ junitReporter : {
+ outputFile: 'test_out/unit.xml',
+ suite: 'unit'
+ },
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: false
+ });
+};
+
diff --git a/pollen-ui-angular/src/test/unit/pollControllersTest.js b/pollen-ui-angular/src/test/unit/pollControllersTest.js
new file mode 100644
index 0000000..f4bb7b3
--- /dev/null
+++ b/pollen-ui-angular/src/test/unit/pollControllersTest.js
@@ -0,0 +1,214 @@
+'use strict';
+
+////////////////////////////
+///// TEST PollCtrl ////
+////////////////////////////
+
+describe('Test pollCtrl', function () {
+ beforeEach(module('pollControllers'));
+ beforeEach(inject(function($controller) {
+ $scope = {};
+ ctrl = $controller('PollCtrl', {$scope: $scope});
+ }));
+
+ var $scope = {};
+ var ctrl = null;
+ it('should load PollCtrl', function () {
+ expect(ctrl).toBeDefined();
+ expect(ctrl).not.toBeNull();
+
+ });
+
+ it('should set good default tab', function() {
+
+ expect($scope.tab).toEqual('home');
+ });
+
+ it('should set good default dateFormat', function() {
+ expect($scope.globalVariables.dateFormat).not.toBeNull();
+ expect($scope.globalVariables.dateFormat).toBeDefined();
+
+ expect($scope.globalVariables.timeFormat).not.toBeNull();
+ expect($scope.globalVariables.timeFormat).toBeDefined;
+
+ expect($scope.globalVariables.dateTimeFormat).not.toBeNull();
+ expect($scope.globalVariables.dateTimeFormat).toBeDefined();
+ });
+
+ it('should set good template url', function () {
+ expect($scope.templateURL).toBeDefined();
+ expect($scope.templateURL).not.toBeNull();
+ });
+
+
+ it('should get good voteCounting', function () {
+ // voteCounting boolean
+ runs(function () {
+ $scope.data.voteCountingType = {renderType:'checkbox'};
+ expect($scope.voteCountingIsBoolean()).toBeTruthy();
+ });
+
+ // voteCounting not boolean
+ runs(function () {
+ $scope.data.voteCountingType = {renderType: 'text'};
+ expect($scope.voteCountingIsBoolean()).toBeFalsy();
+ });
+ });
+
+ it('should get good choiceValue', function () {
+ // voteCounting boolean
+ runs(function () {
+ $scope.data.voteCountingType = {renderType:'checkbox'};
+
+ var valueOf1 = $scope.getChoiceValue(1.0);
+ expect(valueOf1).toBeTruthy();
+ var valueOf2 = $scope.getChoiceValue(2.0);
+ expect(valueOf2).toBeTruthy();
+
+ var valueOf0 = $scope.getChoiceValue(0.0);
+ expect(valueOf0).toBeFalsy();
+
+ var valueOfTrue = $scope.getChoiceValue(true);
+ expect(valueOfTrue).toBeTruthy();
+ var valueOfFalse = $scope.getChoiceValue(false);
+ expect(valueOfFalse).toBeFalsy();
+
+ });
+
+ // voteCounting not boolean
+ runs(function () {
+ $scope.data.voteCountingType = {renderType: 'text'};
+
+ var valueOf1 = $scope.getChoiceValue(1.0);
+ expect(valueOf1).toEqual(1.0);
+
+ var valueOf0 = $scope.getChoiceValue(0.0);
+ expect($scope.getChoiceValue(0.0)).toEqual(0.0);
+
+ var valueOfTrue = $scope.getChoiceValue(true);
+ expect(valueOfTrue).toEqual(1.0);
+
+ var valueOfFalse = $scope.getChoiceValue(false)
+ expect(valueOfFalse).toEqual(0.0);
+
+ });
+ });
+
+ it('should prepare good choice before send', function () {
+ // choice type text
+ runs(function () {
+ var makeChoice = {choiceType:'TEXT', choiceValue:'value of this choice'};
+ var sendChoice = $scope.preSendChoice(makeChoice);
+
+ expect(sendChoice).toEqual(makeChoice);
+ });
+
+ // choice type date
+ runs(function () {
+ var date = new Date();
+ var makeChoice, sendChoice;
+
+ makeChoice = {choiceType:'DATE', choiceValue: 'not a date'};
+ sendChoice = $scope.preSendChoice(makeChoice);
+
+ expect(sendChoice.choiceValue).toBeNull();
+ expect(sendChoice.choiceType).toEqual('DATE');
+
+ makeChoice.choiceValue = date;
+ sendChoice = $scope.preSendChoice(makeChoice);
+
+ expect(sendChoice.choiceValue).toEqual(date.getTime());
+ expect(sendChoice.choiceType).toEqual('DATE');
+
+ });
+
+ // choice type image
+ runs(function () {
+ var makeChoice, sendChoice;
+
+ makeChoice = {choiceType:'IMAGE', choiceValue:'not an image'};
+ sendChoice = $scope.preSendChoice(makeChoice);
+
+ expect(sendChoice.choiceValue).toBeNull();
+ expect(sendChoice.choiceType).toEqual('IMAGE');
+
+ makeChoice.choiceValue = {meta:{name:'image.png', id:'shortTopiaId'}, data:'urlpicture', id:'shortTopiaId'};
+ sendChoice = $scope.preSendChoice(makeChoice);
+
+ expect(sendChoice.choiceValue).toEqual('shortTopiaId');
+ expect(sendChoice.choiceType).toEqual('IMAGE');
+ });
+ });
+
+ it('should good receive choice', function () {
+ // choice type text
+ runs(function () {
+ var makeChoice = {choiceType:'TEXT', choiceValue:'value of this choice'};
+ var receiveChoice = $scope.postReceiveChoice(makeChoice);
+
+ expect(receiveChoice).toEqual(makeChoice);
+ });
+
+ // choice type date
+ runs(function () {
+ var date = new Date(1405461600000);
+ var makeChoice, receiveChoice;
+
+ makeChoice = {choiceType:'DATE', choiceValue: "1405461600000"};
+ receiveChoice = $scope.postReceiveChoice(makeChoice);
+
+ expect(receiveChoice.choiceValue).toEqual(date);;
+ expect(receiveChoice.choiceType).toEqual('DATE');
+
+ });
+
+ // choice type image
+ runs(function () {
+ var makeChoice, receiveChoice;
+
+ makeChoice = {choiceType:'IMAGE', choiceValue:'shortTopiaId'};
+ receiveChoice = $scope.postReceiveChoice(makeChoice);
+
+ expect(receiveChoice.choiceValue.id).toEqual('shortTopiaId');
+ expect(receiveChoice.choiceValue.meta.id).toEqual('shortTopiaId');
+ expect(receiveChoice.choiceValue.data).toEqual(conf.restURL+'/resources/shortTopiaId');
+ expect(receiveChoice.choiceType).toEqual('IMAGE');
+ });
+ });
+
+});
+
+describe('load poll controllers', function () {
+ beforeEach(module('pollControllers'));
+
+ it('should load PollCreateCtrl', inject(function($controller) {
+ var ctrl = $controller('PollCreateCtrl', {$scope:{}});
+ expect(ctrl).toBeDefined();
+ }));
+
+ it('should load PollEditCtrl', inject(function($controller) {
+ var ctrl = $controller('PollEditCtrl', {$scope:{}});
+ expect(ctrl).toBeDefined();
+ }));
+
+ it('should load PollVoteCtrl', inject(function($controller) {
+ var ctrl = $controller('PollVoteCtrl', {$scope:{}});
+ expect(ctrl).toBeDefined();
+ }));
+
+ it('should load PollResultCtrl', inject(function($controller) {
+ var ctrl = $controller('PollResultCtrl', {$scope:{}});
+ expect(ctrl).toBeDefined();
+ }));
+
+ it('should load PollCommentCtrl', inject(function($controller) {
+ var ctrl = $controller('PollCommentCtrl', {$scope:{}});
+ expect(ctrl).toBeDefined();
+ }));
+
+ it('should load PollListCtrl', inject(function($controller) {
+ var ctrl = $controller('PollListCtrl', {$scope:{}});
+ expect(ctrl).toBeDefined();
+ }));
+
+})
\ 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
July 11, 2014
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 09e95b1b8bfe4f51e374da4e394d40e30ebd291a
Merge: 5fcf5d3 16d92db
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 18:11:30 2014 +0200
Merge branch 'feature/addPollenResourceApi' into develop
pollen-persistence/src/main/xmi/pollen.properties | 1 -
pollen-persistence/src/main/xmi/pollen.zargo | Bin 20233 -> 20385 bytes
.../pollen/rest/api/v1/PollenResourceApi.java | 77 +++++++++++++++
pollen-rest-api/src/main/resources/mapping | 9 ++
.../pollen/services/bean/ResourceFileBean.java | 108 +++++++++++++++++++++
.../pollen/services/bean/ResourceMetaBean.java | 68 +++++++++++++
.../pollen/services/bean/ResourceStreamBean.java | 102 +++++++++++++++++++
.../pollen/services/service/ChoiceService.java | 20 +++-
.../services/service/PollenResourceService.java | 106 ++++++++++++++++++++
.../services/service/PollenServiceSupport.java | 22 ++---
.../src/main/webapp/js/controllers/pollCtrl.js | 24 ++---
pollen-ui-angular/src/main/webapp/js/directives.js | 12 ++-
pollen-ui-angular/src/main/webapp/js/services.js | 21 ++++
.../src/main/webapp/partials/home.html | 2 +-
14 files changed, 537 insertions(+), 35 deletions(-)
--
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 16d92db9e22dad32f48d6e4a13e88c30c306a923
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 18:07:02 2014 +0200
try to gzip Resource
---
.../org/chorem/pollen/services/bean/ResourceFileBean.java | 12 +++++++++++-
.../src/main/webapp/js/controllers/pollCtrl.js | 14 +++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
index 5997c2e..ff3ad7f 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
@@ -11,6 +11,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.ZipException;
/**
* Created on 11/07/14.
@@ -92,7 +94,15 @@ public class ResourceFileBean extends PollenBean<PollenResource> {
}
public Blob getResourceBlob() throws IOException, SQLException {
- InputStream stream = new FileInputStream(getFile());
+ InputStream stream;
+
+ try {
+ stream = new GZIPInputStream(new FileInputStream(getFile()));
+ }
+ catch (ZipException e) {
+ stream = new FileInputStream(getFile());
+ }
+
return new SerialBlob(IOUtils.toByteArray(stream));
}
}
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 1230902..4a691b1 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -201,7 +201,11 @@ angular.module('pollControllers', [])
choice.choiceValue = choice.choiceValue.getTime();
}
else if (choice.choiceType == 'IMAGE') {
- choice.choiceValue = choice.choiceValue.meta.id;
+ try {
+ choice.choiceValue = choice.choiceValue.meta.id;
+ } catch (e) {
+ choice.choiceValue = null;
+ }
}
return choice;
@@ -556,12 +560,8 @@ angular.module('pollControllers', [])
$scope.globalVariables.restError = true;
$scope.restError = error.data;
angular.forEach($scope.data.choices, function (choice, index) {
- if (angular.isDefined(error.data['choice['+index+'].name'])) {
- choice.restError = {name:error.data['choice['+index+'].name']};
- }
-
- if (angular.isDefined(error.data['choice['+index+'].date'])) {
- choice.restError = {date:error.data['choice['+index+'].date']};
+ if (angular.isDefined(error.data['choice['+index+'].choiceValue'])) {
+ choice.restError = {choiceValue:error.data['choice['+index+'].choiceValue']};
}
});
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 11, 2014
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 5fcf5d38e64c33efec2e002ebc68a1a65427e621
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 18:09:32 2014 +0200
rename error choice[.].value to choice[.].choiceValue
---
.../java/org/chorem/pollen/services/service/ChoiceService.java | 10 +++++-----
.../org/chorem/pollen/services/service/PollServiceTest.java | 4 ++--
2 files changed, 7 insertions(+), 7 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 b08c1c5..30dffdc 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
@@ -295,13 +295,13 @@ public class ChoiceService extends PollenServiceSupport {
String choiceName = choice.getChoiceValue();
boolean nameNotBlank = checkNotBlank(errors,
- "value",
+ "choiceValue",
choiceName,
l(getLocale(), "pollen.error.choice.choiceNameEmpty"));
if (nameNotBlank) {
boolean nameAdded = choiceNames.add(choiceName);
- check(errors, "value", nameAdded, l(getLocale(), "pollen.error.choice.choiceNameExist"));
+ check(errors, "choiceValue", nameAdded, l(getLocale(), "pollen.error.choice.choiceNameExist"));
}
break;
@@ -311,18 +311,18 @@ public class ChoiceService extends PollenServiceSupport {
boolean dateNotBlank;
if (choiceDate == null) {
- dateNotBlank = checkNotBlank(errors, "value", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
+ dateNotBlank = checkNotBlank(errors, "choiceValue", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
}
else {
dateNotBlank = checkNotBlank(errors,
- "value",
+ "choiceValue",
String.valueOf(choiceDate),
l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
}
if (dateNotBlank) {
boolean dateAdded = choiceNames.add(String.valueOf(choiceDate.getTime()));
- check(errors, "value", dateAdded, l(getLocale(), "pollen.error.choice.choiceDateExist"));
+ check(errors, "choiceValue", 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 3d17723..41fbce4 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].value");
+ assertErrorKeyFound(e, "choice[0].choiceValue");
}
choice1.setChoiceValue("A");
@@ -187,7 +187,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
Assert.fail();
} catch (InvalidFormException e) {
// duplicated choice name
- assertErrorKeyFound(e, "choice[1].value");
+ assertErrorKeyFound(e, "choice[1].choiceValue");
}
choice2.setChoiceValue("B");
--
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 df5fe08ea1c66506b760b37f1ce96e1fb127a3c2
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Fri Jul 11 17:42:52 2014 +0200
use new Version object from nuiton-utils
---
.../java/org/chorem/pollen/services/config/PollenServiceConfig.java | 4 ++--
.../org/chorem/pollen/services/config/PollenServiceConfigOption.java | 2 +-
pom.xml | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java b/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java
index 5834964..bf52f86 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java
@@ -37,7 +37,7 @@ import org.chorem.pollen.persistence.entity.VoteVisibility;
import org.chorem.pollen.services.PollenTechnicalException;
import org.nuiton.config.ApplicationConfig;
import org.nuiton.config.ArgumentsParserException;
-import org.nuiton.util.Version;
+import org.nuiton.util.version.Version;
import java.io.File;
import java.util.List;
@@ -227,6 +227,6 @@ public class PollenServiceConfig {
}
public Version getVersion() {
- return applicationConfig.getOptionAsVersion(PollenServiceConfigOption.APPLICATION_VERSION.key);
+ return applicationConfig.getOption(Version.class, PollenServiceConfigOption.APPLICATION_VERSION.key);
}
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java b/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java
index 3193322..a3c2208 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java
@@ -29,7 +29,7 @@ import org.chorem.pollen.persistence.entity.PollType;
import org.chorem.pollen.persistence.entity.ResultVisibility;
import org.chorem.pollen.persistence.entity.VoteVisibility;
import org.nuiton.config.ConfigOptionDef;
-import org.nuiton.util.Version;
+import org.nuiton.util.version.Version;
import java.io.File;
diff --git a/pom.xml b/pom.xml
index 828fae2..cdead1e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>5.0.8</version>
+ <version>5.0.9</version>
</parent>
<groupId>org.chorem</groupId>
@@ -167,7 +167,7 @@
<topiaVersion>3.0-SNAPSHOT</topiaVersion>
<nuitonWebVersion>1.17-SNAPSHOT</nuitonWebVersion>
- <nuitonUtilsVersion>3.0-rc-3</nuitonUtilsVersion>
+ <nuitonUtilsVersion>3.0-SNAPSHOT</nuitonUtilsVersion>
<nuitonConfigVersion>3.0-alpha-2</nuitonConfigVersion>
<nuitonCsvVersion>3.0-alpha-3</nuitonCsvVersion>
<nuitonValidatorVersion>3.0-alpha-1</nuitonValidatorVersion>
--
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 feature/addPollenResourceApi in repository pollen.
See http://git.chorem.org/pollen.git
commit 91c71bbf77d40085fecf089136b84906f14119f8
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 17:05:03 2014 +0200
auto delete resource when delete choice
---
.../pollen/services/service/ChoiceService.java | 20 +++++++++++++++-----
.../services/service/PollenServiceSupport.java | 4 ++++
2 files changed, 19 insertions(+), 5 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 b08c1c5..f75e72e 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
@@ -26,13 +26,12 @@ package org.chorem.pollen.services.service;
import com.google.common.base.Function;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
-import org.chorem.pollen.persistence.entity.Choice;
-import org.chorem.pollen.persistence.entity.ChoiceTopiaDao;
-import org.chorem.pollen.persistence.entity.Poll;
-import org.chorem.pollen.persistence.entity.PollenPrincipal;
+import org.chorem.pollen.persistence.entity.*;
import org.chorem.pollen.services.bean.ChoiceBean;
+import org.chorem.pollen.services.bean.PollenEntityId;
import org.chorem.pollen.services.bean.PollenEntityRef;
import org.chorem.pollen.services.service.security.PermissionVerb;
+import org.nuiton.topia.persistence.TopiaIdFactory;
import java.util.Date;
import java.util.List;
@@ -173,7 +172,18 @@ public class ChoiceService extends PollenServiceSupport {
errors.failIfNotEmpty();
}
- //TODO Check if this is not the last choice, if so can not delete
+ if (choice.getChoiceType() == ChoiceType.IMAGE) {
+
+ PollenEntityId<PollenResource> resourceId = PollenEntityId.newId(PollenResource.class);
+ resourceId.setReducedId(choice.getChoiceValue());
+ TopiaIdFactory topiaIdFactory = serviceContext.getTopiaApplicationContext().getTopiaIdFactory();
+ resourceId.decode(topiaIdFactory);
+
+ PollenResource resource = getResourceService().getResource0(resourceId.getEntityId());
+
+ getPollenResourceDao().delete(resource);
+ }
+
getChoiceDao().delete(choice);
commit();
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java
index beb0dfa..71c2aca 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java
@@ -123,6 +123,10 @@ public abstract class PollenServiceSupport implements PollenService {
return newService(SecurityService.class);
}
+ protected PollenResourceService getResourceService() {
+ return newService(PollenResourceService.class);
+ }
+
protected PollenUserService getUserService() {
return newService(PollenUserService.class);
}
--
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 feature/addPollenResourceApi in repository pollen.
See http://git.chorem.org/pollen.git
commit b40b5af4f5f13ecb21875e087dda5a5cd2d73f1c
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 16:17:10 2014 +0200
delete tmp file
---
pollen-persistence/src/main/xmi/pollen.properties | 1 -
.../org/chorem/pollen/rest/api/v1/PollenResourceApi.java | 12 ++++++++++--
.../org/chorem/pollen/services/bean/ResourceFileBean.java | 6 ++++--
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties
index 7e82326..1a7496c 100644
--- a/pollen-persistence/src/main/xmi/pollen.properties
+++ b/pollen-persistence/src/main/xmi/pollen.properties
@@ -32,7 +32,6 @@ package.org.chorem.pollen.persistence.entity.stereotype=entity
# 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.choiceValue.tagValue.hibernateAttributeType=text
org.chorem.pollen.persistence.entity.Comment.attribute.text.tagValue.hibernateAttributeType=text
# Blob
diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java
index 7793994..7db0f32 100644
--- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java
+++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java
@@ -46,7 +46,11 @@ public class PollenResourceApi extends WebMotionController {
resourceBean.setContentType(resource.getContentType());
resourceBean.setSize(resource.getSize());
- return pollenResourceService.createResource(resourceBean);
+ PollenEntityRef<PollenResource> createRef = pollenResourceService.createResource(resourceBean);
+
+ resource.getFile().delete();
+
+ return createRef;
}
public PollenEntityRef<PollenResource> editResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId, UploadFile resource) {
@@ -58,7 +62,11 @@ public class PollenResourceApi extends WebMotionController {
resourceBean.setContentType(resource.getContentType());
resourceBean.setSize(resource.getSize());
- return pollenResourceService.editResource(resourceId.getEntityId(), resourceBean);
+ PollenEntityRef<PollenResource> createRef = pollenResourceService.editResource(resourceId.getEntityId(), resourceBean);
+
+ resource.getFile().delete();
+
+ return createRef;
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
index c4c6498..5997c2e 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
@@ -5,8 +5,10 @@ import org.chorem.pollen.persistence.entity.PollenResource;
import org.chorem.pollen.persistence.entity.PollenResourceImpl;
import javax.sql.rowset.serial.SerialBlob;
-import javax.sql.rowset.serial.SerialException;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
--
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 03ae74080c9bf558774aefd9bafe567784ab019f
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 16:10:37 2014 +0200
update gitignore
---
.gitignore | 4 ----
pollen-ui-angular/.gitignore | 1 +
pollen-ui-js/.gitignore | 2 ++
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
index 5a36c89..3bd2c32 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,8 +7,4 @@ target/*
*/target/*
*~
*/*~
-pollen-ui-angular/src/main/webapp/js/conf.js
-
-pollen-ui-js/src/main/webapp/pollen-ui-js.css
-pollen-ui-js/src/main/webapp/pollen-ui-js.js
diff --git a/pollen-ui-angular/.gitignore b/pollen-ui-angular/.gitignore
index 5575e6a..a3ec35a 100644
--- a/pollen-ui-angular/.gitignore
+++ b/pollen-ui-angular/.gitignore
@@ -1,4 +1,5 @@
*.iml
src/main/webapp/lib
src/main/webapp/css/style.css
+src/main/webapp/js/conf.js
diff --git a/pollen-ui-js/.gitignore b/pollen-ui-js/.gitignore
new file mode 100644
index 0000000..74b4077
--- /dev/null
+++ b/pollen-ui-js/.gitignore
@@ -0,0 +1,2 @@
+src/main/webapp/pollen-ui-js.css
+src/main/webapp/pollen-ui-js.js
\ 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 feature/addPollenResourceApi in repository pollen.
See http://git.chorem.org/pollen.git
commit 3cf3443f15e6def8068ba2a52b9f75e2de42a747
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 15:08:37 2014 +0200
UI use PollenResourceApi
---
.../src/main/webapp/js/controllers/pollCtrl.js | 12 ++++++------
pollen-ui-angular/src/main/webapp/js/directives.js | 12 +++++++++---
pollen-ui-angular/src/main/webapp/js/services.js | 21 +++++++++++++++++++++
.../src/main/webapp/partials/home.html | 2 +-
4 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index c03f5a6..1230902 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -25,8 +25,8 @@ angular.module('pollControllers', [])
}])
.controller('PollCtrl',
- ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll', 'Page', 'DateFormat',
- function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, Page, DateFormat) {
+ ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll', 'PollenResource', 'Page', 'DateFormat',
+ function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, PollenResource, Page, DateFormat) {
$scope.setTab = function (defaultValue) {
if (angular.isDefined($routeParams.tab)) {
return $routeParams.tab;
@@ -201,7 +201,7 @@ angular.module('pollControllers', [])
choice.choiceValue = choice.choiceValue.getTime();
}
else if (choice.choiceType == 'IMAGE') {
- choice.choiceValue = choice.choiceValue.meta.name+"####"+choice.choiceValue.data;
+ choice.choiceValue = choice.choiceValue.meta.id;
}
return choice;
@@ -212,9 +212,9 @@ angular.module('pollControllers', [])
choice.choiceValue = new Date(Number(choice.choiceValue));
}
else if (choice.choiceType == 'IMAGE') {
- var tmp = choice.choiceValue.split("####");
-
- choice.choiceValue = {meta:{name:tmp[0]}, data : tmp[1]};
+ PollenResource.getMeta({resourceId : choice.choiceValue}, function (data) {
+ choice.choiceValue = {meta:data, data : conf.restURL+'/resources/'+data.id, id : data.id};
+ });
}
return choice;
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index 755eb81..b5dd14c 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -438,27 +438,33 @@ angular.module('pollenDirective', [])
///// UPLOAD FILE /////
//////////////////////////////////////
-.directive("uploadFile", function () {
+.directive("uploadFile", ["PollenResource", function (PollenResource) {
return {
restrict : "E",
scope: {
ngModel: "="
},
- template:'<input type="file" />',
+ template:'<form><input type="file" name="resource" /></form>',
link: function (scope, element, attrs) {
element.bind("change", function (changeEvent) {
var reader = new FileReader();
reader.onload = function (loadEvent) {
+ var formData = new FormData(element[0].firstChild);
scope.$apply(function () {
scope.ngModel = { meta: changeEvent.target.files[0], data: loadEvent.target.result};
});
+
+ PollenResource.upload(formData, function (response) {
+ scope.ngModel.meta.id = response.id;
+ });
+
}
reader.readAsDataURL( changeEvent.target.files[0] );
});
}
}
-})
+}])
//////////////////////////////////////
///// ZOOM IMAGE /////
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index a1303ab..78b6ffa 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -318,6 +318,27 @@ angular.module('pollenServices', ['ngResource'])
}])
//////////////////////////////////////
+///// RESOURCES FILE /////
+//////////////////////////////////////
+
+.factory('PollenResource', ['$resource', function ($resource) {
+ return $resource(conf.restURL+'/resources/:resourceId', null,
+ {
+ 'getMeta': {
+ method : 'GET',
+ url: conf.restURL+'/resources/:resourceId/meta'
+ },
+ 'upload' : {
+ method: 'POST',
+ transformRequest: angular.identity,
+ headers:{
+ 'Content-Type':undefined
+ }
+ }
+ });
+}])
+
+//////////////////////////////////////
///// SESSION STORAGE RESOURCE /////
//////////////////////////////////////
diff --git a/pollen-ui-angular/src/main/webapp/partials/home.html b/pollen-ui-angular/src/main/webapp/partials/home.html
index d5a161f..846d330 100644
--- a/pollen-ui-angular/src/main/webapp/partials/home.html
+++ b/pollen-ui-angular/src/main/webapp/partials/home.html
@@ -18,6 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<div class="hero-unit">
+<div>
<img src="img/pollen.png"/>
</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 feature/addPollenResourceApi in repository pollen.
See http://git.chorem.org/pollen.git
commit c23fd692907d494fee4963275941865a3a6d1e74
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 11 14:11:10 2014 +0200
add pollen resources api
---
pollen-persistence/src/main/xmi/pollen.zargo | Bin 20233 -> 20385 bytes
.../pollen/rest/api/v1/PollenResourceApi.java | 69 ++++++++++++++
pollen-rest-api/src/main/resources/mapping | 9 ++
.../pollen/services/bean/ResourceFileBean.java | 96 +++++++++++++++++++
.../pollen/services/bean/ResourceMetaBean.java | 68 +++++++++++++
.../pollen/services/bean/ResourceStreamBean.java | 102 ++++++++++++++++++++
.../services/service/PollenResourceService.java | 106 +++++++++++++++++++++
.../services/service/PollenServiceSupport.java | 18 +---
8 files changed, 455 insertions(+), 13 deletions(-)
diff --git a/pollen-persistence/src/main/xmi/pollen.zargo b/pollen-persistence/src/main/xmi/pollen.zargo
index 72a711c..a6810ea 100644
Binary files a/pollen-persistence/src/main/xmi/pollen.zargo and b/pollen-persistence/src/main/xmi/pollen.zargo differ
diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java
new file mode 100644
index 0000000..7793994
--- /dev/null
+++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java
@@ -0,0 +1,69 @@
+package org.chorem.pollen.rest.api.v1;
+
+import org.chorem.pollen.persistence.entity.PollenResource;
+import org.chorem.pollen.services.bean.*;
+import org.chorem.pollen.services.service.PollenResourceService;
+import org.debux.webmotion.server.WebMotionController;
+import org.debux.webmotion.server.call.UploadFile;
+import org.debux.webmotion.server.render.Render;
+
+import java.io.FileNotFoundException;
+
+/**
+ * Created on 10/07/14.
+ *
+ * @author dralagen
+ */
+public class PollenResourceApi extends WebMotionController {
+
+ public Render getResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId) throws FileNotFoundException {
+
+ ResourceStreamBean resource = pollenResourceService.getResource(resourceId.getEntityId());
+
+ return renderStream(resource.getResourceContent(), resource.getContentType());
+ }
+
+ public Render getPreviewResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId) {
+
+ ResourceStreamBean resource = pollenResourceService.getResource(resourceId.getEntityId());
+
+ return renderStream(resource.getResourceContent(), resource.getContentType());
+ }
+
+ public ResourceMetaBean getMetaResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId) {
+
+ ResourceMetaBean resource = pollenResourceService.getMetaResource(resourceId.getEntityId());
+
+ return resource;
+ }
+
+ public PollenEntityRef<PollenResource> createResource(PollenResourceService pollenResourceService, UploadFile resource) {
+
+ ResourceFileBean resourceBean = new ResourceFileBean();
+
+ resourceBean.setFile(resource.getFile());
+ resourceBean.setName(resource.getName());
+ resourceBean.setContentType(resource.getContentType());
+ resourceBean.setSize(resource.getSize());
+
+ return pollenResourceService.createResource(resourceBean);
+ }
+
+ public PollenEntityRef<PollenResource> editResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId, UploadFile resource) {
+
+ ResourceFileBean resourceBean = new ResourceFileBean();
+
+ resourceBean.setFile(resource.getFile());
+ resourceBean.setName(resource.getName());
+ resourceBean.setContentType(resource.getContentType());
+ resourceBean.setSize(resource.getSize());
+
+ return pollenResourceService.editResource(resourceId.getEntityId(), resourceBean);
+
+ }
+
+ public void deleteResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId) {
+
+ pollenResourceService.deleteResource(resourceId.getEntityId());
+ }
+}
diff --git a/pollen-rest-api/src/main/resources/mapping b/pollen-rest-api/src/main/resources/mapping
index 0c6b559..07e4877 100644
--- a/pollen-rest-api/src/main/resources/mapping
+++ b/pollen-rest-api/src/main/resources/mapping
@@ -114,6 +114,15 @@ POST /v1/polls/{pollId}/clone PollApi.clonePoll
GET /v1/polls/{pollId}/export PollApi.exportPoll
PUT /v1/polls/{pollId}/close PollApi.closePoll
+# PollenResourceApi
+
+GET /v1/resources/{resourceId} PollenResourceApi.getResource
+GET /v1/resources/{resourceId}/meta PollenResourceApi.getMetaResource
+GET /v1/resources/{resourceId}/preview PollenResourceApi.getPreviewResource
+POST /v1/resources PollenResourceApi.createResource
+POST /v1/resources/{resourceId} PollenResourceApi.editResource
+DELETE /v1/resources/{resourceId} PollenResourceApi.deleteResource
+
# PollenUserApi
GET /v1/users PollenUserApi.getUsers
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
new file mode 100644
index 0000000..c4c6498
--- /dev/null
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceFileBean.java
@@ -0,0 +1,96 @@
+package org.chorem.pollen.services.bean;
+
+import org.apache.commons.io.IOUtils;
+import org.chorem.pollen.persistence.entity.PollenResource;
+import org.chorem.pollen.persistence.entity.PollenResourceImpl;
+
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialException;
+import java.io.*;
+import java.sql.Blob;
+import java.sql.SQLException;
+
+/**
+ * Created on 11/07/14.
+ *
+ * @author dralagen
+ */
+public class ResourceFileBean extends PollenBean<PollenResource> {
+
+ protected File file;
+
+ protected String name;
+
+ protected long size;
+
+ protected String contentType;
+
+ public ResourceFileBean() {
+ super(PollenResource.class);
+ }
+
+ @Override
+ public void fromEntity(PollenResource entity) {
+ setEntityId(entity.getTopiaId());
+
+ setName(entity.getName());
+ setSize(entity.getSize());
+ setContentType(entity.getContentType());
+ }
+
+ @Override
+ public PollenResource toEntity() {
+ PollenResource entity = new PollenResourceImpl();
+
+ entity.setTopiaId(getEntityId());
+
+ try {
+ entity.setResourceContent(getResourceBlob());
+ } catch (IOException | SQLException e) {
+ e.printStackTrace();
+ }
+
+ entity.setName(getName());
+ entity.setSize(getSize());
+ entity.setContentType(getContentType());
+
+ return entity;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(long size) {
+ this.size = size;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public Blob getResourceBlob() throws IOException, SQLException {
+ InputStream stream = new FileInputStream(getFile());
+ return new SerialBlob(IOUtils.toByteArray(stream));
+ }
+}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceMetaBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceMetaBean.java
new file mode 100644
index 0000000..3243fa6
--- /dev/null
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceMetaBean.java
@@ -0,0 +1,68 @@
+package org.chorem.pollen.services.bean;
+
+import org.chorem.pollen.persistence.entity.PollenResource;
+import org.chorem.pollen.persistence.entity.PollenResourceImpl;
+
+/**
+ * Created on 11/07/14.
+ *
+ * @author dralagen
+ */
+public class ResourceMetaBean extends PollenBean<PollenResource> {
+
+ protected String name;
+
+ protected long size;
+
+ protected String contentType;
+
+ protected ResourceMetaBean() {
+ super(PollenResource.class);
+ }
+
+ @Override
+ public void fromEntity(PollenResource entity) {
+ setEntityId(entity.getTopiaId());
+
+ setName(entity.getName());
+ setSize(entity.getSize());
+ setContentType(entity.getContentType());
+ }
+
+ @Override
+ public PollenResource toEntity() {
+ PollenResource entity = new PollenResourceImpl();
+
+ entity.setTopiaId(getEntityId());
+
+ entity.setName(getName());
+ entity.setSize(getSize());
+ entity.setContentType(getContentType());
+
+ return entity;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(long size) {
+ this.size = size;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceStreamBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceStreamBean.java
new file mode 100644
index 0000000..a4b154d
--- /dev/null
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ResourceStreamBean.java
@@ -0,0 +1,102 @@
+package org.chorem.pollen.services.bean;
+
+import org.apache.commons.io.IOUtils;
+import org.chorem.pollen.persistence.entity.PollenResource;
+import org.chorem.pollen.persistence.entity.PollenResourceImpl;
+
+import javax.sql.rowset.serial.SerialBlob;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Blob;
+import java.sql.SQLException;
+
+/**
+ * Created on 11/07/14.
+ *
+ * @author dralagen
+ */
+public class ResourceStreamBean extends PollenBean<PollenResource> {
+
+ protected InputStream resourceContent;
+
+ protected String name;
+
+ protected long size;
+
+ protected String contentType;
+
+ public ResourceStreamBean() {
+ super(PollenResource.class);
+ }
+
+ @Override
+ public void fromEntity(PollenResource entity) {
+ setEntityId(entity.getTopiaId());
+
+ try {
+ setResourceContent(entity.getResourceContent().getBinaryStream());
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ setName(entity.getName());
+ setSize(entity.getSize());
+ setContentType(entity.getContentType());
+ }
+
+ @Override
+ public PollenResource toEntity() {
+ PollenResource entity = new PollenResourceImpl();
+
+ entity.setTopiaId(getEntityId());
+
+ try {
+ entity.setResourceContent(getResourceBlob());
+ } catch (IOException | SQLException e) {
+ e.printStackTrace();
+ }
+
+ entity.setName(getName());
+ entity.setSize(getSize());
+ entity.setContentType(getContentType());
+
+
+ return entity;
+ }
+
+ public InputStream getResourceContent() {
+ return resourceContent;
+ }
+
+ public void setResourceContent(InputStream resourceContent) {
+ this.resourceContent = resourceContent;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(long size) {
+ this.size = size;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public Blob getResourceBlob() throws IOException, SQLException {
+ return new SerialBlob(IOUtils.toByteArray(getResourceContent()));
+ }
+}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java
new file mode 100644
index 0000000..0fae9bb
--- /dev/null
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenResourceService.java
@@ -0,0 +1,106 @@
+package org.chorem.pollen.services.service;
+
+import org.chorem.pollen.persistence.entity.PollenResource;
+import org.chorem.pollen.services.PollenService;
+import org.chorem.pollen.services.bean.PollenEntityRef;
+import org.chorem.pollen.services.bean.ResourceFileBean;
+import org.chorem.pollen.services.bean.ResourceMetaBean;
+import org.chorem.pollen.services.bean.ResourceStreamBean;
+
+import java.io.IOException;
+import java.sql.SQLException;
+
+/**
+ * Created on 10/07/14.
+ *
+ * @author dralagen
+ */
+public class PollenResourceService extends PollenServiceSupport implements PollenService {
+
+ public ResourceStreamBean getResource(String resourceId) {
+ checkNotNull(resourceId);
+
+ PollenResource resource = getResource0(resourceId);
+
+ return toBean(ResourceStreamBean.class, resource);
+ }
+
+ public ResourceMetaBean getMetaResource(String resourceId) {
+ checkNotNull(resourceId);
+
+ PollenResource resource = getResource0(resourceId);
+
+ return toBean(ResourceMetaBean.class, resource);
+ }
+
+ public PollenEntityRef<PollenResource> createResource(ResourceFileBean resource) {
+ checkNotNull(resource);
+ checkIsNotPersisted(resource);
+
+ // TODO : check resource
+
+ PollenResource savedResource = saveResource(resource);
+ commit();
+
+ return PollenEntityRef.of(savedResource);
+ }
+
+ public PollenEntityRef<PollenResource> editResource (String resourceId, ResourceFileBean resource) {
+ checkNotNull(resourceId);
+ checkIsNotPersisted(resource);
+
+ // TODO: check resource
+
+ PollenResource savedResource = saveResource(resource);
+ commit();
+
+ return PollenEntityRef.of(savedResource);
+
+ }
+
+ public void deleteResource (String resourceId) {
+ checkNotNull(resourceId);
+
+ PollenResource resource = getResource0(resourceId);
+
+ getPollenResourceDao().delete(resource);
+ commit();
+ }
+
+ protected PollenResource getResource0(String resourceId) {
+ PollenResource resource = getPollenResourceDao().forTopiaIdEquals(resourceId).findUnique();
+
+
+ return resource;
+ }
+
+
+ protected PollenResource saveResource(ResourceFileBean resource) {
+
+ boolean resourceExist = resource.isPersisted();
+
+ PollenResource toSave;
+
+ if (resourceExist) {
+ toSave = getResource0(resource.getEntityId());
+ }
+ else {
+ toSave = getPollenResourceDao().create();
+ }
+
+ toSave.setName(resource.getName());
+ toSave.setContentType(resource.getContentType());
+ toSave.setSize(resource.getSize());
+ try {
+ toSave.setResourceContent(resource.getResourceBlob());
+ } catch (IOException | SQLException e) {
+ e.printStackTrace();
+
+ // no save
+ return null;
+ }
+
+ return toSave;
+ }
+
+}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java
index da78c96..beb0dfa 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java
@@ -31,19 +31,7 @@ import com.google.common.collect.Multimap;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.chorem.pollen.persistence.PollenPersistenceContext;
-import org.chorem.pollen.persistence.entity.ChoiceTopiaDao;
-import org.chorem.pollen.persistence.entity.CommentTopiaDao;
-import org.chorem.pollen.persistence.entity.FavoriteListMemberTopiaDao;
-import org.chorem.pollen.persistence.entity.FavoriteListTopiaDao;
-import org.chorem.pollen.persistence.entity.PollTopiaDao;
-import org.chorem.pollen.persistence.entity.PollenPrincipalTopiaDao;
-import org.chorem.pollen.persistence.entity.PollenUser;
-import org.chorem.pollen.persistence.entity.PollenUserTopiaDao;
-import org.chorem.pollen.persistence.entity.SessionTokenTopiaDao;
-import org.chorem.pollen.persistence.entity.VoteToChoiceTopiaDao;
-import org.chorem.pollen.persistence.entity.VoteTopiaDao;
-import org.chorem.pollen.persistence.entity.VoterListMemberTopiaDao;
-import org.chorem.pollen.persistence.entity.VoterListTopiaDao;
+import org.chorem.pollen.persistence.entity.*;
import org.chorem.pollen.services.PollenService;
import org.chorem.pollen.services.PollenServiceContext;
import org.chorem.pollen.services.bean.PollenBean;
@@ -181,6 +169,10 @@ public abstract class PollenServiceSupport implements PollenService {
return getPersistenceContext().getPollenPrincipalDao();
}
+ protected PollenResourceTopiaDao getPollenResourceDao() {
+ return getPersistenceContext().getPollenResourceDao();
+ }
+
protected PollenUserTopiaDao getPollenUserDao() {
return getPersistenceContext().getPollenUserDao();
}
--
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 ace945679e5e1ebf56acdfaf0bd85b3706c07b89
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 10 12:13:24 2014 +0200
fix test
---
.../org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 815f21b..6b86791 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\", value: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " +
- " {id: \"BBBB\", value: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]";
+ String choicesStr = "[ {id: \"AAAA\", choiceValue: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " +
+ " {id: \"BBBB\", choiceValue: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]";
JsonArrayConverter converter = JsonArrayConverter.newConverter(new DefaultTopiaIdFactory(), ChoiceBean.class);
--
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 4415aef105958afd0c489050ad82a87380c2c2cc
Merge: 4b7a4e4 75e6f56
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 10 10:46:51 2014 +0200
(merge) Change Choice
.../persistence/PollenTopiaPersistenceContext.java | 5 +-
pollen-persistence/src/main/xmi/pollen.properties | 15 ++++--
pollen-persistence/src/main/xmi/pollen.zargo | Bin 18462 -> 20233 bytes
.../org/chorem/pollen/rest/api/PollApiTest.java | 5 +-
.../rest/api/converter/JsonArrayConverterTest.java | 4 +-
.../rest/api/converter/JsonConverterTest.java | 4 +-
.../chorem/pollen/services/bean/ChoiceBean.java | 28 +++++------
.../pollen/services/service/ChoiceService.java | 16 +++---
pollen-services/src/main/resources/fixtures.yaml | 4 +-
.../pollen/services/service/PollServiceTest.java | 56 ++++++++++-----------
.../services/service/VoteCountingServiceTest.java | 4 +-
.../services/service/VoterListServiceTest.java | 4 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 38 +++++++-------
.../src/main/webapp/partials/inline-poll.html | 18 +++----
.../src/main/webapp/partials/poll-popupChoice.html | 6 +--
.../src/main/webapp/partials/poll-result.html | 2 +-
16 files changed, 105 insertions(+), 104 deletions(-)
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 10, 2014
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 75e6f561dd6bb62d5498b10cbc5554dac133c7f7
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 10 10:41:53 2014 +0200
change choice.value to choice.choiceValue in UI
---
.../src/main/webapp/js/controllers/pollCtrl.js | 38 +++++++++++-----------
.../src/main/webapp/partials/inline-poll.html | 18 +++++-----
.../src/main/webapp/partials/poll-popupChoice.html | 6 ++--
.../src/main/webapp/partials/poll-result.html | 2 +-
4 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index e5a201b..c03f5a6 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -198,10 +198,10 @@ angular.module('pollControllers', [])
$scope.preSendChoice = function (choice) {
if (choice.choiceType == 'DATE') {
- choice.value = choice.value.getTime();
+ choice.choiceValue = choice.choiceValue.getTime();
}
else if (choice.choiceType == 'IMAGE') {
- choice.value = choice.value.meta.name+"####"+choice.value.data;
+ choice.choiceValue = choice.choiceValue.meta.name+"####"+choice.choiceValue.data;
}
return choice;
@@ -209,12 +209,12 @@ angular.module('pollControllers', [])
$scope.postReceiveChoice = function (choice) {
if (choice.choiceType == 'DATE') {
- choice.value = new Date(Number(choice.value));
+ choice.choiceValue = new Date(Number(choice.choiceValue));
}
else if (choice.choiceType == 'IMAGE') {
- var tmp = choice.value.split("####");
+ var tmp = choice.choiceValue.split("####");
- choice.value = {meta:{name:tmp[0]}, data : tmp[1]};
+ choice.choiceValue = {meta:{name:tmp[0]}, data : tmp[1]};
}
return choice;
@@ -362,7 +362,7 @@ angular.module('pollControllers', [])
var initChoice = function () {
return {
choiceType : $scope.globalVariables.lastType,
- value : ''
+ choiceValue : ''
};
}
@@ -400,18 +400,18 @@ angular.module('pollControllers', [])
title : function () { return title;},
choice : function () {
if (choice.choiceType == 'TEXT') {
- choice.valueText = choice.value;
+ choice.choiceValueText = choice.choiceValue;
}
else if (choice.choiceType == 'DATE') {
- choice.valueDate = choice.value;
+ choice.choiceValueDate = choice.choiceValue;
}
else if (choice.choiceType == 'IMAGE') {
- choice.valueImage = choice.value;
+ choice.choiceValueImage = choice.choiceValue;
}
// set default date
- if (angular.isUndefined(choice.valueDate)) {
- choice.valueDate = $scope.globalVariables.lastDate;
+ if (angular.isUndefined(choice.choiceValueDate)) {
+ choice.choiceValueDate = $scope.globalVariables.lastDate;
}
return choice;
@@ -426,18 +426,18 @@ angular.module('pollControllers', [])
$scope.globalVariables.lastType = choice.choiceType;
if (choice.choiceType == 'TEXT') {
- choice.value = choice.valueText;
+ choice.choiceValue = choice.choiceValueText;
}
else if (choice.choiceType == 'DATE') {
- choice.value = choice.valueDate;
- $scope.globalVariables.lastDate = angular.copy(choice.valueDate);
+ choice.choiceValue = choice.choiceValueDate;
+ $scope.globalVariables.lastDate = angular.copy(choice.choiceValueDate);
}
else if (choice.choiceType == 'IMAGE') {
- choice.value = choice.valueImage;
+ choice.choiceValue = choice.choiceValueImage;
}
if (!angular.equals(choiceEdit, choice)) {
- choiceEdit.value = choice.value;
+ choiceEdit.choiceValue = choice.choiceValue;
choiceEdit.choiceType = choice.choiceType;
choiceEdit.description = choice.description;
@@ -1277,15 +1277,15 @@ angular.module('pollControllers', [])
switch (value.choice.choiceType) {
case 'TEXT':
- scores.push([value.choice.value, value.scoreValue]);
+ scores.push([value.choice.choiceValue, value.scoreValue]);
break;
case 'DATE':
- scores.push([$filter('date')(value.choice.value, $scope.globalVariables.dateFormat), value.scoreValue]);
+ scores.push([$filter('date')(value.choice.choiceValue, $scope.globalVariables.dateFormat), value.scoreValue]);
break;
case 'IMAGE':
- scores.push([value.choice.value.meta.name, value.scoreValue]);
+ scores.push([value.choice.choiceValue.meta.name, 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 af8c658..f42f38f 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -30,33 +30,33 @@
<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.value || ('poll.edit' | translate) }}
- <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
+ {{ choice.choiceValue || ('poll.edit' | translate) }}
+ <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></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.value" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/>
+ <input type="text" class="form-control" ng-model="choice.choiceValue" 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.value | date:globalVariables.dateFormat) || ('poll.edit' | translate) }}
- <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
+ {{ (choice.choiceValue | date:globalVariables.dateFormat) || ('poll.edit' | translate) }}
+ <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></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.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="text" class="form-control" ng-model="choice.choiceValue" 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>
<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>
+ {{choice.choiceValue.meta.name}}
+ <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
<br/>
- <zoom-image image="choice.value.data" name="choice.value.meta.name"></zoom-image>
+ <zoom-image image="choice.choiceValue.data" name="choice.choiceValue.meta.name"></zoom-image>
</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 88a448e..0a5a988 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="popChoiceText" class="col-sm-4 control-label">Nom du Choix : </label>
<div class="col-sm-6">
- <input id="popChoiceText" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
+ <input id="popChoiceText" type="text" ng-model="choice.choiceValueText" 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="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'"/>
+ <input id="popChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.choiceValueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
</div>
</div>
</div>
@@ -58,7 +58,7 @@
<label class="col-sm-4 control-label">Image : </label>
<div class="col-sm-6">
- <upload-file ng-model="choice.valueImage"></upload-file>
+ <upload-file ng-model="choice.choiceValueImage"></upload-file>
</div>
</div>
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 6965664..3f8a503 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.value.meta.name || (score.choice.value | date:globalVariables.dateFormat) || score.choice.value }} </th>
+ <th> {{ score.choice.choiceValue.meta.name || (score.choice.choiceValue | date:globalVariables.dateFormat) || score.choice.choiceValue }} </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
01/03: add PollenResource entity + remove dummy entity stereotype + rename Choice.name to Choice.choiceValue
by chorem.org scm July 10, 2014
by chorem.org scm July 10, 2014
July 10, 2014
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 a2fec165a0b2a2a25e7b41a9a442955fb5bc9474
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Wed Jul 9 18:35:57 2014 +0200
add PollenResource entity + remove dummy entity stereotype + rename Choice.name to Choice.choiceValue
---
.../persistence/PollenTopiaPersistenceContext.java | 5 +-
pollen-persistence/src/main/xmi/pollen.properties | 15 ++++--
pollen-persistence/src/main/xmi/pollen.zargo | Bin 18462 -> 20233 bytes
.../org/chorem/pollen/rest/api/PollApiTest.java | 5 +-
.../rest/api/converter/JsonArrayConverterTest.java | 4 +-
.../rest/api/converter/JsonConverterTest.java | 4 +-
.../chorem/pollen/services/bean/ChoiceBean.java | 28 +++++------
.../pollen/services/service/ChoiceService.java | 16 +++---
pollen-services/src/main/resources/fixtures.yaml | 4 +-
.../pollen/services/service/PollServiceTest.java | 56 ++++++++++-----------
.../services/service/VoteCountingServiceTest.java | 4 +-
.../services/service/VoterListServiceTest.java | 4 +-
12 files changed, 73 insertions(+), 72 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 8d5f5ea..bbcf552 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
@@ -25,16 +25,15 @@ 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,
- TopiaFiresSupport applicationFiresSupport,
+ TopiaFiresSupport listenableSupport,
TopiaIdFactory topiaIdFactory,
TopiaHibernateSessionRegistry sessionRegistry) {
super(hibernateProvider,
- applicationFiresSupport,
+ listenableSupport,
topiaIdFactory,
sessionRegistry);
}
diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties
index 8a4f95e..7e82326 100644
--- a/pollen-persistence/src/main/xmi/pollen.properties
+++ b/pollen-persistence/src/main/xmi/pollen.properties
@@ -21,18 +21,23 @@
# #L%
###m
model.tagvalue.version=2.0
-model.tagValue.notGenerateToString=true
-model.tagValue.constantPrefix=PROPERTY_
-model.tagValue.useEnumerationName=true
-model.tagValue.indexForeignKeys=true
+#model.tagValue.notGenerateToString=true
+#model.tagValue.constantPrefix=PROPERTY_
+#model.tagValue.useEnumerationName=true
+#model.tagValue.indexForeignKeys=true
model.tagValue.hibernateAttributeType.String=string
+package.org.chorem.pollen.persistence.entity.stereotype=entity
+
# 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.Choice.attribute.choiceValue.tagValue.hibernateAttributeType=text
org.chorem.pollen.persistence.entity.Comment.attribute.text.tagValue.hibernateAttributeType=text
+# Blob
+#org.chorem.pollen.persistence.entity.PollenResource.attribute.resourceContent.tagValue.sqlType=blob
+
# clef naturelle non modifiable sur PollenToken.token
org.chorem.pollen.persistence.entity.PollenToken.class.tagValue.naturalIdMutable=true
org.chorem.pollen.persistence.entity.PollenToken.attribute.token.stereotype=unique
diff --git a/pollen-persistence/src/main/xmi/pollen.zargo b/pollen-persistence/src/main/xmi/pollen.zargo
index 7d095e4..72a711c 100644
Binary files a/pollen-persistence/src/main/xmi/pollen.zargo and b/pollen-persistence/src/main/xmi/pollen.zargo differ
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 37cf5b1..8ca03b6 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
@@ -26,7 +26,6 @@ import org.apache.http.client.fluent.Request;
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;
@@ -124,11 +123,11 @@ public class PollApiTest extends AbstractPollenRestApiTest {
List<ChoiceBean> choices = new ArrayList<>();
ChoiceBean choice1 = new ChoiceBean();
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setValue("choiceA");
+ choice1.setChoiceValue("choiceA");
choices.add(choice1);
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setValue("choiceB");
+ choice2.setChoiceValue("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 649e8a6..815f21b 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
@@ -42,12 +42,12 @@ public class JsonArrayConverterTest {
Assert.assertEquals(2, choices.length);
Assert.assertNotNull(choices[0]);
- Assert.assertEquals("choice1", choices[0].getValue());
+ Assert.assertEquals("choice1", choices[0].getChoiceValue());
Assert.assertEquals(ChoiceType.TEXT, choices[0].getChoiceType());
Assert.assertEquals(1, choices[0].getChoiceOrder());
Assert.assertNotNull(choices[1]);
- Assert.assertEquals("choice2", choices[1].getValue());
+ Assert.assertEquals("choice2", choices[1].getChoiceValue());
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 eea755d..8ca1be5 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
@@ -78,9 +78,9 @@ public class JsonConverterTest {
Assert.assertEquals(CommentVisibility.NOBODY, poll.getCommentVisibility());
Assert.assertEquals(PollType.FREE, poll.getPollType());
// Assert.assertEquals(2, poll.sizeChoice());
-// Assert.assertEquals("choice1", poll.getChoice(0).getName());
+// Assert.assertEquals("choice1", poll.getChoice(0).getChoiceValue());
// Assert.assertEquals(ChoiceType.TEXT, poll.getChoice(0).getChoiceType());
-// Assert.assertEquals("choice2", poll.getChoice(1).getName());
+// Assert.assertEquals("choice2", poll.getChoice(1).getChoiceValue());
// Assert.assertEquals(ChoiceType.IMAGE, poll.getChoice(1).getChoiceType());
String convert = converter.convert(String.class, poll);
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 fa0b5fa..40e8691 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
@@ -25,8 +25,6 @@ import org.chorem.pollen.persistence.entity.Choice;
import org.chorem.pollen.persistence.entity.ChoiceImpl;
import org.chorem.pollen.persistence.entity.ChoiceType;
-import java.util.Date;
-
/**
* Created on 5/15/14.
*
@@ -39,7 +37,7 @@ public class ChoiceBean extends PollenBean<Choice> {
protected int choiceOrder;
- protected String value;
+ protected String choiceValue;
protected ChoiceType choiceType;
@@ -66,16 +64,16 @@ public class ChoiceBean extends PollenBean<Choice> {
switch (entity.getChoiceType()) {
case TEXT:
- setValue(entity.getName());
+ setChoiceValue(entity.getChoiceValue());
break;
case DATE:
- setValue(entity.getName());
+ setChoiceValue(entity.getChoiceValue());
break;
case IMAGE:
- setValue(entity.getName());
+ setChoiceValue(entity.getChoiceValue());
break;
}
@@ -96,21 +94,21 @@ public class ChoiceBean extends PollenBean<Choice> {
if (choiceType != null) {
switch (choiceType) {
case TEXT:
- entity.setName(getValue());
+ entity.setChoiceValue(getChoiceValue());
break;
case DATE:
- if ( getValue() != null ) {
- entity.setName(getValue());
+ if ( getChoiceValue() != null ) {
+ entity.setChoiceValue(getChoiceValue());
}
break;
case IMAGE:
- if ( getValue() != null ) {
- entity.setName(getValue());
+ if ( getChoiceValue() != null ) {
+ entity.setChoiceValue(getChoiceValue());
}
break;
@@ -133,12 +131,12 @@ public class ChoiceBean extends PollenBean<Choice> {
this.permission = permission;
}
- public String getValue() {
- return value;
+ public String getChoiceValue() {
+ return choiceValue;
}
- public void setValue(String value) {
- this.value = value;
+ public void setChoiceValue(String value) {
+ this.choiceValue = 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 ae476f4..b08c1c5 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
@@ -98,7 +98,7 @@ public class ChoiceService extends PollenServiceSupport {
//
// if (connectedUser != null) {
//
-// creator.setName(connectedUser.getName());
+// creator.setChoiceValue(connectedUser.getChoiceValue());
// creator.setEmail(connectedUser.getEmail());
// }
//
@@ -220,7 +220,7 @@ public class ChoiceService extends PollenServiceSupport {
//FIXME
// PollenPrincipal creator = choice.getCreator();
// if (creator != null) {
-// principal.setName(creator.getName());
+// principal.setChoiceValue(creator.getChoiceValue());
// principal.setEmail(creator.getEmail());
// }
@@ -236,19 +236,19 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
- toSave.setName(choice.getValue());
+ toSave.setChoiceValue(choice.getChoiceValue());
break;
case DATE:
- toSave.setName(choice.getValue());
+ toSave.setChoiceValue(choice.getChoiceValue());
break;
case IMAGE:
- toSave.setName(choice.getValue());
+ toSave.setChoiceValue(choice.getChoiceValue());
}
@@ -282,7 +282,7 @@ public class ChoiceService extends PollenServiceSupport {
}
- choiceNames.add(choice1.getName());
+ choiceNames.add(choice1.getChoiceValue());
}
}
@@ -293,7 +293,7 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
- String choiceName = choice.getValue();
+ String choiceName = choice.getChoiceValue();
boolean nameNotBlank = checkNotBlank(errors,
"value",
choiceName,
@@ -307,7 +307,7 @@ public class ChoiceService extends PollenServiceSupport {
break;
case DATE:
- Date choiceDate = new Date(Long.parseLong(choice.getValue()));
+ Date choiceDate = new Date(Long.parseLong(choice.getChoiceValue()));
boolean dateNotBlank;
if (choiceDate == null) {
diff --git a/pollen-services/src/main/resources/fixtures.yaml b/pollen-services/src/main/resources/fixtures.yaml
index 6f02abe..b2a4219 100644
--- a/pollen-services/src/main/resources/fixtures.yaml
+++ b/pollen-services/src/main/resources/fixtures.yaml
@@ -76,14 +76,14 @@ poll_normal:
choiceA:
&normal_choixA !choice
poll: *normal
- name: choixA
+ choiceValue: choixA
description: choixA description
choiceType: TEXT
choiceB:
&normal_choixB !choice
poll: *normal
- name: choixB
+ choiceValue: choixB
description: choixB description
choiceType: TEXT
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 448e5a8..3d17723 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.setValue("A");
+ choice1.setChoiceValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setValue("B");
+ choice2.setChoiceValue("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.getValue(), createdChoice1.getValue());
+ Assert.assertEquals(choice1.getChoiceValue(), createdChoice1.getChoiceValue());
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.getValue(), createdChoice2.getValue());
+ Assert.assertEquals(choice2.getChoiceValue(), createdChoice2.getChoiceValue());
Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
}
@@ -172,13 +172,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
assertErrorKeyFound(e, "choice[0].value");
}
- choice1.setValue("A");
+ choice1.setChoiceValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setValue("A");
+ choice2.setChoiceValue("A");
choice2.setDescription("Choice B");
choices.add(choice2);
@@ -190,7 +190,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
assertErrorKeyFound(e, "choice[1].value");
}
- choice2.setValue("B");
+ choice2.setChoiceValue("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().getValue());
+// Assert.assertNull(createdPoll.getCreator().getChoiceValue());
// 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.getValue(), createdChoice1.getValue());
+ Assert.assertEquals(choice1.getChoiceValue(), createdChoice1.getChoiceValue());
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.getValue(), createdChoice2.getValue());
+ Assert.assertEquals(choice2.getChoiceValue(), createdChoice2.getChoiceValue());
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.setValue("A");
+// choice1.setChoiceValue("A");
// choice1.setDescription("Choice A");
//
//
// ChoiceBean choice2 = new ChoiceBean();
// choice2.setChoiceType(ChoiceType.TEXT);
-// choice2.setValue("B");
+// choice2.setChoiceValue("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().getValue());
+//// Assert.assertNull(createdPoll.getCreator().getChoiceValue());
//// 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.getValue(), createdChoice1.getValue());
+// Assert.assertEquals(choice1.getChoiceValue(), createdChoice1.getChoiceValue());
// 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.getValue(), createdChoice2.getValue());
+// Assert.assertEquals(choice2.getChoiceValue(), createdChoice2.getChoiceValue());
// 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.getValue(), createdVoterList.getValue());
+// Assert.assertEquals(voterList.getChoiceValue(), createdVoterList.getChoiceValue());
// 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.setValue("A");
+// choice1.setChoiceValue("A");
// choice1.setDescription("Choice A");
//
// choices.add(choice1);
//
// ChoiceBean choice2 = new ChoiceBean();
// choice2.setChoiceType(ChoiceType.TEXT);
-// choice2.setValue("B");
+// choice2.setChoiceValue("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.setValue("voterList1");
+// voterList.setChoiceValue("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.setValue("voter1");
+// voterListMember1.setChoiceValue("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.setValue("voter1");
+// voterListMember2.setChoiceValue("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.setValue("voter2");
+// voterListMember2.setChoiceValue("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().getValue());
+//// Assert.assertNull(createdPoll.getCreator().getChoiceValue());
//// 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.getValue(), createdChoice1.getValue());
+// Assert.assertEquals(choice1.getChoiceValue(), createdChoice1.getChoiceValue());
// 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.getValue(), createdChoice2.getValue());
+// Assert.assertEquals(choice2.getChoiceValue(), createdChoice2.getChoiceValue());
// 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.getValue(), createdVoterList.getValue());
+// Assert.assertEquals(voterList.getChoiceValue(), createdVoterList.getChoiceValue());
// 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.getValue(), createdVoterListMember1.getValue());
+//// Assert.assertEquals(reloadedVoterListMember1.getChoiceValue(), createdVoterListMember1.getChoiceValue());
//// 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.getValue(), createdVoterListMember2.getValue());
+//// Assert.assertEquals(reloadedVoterListMember2.getChoiceValue(), createdVoterListMember2.getChoiceValue());
//// 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 d7f1703..3238aaa 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.setValue("A");
+ choice1.setChoiceValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setValue("B");
+ choice2.setChoiceValue("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 1fcc304..44ba4c1 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.setValue("A");
+ choice1.setChoiceValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setValue("B");
+ choice2.setChoiceValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0