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
01/01: add PollenResource entity + remove dummy entity stereotype + rename Choice.name to Choice.choiceValue
by chorem.org scm July 9, 2014
by chorem.org scm July 9, 2014
July 9, 2014
This is an automated email from the git hooks/post-receive script.
New commit to branch addFileChoice in repository pollen.
See http://git.chorem.org/pollen.git
commit d4a36100845c5952bacdd2f20ecb67062ee4ccf2
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 | 4 +-
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(+), 71 deletions(-)
diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
index d01cfcf..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
@@ -24,12 +24,12 @@ package org.chorem.pollen.persistence;
import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.topia.persistence.internal.HibernateProvider;
import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
-import org.nuiton.topia.persistence.support.TopiaListenableSupport;
+import org.nuiton.topia.persistence.internal.support.TopiaFiresSupport;
public class PollenTopiaPersistenceContext extends AbstractPollenTopiaPersistenceContext {
public PollenTopiaPersistenceContext(HibernateProvider hibernateProvider,
- TopiaListenableSupport listenableSupport,
+ TopiaFiresSupport listenableSupport,
TopiaIdFactory topiaIdFactory,
TopiaHibernateSessionRegistry sessionRegistry) {
super(hibernateProvider,
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
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 4b7a4e4e5ad4ac15136127fc2046c186fcda192f
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 17:01:40 2014 +0200
comment style and delete not used image
---
.../src/main/webapp/img/glyphicons_050_link.png | Bin 1410 -> 0 bytes
pollen-ui-angular/src/main/webapp/less/style.less | 4 ++++
2 files changed, 4 insertions(+)
diff --git a/pollen-ui-angular/src/main/webapp/img/glyphicons_050_link.png b/pollen-ui-angular/src/main/webapp/img/glyphicons_050_link.png
deleted file mode 100644
index a68cbfc..0000000
Binary files a/pollen-ui-angular/src/main/webapp/img/glyphicons_050_link.png and /dev/null differ
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index f61e193..847dba8 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -11,6 +11,7 @@
margin-top:60px;
}
+/* global min width */
@media screen and (max-width: @responsive-min-width) {
#content, #pollenMenu, #pollenMenu .container-fluid, #poll-link {
width:@responsive-min-width !important;
@@ -44,6 +45,7 @@
}
}
+/* width > @responsive-large-width */
@media screen and (min-width: (@responsive-large-width + 1px)) {
@width-max : 300px;
@width-min : 35px;
@@ -129,6 +131,7 @@
}
}
+/* width < @responsive-large-width */
@media screen and (max-width: @responsive-large-width) {
@foot-padding : 1.8%;
@foot-height : 80px;
@@ -162,6 +165,7 @@
display:none;
}
+ /* height < @responsive-height */
@media (max-height: @responsive-height) {
position:relative;
background-color:inherit;
--
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 58906ab4c7e59c896a8d40272c45255b8566bf5d
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 16:11:32 2014 +0200
fix PLURAL_CATEGORY
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 5 +++++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 66046a0..968332e 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -117,6 +117,11 @@ var translateEN = {
}
+//
+// Source i18n : https://github.com/angular/bower-angular-i18n/blob/v1.2.19-build.267%2Bsha.…
+//
+
+var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
var i18n_EN = {
"DATETIME_FORMATS": {
"AMPMS": [
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index ea9c74b..0b24993 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -117,6 +117,11 @@ var translateFR = {
}
+//
+// Source i18n : https://github.com/angular/bower-angular-i18n/blob/v1.2.19-build.267%2Bsha.…
+//
+
+var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
var i18n_FR = {
"DATETIME_FORMATS": {
"AMPMS": [
@@ -210,6 +215,6 @@ var i18n_FR = {
]
},
"id": "fr",
- "pluralCat": function (n) { if (n >= 0 && n <= 2 && n != 2) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+ "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER; }
}
--
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 23708fc1b737eb85d69dac9fa2ae9029330901ef
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 15:42:11 2014 +0200
add in conf date Format
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 2 --
pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 --
.../src/main/webapp/js/conf.js.exemple | 12 ++++++++
.../src/main/webapp/js/controllers/pollCtrl.js | 22 +++++++-------
pollen-ui-angular/src/main/webapp/js/services.js | 34 ++++++++++++++++++++++
.../src/main/webapp/partials/poll-comment.html | 2 +-
.../src/main/webapp/partials/poll-popupChoice.html | 1 +
7 files changed, 59 insertions(+), 16 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 8ae450a..66046a0 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -113,8 +113,6 @@ var translateEN = {
'action.message.confirmDelete' : 'Are you sure to delete it?',
'action.message.confirmClose' : 'Are you sure to close it?',
-'dateFormat' : 'MM-dd-yy',
-
'error.forbidden' : 'Access forbidden',
}
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 86bccd4..ea9c74b 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -113,8 +113,6 @@ var translateFR = {
'action.message.confirmDelete' : 'Êtes vous sûr de vouloir le supprimer?',
'action.message.confirmClose' : 'Êtes vous sûr de vouloir le fermer?',
-'dateFormat' : 'dd/MM/yyyy',
-
'error.forbidden' : 'Accès interdit',
}
diff --git a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
index 9c44d4a..4135a7c 100644
--- a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
+++ b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
@@ -32,4 +32,16 @@ var conf = {
// Time in ms to print alert error
// -1 for infinite time, click or reload for close alert
defaultAlertTimeError: -1, // infinite
+
+ // Format Date
+ // preference : shortDate, mediumDate, longDate, fullDate
+ defaultDateFormat : "shortDate",
+
+ // Format Time
+ // preference : shortTime, mediumTime
+ defaultTimeFormat: "shortTime",
+
+ // Format DateTime
+ // preference : short, medium
+ defaultDateTimeFormat: "short",
}
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index d038e2c..e5a201b 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',
- function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, Page) {
+ ['$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.setTab = function (defaultValue) {
if (angular.isDefined($routeParams.tab)) {
return $routeParams.tab;
@@ -69,15 +69,11 @@ angular.module('pollControllers', [])
}
var setDateFormat = function () {
- $translate('dateFormat').then(function (dateFormat) {
- $scope.globalVariables.dateFormat = dateFormat;
- });
+ $scope.globalVariables.dateFormat = DateFormat.getDateFormat();
+ $scope.globalVariables.timeFormat = DateFormat.getTimeFormat();
+ $scope.globalVariables.dateTimeFormat = DateFormat.getDateTimeFormat();
}; setDateFormat();
- $scope.$on('switchLocale', function() {
- setDateFormat();
- })
-
$scope.data = {};
$scope.data.poll = {};
@@ -1229,8 +1225,8 @@ angular.module('pollControllers', [])
}])
-.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', 'Page',
- function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, Page) {
+.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('PollCtrl', {$scope:$scope});
Page.setTitle('title.poll.result');
@@ -1244,6 +1240,10 @@ angular.module('pollControllers', [])
$scope.tab = $scope.setTab('result');
$scope.plot = 'chart';
+ $scope.$on('switchLocale', function() {
+ $route.reload();
+ })
+
var choicesDeferred = $q.defer();
PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
$scope.data.choices = choices;
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index c9495f8..a1303ab 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -362,4 +362,38 @@ angular.module('pollenServices', ['ngResource'])
localStorage.setItem(storageId, JSON.stringify(session));
}
}
+}])
+
+//////////////////////////////////////
+///// DATE AND TIME FORMAT /////
+//////////////////////////////////////
+.factory('DateFormat', [function() {
+ return {
+ getDateFormat : function () {
+ if (angular.isDefined(conf.defaultDateFormat)) {
+ return conf.defaultDateFormat;
+ }
+ else {
+ return "shortDate";
+ }
+ },
+
+ getTimeFormat : function () {
+ if (angular.isDefined(conf.defaultTimeFormat)) {
+ return conf.defaultTimeFormat;
+ }
+ else {
+ return "shortTime";
+ }
+ },
+
+ getDateTimeFormat : function () {
+ if (angular.isDefined(conf.defaultDateTimeFormat)) {
+ return conf.defaultDateTimeFormat;
+ }
+ else {
+ return "short";
+ }
+ }
+ }
}])
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
index 841eb54..9aa9aba 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -62,7 +62,7 @@
<tr ng-repeat="comment in data.comments">
<td>
<span class="glyphicon glyphicon-user"></span>{{comment.authorName}}<br/>
- <span class="glyphicon glyphicon-calendar"></span>{{comment.postDate | date:globalVariables.dateFormat}}<br/>
+ <span class="glyphicon glyphicon-calendar"></span>{{comment.postDate | date:globalVariables.dateTimeFormat}}<br/>
<a class="fakeLink" ng-click="editPost(comment)" ng-if="comment.permission"><span class="glyphicon glyphicon-pencil" ng-show="comment.id"></span></a>
<a class="fakeLink" ng-click="deletePost(comment)" ng-if="comment.permission"><span class="glyphicon glyphicon-trash danger" ng-show="comment.id"></span></a>
</td>
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 a8a06f0..88a448e 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -59,6 +59,7 @@
<div class="col-sm-6">
<upload-file ng-model="choice.valueImage"></upload-file>
+
</div>
</div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit b521eedaaebb8549e77842b524e322fb477d83c4
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 15:09:26 2014 +0200
translate datePicker
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 95 +++++++++++++++++++++
pollen-ui-angular/src/main/webapp/i18n/fr.js | 96 ++++++++++++++++++++++
.../src/main/webapp/js/controllers/localeCtrl.js | 21 ++++-
3 files changed, 211 insertions(+), 1 deletion(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index 38d01f0..8ae450a 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -119,3 +119,98 @@ var translateEN = {
}
+var i18n_EN = {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+ "MONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "SHORTDAY": [
+ "Sun",
+ "Mon",
+ "Tue",
+ "Wed",
+ "Thu",
+ "Fri",
+ "Sat"
+ ],
+ "SHORTMONTH": [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+ ],
+ "fullDate": "EEEE, MMMM d, y",
+ "longDate": "MMMM d, y",
+ "medium": "MMM d, y h:mm:ss a",
+ "mediumDate": "MMM d, y",
+ "mediumTime": "h:mm:ss a",
+ "short": "M/d/yy h:mm a",
+ "shortDate": "M/d/yy",
+ "shortTime": "h:mm a"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "$",
+ "DECIMAL_SEP": ".",
+ "GROUP_SEP": ",",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "(\u00a4",
+ "negSuf": ")",
+ "posPre": "\u00a4",
+ "posSuf": ""
+ }
+ ]
+ },
+ "id": "en",
+ "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+}
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 85aab6a..86bccd4 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -119,3 +119,99 @@ var translateFR = {
}
+var i18n_FR = {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "dimanche",
+ "lundi",
+ "mardi",
+ "mercredi",
+ "jeudi",
+ "vendredi",
+ "samedi"
+ ],
+ "MONTH": [
+ "janvier",
+ "f\u00e9vrier",
+ "mars",
+ "avril",
+ "mai",
+ "juin",
+ "juillet",
+ "ao\u00fbt",
+ "septembre",
+ "octobre",
+ "novembre",
+ "d\u00e9cembre"
+ ],
+ "SHORTDAY": [
+ "dim.",
+ "lun.",
+ "mar.",
+ "mer.",
+ "jeu.",
+ "ven.",
+ "sam."
+ ],
+ "SHORTMONTH": [
+ "janv.",
+ "f\u00e9vr.",
+ "mars",
+ "avr.",
+ "mai",
+ "juin",
+ "juil.",
+ "ao\u00fbt",
+ "sept.",
+ "oct.",
+ "nov.",
+ "d\u00e9c."
+ ],
+ "fullDate": "EEEE d MMMM y",
+ "longDate": "d MMMM y",
+ "medium": "d MMM y HH:mm:ss",
+ "mediumDate": "d MMM y",
+ "mediumTime": "HH:mm:ss",
+ "short": "dd/MM/yy HH:mm",
+ "shortDate": "dd/MM/yy",
+ "shortTime": "HH:mm"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "\u20ac",
+ "DECIMAL_SEP": ",",
+ "GROUP_SEP": "\u00a0",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "macFrac": 0,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "(",
+ "negSuf": "\u00a0\u00a4)",
+ "posPre": "",
+ "posSuf": "\u00a0\u00a4"
+ }
+ ]
+ },
+ "id": "fr",
+ "pluralCat": function (n) { if (n >= 0 && n <= 2 && n != 2) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+}
+
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
index 9805d8b..524e3ef 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
@@ -19,9 +19,23 @@
* #L%
*/
angular.module('localeControllers', [])
-.controller('LocaleCtrl', ['$scope', '$rootScope', '$translate', 'SessionStorage',function ($scope, $rootScope, $translate, SessionStorage) {
+.controller('LocaleCtrl', ['$scope', '$rootScope', '$translate', 'SessionStorage', '$locale', function ($scope, $rootScope, $translate, SessionStorage, $locale) {
$scope.debug = conf.debug;
$scope.locale = SessionStorage.get().locale;
+
+ var locales = [];
+ locales['fr'] = i18n_FR;
+ locales['en'] = i18n_EN;
+
+ var loadLocale = function () {
+ if ($scope.locale == "fr" && angular.isDefined(i18n_FR)) {
+ angular.copy(i18n_FR, $locale);
+ }
+ else if (angular.isDefined(i18n_EN)) {
+ angular.copy(i18n_EN, $locale);
+ }
+ }
+
if (angular.isUndefined($scope.locale)) {
// set locale with browser preference
$scope.locale = navigator.language || navigator.userLanguage;
@@ -35,6 +49,7 @@ angular.module('localeControllers', [])
SessionStorage.save({locale:$scope.locale});
}
$translate.use($scope.locale);
+ loadLocale();
$scope.switchLocale = function (locale) {
//change locale
@@ -42,7 +57,11 @@ angular.module('localeControllers', [])
SessionStorage.save({locale:locale});
$scope.locale = locale;
$translate.use(locale);
+
+ loadLocale();
+
$rootScope.$broadcast('switchLocale');
}
}
+
}])
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit de3b686a11dd302e287e4e03596aed8517dc8dc0
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 13:59:40 2014 +0200
delete attributs in scope.choice
---
pollen-ui-angular/src/main/webapp/index.html | 6 +++---
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 +------
pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html | 5 ++---
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 7f154b2..289e79f 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -31,9 +31,9 @@
ou
$ mvn compile
-->
- <link rel="stylesheet/less" type="text/css" href="less/style.less" />
- <script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>
- <!--<link rel="stylesheet" type="text/css" href="css/style.css"/>-->
+ <!--<link rel="stylesheet/less" type="text/css" href="less/style.less" />-->
+ <!--<script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>-->
+ <link rel="stylesheet" type="text/css" href="css/style.css"/>
<script language="javascript" type="text/javascript" src="js/conf.js"></script>
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index 9bb3187..d038e2c 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -205,7 +205,6 @@ angular.module('pollControllers', [])
choice.value = choice.value.getTime();
}
else if (choice.choiceType == 'IMAGE') {
-
choice.value = choice.value.meta.name+"####"+choice.value.data;
}
@@ -367,8 +366,7 @@ angular.module('pollControllers', [])
var initChoice = function () {
return {
choiceType : $scope.globalVariables.lastType,
- valueText : '',
- valueDate : $scope.globalVariables.lastDate,
+ value : ''
};
}
@@ -441,9 +439,6 @@ angular.module('pollControllers', [])
else if (choice.choiceType == 'IMAGE') {
choice.value = choice.valueImage;
}
- delete choice.valueText;
- delete choice.valueDate;
- delete choice.valueImage
if (!angular.equals(choiceEdit, choice)) {
choiceEdit.value = choice.value;
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
index bb2bf39..a8a06f0 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -55,11 +55,10 @@
</div>
<div class="form-group" ng-if="choice.choiceType == 'IMAGE'">
- <label for="popChoiceImage" class="col-sm-4 control-label">Image : </label>
+ <label class="col-sm-4 control-label">Image : </label>
<div class="col-sm-6">
- <upload-file id="popChoiceImage" ng-model="choice.valueImage" focus-me="choice.choiceType == 'IMAGE'" ></upload-file>
- {{choice.valueImage.meta.name}}
+ <upload-file ng-model="choice.valueImage"></upload-file>
</div>
</div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 9, 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 7f9c31286748528085adcd73d9d920029572f633
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 9 10:42:41 2014 +0200
update TopiaListenableSupport to TopiaFiresSupport
---
.../org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
index d01cfcf..8d5f5ea 100644
--- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
+++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenTopiaPersistenceContext.java
@@ -24,16 +24,17 @@ package org.chorem.pollen.persistence;
import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.topia.persistence.internal.HibernateProvider;
import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
+import org.nuiton.topia.persistence.internal.support.TopiaFiresSupport;
import org.nuiton.topia.persistence.support.TopiaListenableSupport;
public class PollenTopiaPersistenceContext extends AbstractPollenTopiaPersistenceContext {
public PollenTopiaPersistenceContext(HibernateProvider hibernateProvider,
- TopiaListenableSupport listenableSupport,
+ TopiaFiresSupport applicationFiresSupport,
TopiaIdFactory topiaIdFactory,
TopiaHibernateSessionRegistry sessionRegistry) {
super(hibernateProvider,
- listenableSupport,
+ applicationFiresSupport,
topiaIdFactory,
sessionRegistry);
}
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit 3fbb710e24eff5115236067535b56fa7c3a8d349
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Tue Jul 8 14:59:31 2014 +0200
resize image and view image in full size
---
pollen-ui-angular/src/main/webapp/index.html | 6 +--
pollen-ui-angular/src/main/webapp/js/directives.js | 34 ++++++++++++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 43 ++++++++++++++++++++--
.../src/main/webapp/less/variables.less | 4 +-
.../src/main/webapp/partials/inline-poll.html | 2 +-
.../src/main/webapp/partials/zoomImage.html | 7 ++++
6 files changed, 87 insertions(+), 9 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index 34ec952..7f154b2 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -31,9 +31,9 @@
ou
$ mvn compile
-->
- <!--<link rel="stylesheet/less" type="text/css" href="less/style.less" />
- <script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>-->
- <link rel="stylesheet" type="text/css" href="css/style.css"/>
+ <link rel="stylesheet/less" type="text/css" href="less/style.less" />
+ <script language="javascript" type="text/javascript" src="lib/less/dist/less-1.7.3.min.js"></script>
+ <!--<link rel="stylesheet" type="text/css" href="css/style.css"/>-->
<script language="javascript" type="text/javascript" src="js/conf.js"></script>
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index a006325..755eb81 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -434,6 +434,10 @@ angular.module('pollenDirective', [])
}])
+//////////////////////////////////////
+///// UPLOAD FILE /////
+//////////////////////////////////////
+
.directive("uploadFile", function () {
return {
restrict : "E",
@@ -446,7 +450,6 @@ angular.module('pollenDirective', [])
var reader = new FileReader();
reader.onload = function (loadEvent) {
scope.$apply(function () {
-// scope.ngModel.data = loadEvent.target.result;
scope.ngModel = { meta: changeEvent.target.files[0], data: loadEvent.target.result};
});
}
@@ -455,4 +458,33 @@ angular.module('pollenDirective', [])
}
}
+})
+
+//////////////////////////////////////
+///// ZOOM IMAGE /////
+//////////////////////////////////////
+
+.directive("zoomImage", function () {
+ return {
+ restrict : "E",
+ scope : {
+ image : "=",
+ name : "="
+ },
+ transclude : true,
+ templateUrl : "partials/zoomImage.html",
+ link : function (scope, element, attrs) {
+ scope.showImage = false;
+
+ var toggleZoom = function () {
+ scope.$apply(function() {
+ scope.showImage = !scope.showImage;
+ });
+ };
+
+ element.bind("click", function (event) {
+ toggleZoom();
+ });
+ }
+ }
})
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 5e6e25b..f61e193 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -11,9 +11,9 @@
margin-top:60px;
}
-@media screen and (max-width:770px) {
+@media screen and (max-width: @responsive-min-width) {
#content, #pollenMenu, #pollenMenu .container-fluid, #poll-link {
- width:770px !important;
+ width:@responsive-min-width !important;
}
}
@@ -132,7 +132,6 @@
@media screen and (max-width: @responsive-large-width) {
@foot-padding : 1.8%;
@foot-height : 80px;
- @responsive-height: 600px;
#poll-link {
text-align:center;
@@ -432,6 +431,44 @@ hr {
margin-bottom:15px;
}
+
+.full {
+ position:fixed;
+ top:0%;
+ left:0%;
+ width:100%;
+ height:100%;
+ margin:0px;
+ padding:0px;
+ z-index:5000;
+ text-align:center;
+ background-color:rgba(0,0,0,0.5);
+
+ .full-content {
+ display:inline-block;
+ max-width:100%;
+ max-height:100%;
+ margin-top:1.25%;
+ margin-bottom:0px;
+ margin-left:1.25%;
+ margin-right:1.25%;
+ padding:8px;
+ background-color:@borderColor;
+ border-radius:8px;
+
+ span {
+ display:block;
+ padding-top:2px;
+ }
+ img {
+ max-width:95% !important;
+ max-height:95% !important;
+ padding:0;
+ margin:0;
+ }
+ }
+}
+
.ng-enter, .ng-leave {
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) @short-time-transition;
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) @short-time-transition;
diff --git a/pollen-ui-angular/src/main/webapp/less/variables.less b/pollen-ui-angular/src/main/webapp/less/variables.less
index 31cd251..18b3ea0 100644
--- a/pollen-ui-angular/src/main/webapp/less/variables.less
+++ b/pollen-ui-angular/src/main/webapp/less/variables.less
@@ -9,4 +9,6 @@
@danger-color : @brand-danger;
@danger-hover-color : darken(@danger-color, 15%);
-@responsive-large-width : 1024px;
\ No newline at end of file
+@responsive-large-width : 1024px;
+@responsive-min-width : 770px;
+@responsive-height: 600px;
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
index 4801314..af8c658 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -56,7 +56,7 @@
<info-error error="choice.restError.value[0]" data="choice.value"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
<br/>
- <img ng-attr-src="{{choice.value.data}}" />
+ <zoom-image image="choice.value.data" name="choice.value.meta.name"></zoom-image>
</div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/zoomImage.html b/pollen-ui-angular/src/main/webapp/partials/zoomImage.html
new file mode 100644
index 0000000..43db544
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/partials/zoomImage.html
@@ -0,0 +1,7 @@
+<div><img ng-attr-src="{{image}}" /></div>
+<div ng-show="showImage" class="full">
+ <div class="full-content">
+ <span>{{name}}</span>
+ <img ng-attr-src="{{image}}" />
+ </div>
+</div>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit d73a42e650cbc181eb22bf3b361e2c1216f452d5
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 17:25:58 2014 +0200
add choice type Image
---
pollen-persistence/src/main/xmi/pollen.properties | 1 +
.../chorem/pollen/services/bean/ChoiceBean.java | 11 ++--
.../pollen/services/service/ChoiceService.java | 14 ++---
.../src/main/webapp/js/controllers/pollCtrl.js | 59 ++++++++++++++++------
pollen-ui-angular/src/main/webapp/js/directives.js | 28 +++++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 5 ++
.../src/main/webapp/partials/inline-poll.html | 16 +++++-
.../src/main/webapp/partials/poll-popupChoice.html | 20 ++++++--
.../src/main/webapp/partials/poll-result.html | 2 +-
9 files changed, 121 insertions(+), 35 deletions(-)
diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties
index 0b26c1f..8a4f95e 100644
--- a/pollen-persistence/src/main/xmi/pollen.properties
+++ b/pollen-persistence/src/main/xmi/pollen.properties
@@ -30,6 +30,7 @@ model.tagValue.hibernateAttributeType.String=string
# Text
org.chorem.pollen.persistence.entity.Poll.attribute.description.tagValue.hibernateAttributeType=text
org.chorem.pollen.persistence.entity.Choice.attribute.description.tagValue.hibernateAttributeType=text
+org.chorem.pollen.persistence.entity.Choice.attribute.name.tagValue.hibernateAttributeType=text
org.chorem.pollen.persistence.entity.Comment.attribute.text.tagValue.hibernateAttributeType=text
# clef naturelle non modifiable sur PollenToken.token
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
index 99c7fb6..fa0b5fa 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
@@ -75,8 +75,8 @@ public class ChoiceBean extends PollenBean<Choice> {
case IMAGE:
- throw new IllegalStateException("Not implemented");
- //break;
+ setValue(entity.getName());
+ break;
}
setDescription(entity.getDescription());
@@ -109,8 +109,11 @@ public class ChoiceBean extends PollenBean<Choice> {
case IMAGE:
- throw new IllegalStateException("Not implemented");
- //break;
+ if ( getValue() != null ) {
+ entity.setName(getValue());
+ }
+
+ break;
}
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index f47aa77..ae476f4 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -237,24 +237,24 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
toSave.setName(choice.getValue());
- toSave.setDescription(choice.getDescription());
- toSave.setCreator(poll.getCreator());
break;
case DATE:
toSave.setName(choice.getValue());
- toSave.setDescription(choice.getDescription());
- toSave.setCreator(poll.getCreator());
break;
case IMAGE:
- throw new IllegalStateException("Not implemented");
+ toSave.setName(choice.getValue());
+
}
+ toSave.setDescription(choice.getDescription());
+ toSave.setCreator(poll.getCreator());
+
return toSave;
}
@@ -328,8 +328,8 @@ public class ChoiceService extends PollenServiceSupport {
break;
case IMAGE:
-
- throw new IllegalStateException("Not implemented");
+ // TODO : verify picture
+ break;
}
}
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index 8395de8..9bb3187 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -200,6 +200,31 @@ angular.module('pollControllers', [])
}
}
+ $scope.preSendChoice = function (choice) {
+ if (choice.choiceType == 'DATE') {
+ choice.value = choice.value.getTime();
+ }
+ else if (choice.choiceType == 'IMAGE') {
+
+ choice.value = choice.value.meta.name+"####"+choice.value.data;
+ }
+
+ return choice;
+ }
+
+ $scope.postReceiveChoice = function (choice) {
+ if (choice.choiceType == 'DATE') {
+ choice.value = new Date(Number(choice.value));
+ }
+ else if (choice.choiceType == 'IMAGE') {
+ var tmp = choice.value.split("####");
+
+ choice.value = {meta:{name:tmp[0]}, data : tmp[1]};
+ }
+
+ return choice;
+ }
+
$timeout(function () {
$scope.$watch('data.poll.voteCountingType', function (newVal, oldVal) {
if (newVal != oldVal && oldVal !== undefined) {
@@ -386,6 +411,9 @@ angular.module('pollControllers', [])
else if (choice.choiceType == 'DATE') {
choice.valueDate = choice.value;
}
+ else if (choice.choiceType == 'IMAGE') {
+ choice.valueImage = choice.value;
+ }
// set default date
if (angular.isUndefined(choice.valueDate)) {
@@ -410,8 +438,12 @@ angular.module('pollControllers', [])
choice.value = choice.valueDate;
$scope.globalVariables.lastDate = angular.copy(choice.valueDate);
}
+ else if (choice.choiceType == 'IMAGE') {
+ choice.value = choice.valueImage;
+ }
delete choice.valueText;
delete choice.valueDate;
+ delete choice.valueImage
if (!angular.equals(choiceEdit, choice)) {
choiceEdit.value = choice.value;
@@ -510,9 +542,7 @@ angular.module('pollControllers', [])
poll.choice = angular.copy($scope.data.choices);
angular.forEach(poll.choice, function(choice) {
- if (choice.choiceType == 'DATE') {
- choice.value = choice.value.getTime();
- }
+ choice = $scope.preSendChoice(choice);
});
if (angular.isDate(poll.beginDate)) {
@@ -571,9 +601,7 @@ angular.module('pollControllers', [])
$scope.callBackAddChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (saveChoice.choiceType == 'DATE') {
- saveChoice.value = saveChoice.value.getTime();
- }
+ saveChoice = $scope.preSendChoice(saveChoice);
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function (data) {
delete choice.restError;
@@ -587,9 +615,7 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (saveChoice.choiceType == 'DATE') {
- saveChoice.value = saveChoice.value.getTime();
- }
+ saveChoice = $scope.preSendChoice(saveChoice);
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function() {
delete choice.restError;
@@ -860,9 +886,7 @@ angular.module('pollControllers', [])
PollChoice.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}).$promise.then(function (choices) {
$scope.data.choices = choices;
angular.forEach(choices, function (ch) {
- if (ch.choiceType == 'DATE') {
- ch.value = new Date(Number(ch.value));
- }
+ ch = $scope.postReceiveChoice(ch);
})
$scope.data.vote = {};
$scope.data.vote.choice = $scope.data.choices;
@@ -932,9 +956,7 @@ angular.module('pollControllers', [])
var pollChoicePromise = PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
angular.forEach(choices, function (ch) {
- if (ch.choiceType == 'DATE') {
- ch.value = new Date(Number(ch.value));
- }
+ ch = $scope.postReceiveChoice(ch);
});
$scope.data.choices = choices;
@@ -1230,6 +1252,9 @@ angular.module('pollControllers', [])
var choicesDeferred = $q.defer();
PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
$scope.data.choices = choices;
+ angular.forEach(choices, function (choice) {
+ choice = $scope.postReceiveChoice(choice);
+ });
choicesDeferred.resolve('choices load');
});
@@ -1264,6 +1289,10 @@ angular.module('pollControllers', [])
scores.push([$filter('date')(value.choice.value, $scope.globalVariables.dateFormat), value.scoreValue]);
break;
+ case 'IMAGE':
+ scores.push([value.choice.value.meta.name, value.scoreValue]);
+ break;
+
default:
scores.push([key, value.scoreValue]);
}
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index f3ef921..a006325 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -144,7 +144,7 @@ angular.module('pollenDirective', [])
}
});
- element.bind('blur', function () {
+ element.bind('blur change', function () {
$timeout (function () {
scope.$apply(attrs.ngExit);
}, 150);
@@ -431,4 +431,28 @@ angular.module('pollenDirective', [])
})
}
}
-}])
\ No newline at end of file
+}])
+
+
+.directive("uploadFile", function () {
+ return {
+ restrict : "E",
+ scope: {
+ ngModel: "="
+ },
+ template:'<input type="file" />',
+ link: function (scope, element, attrs) {
+ element.bind("change", function (changeEvent) {
+ var reader = new FileReader();
+ reader.onload = function (loadEvent) {
+ scope.$apply(function () {
+// scope.ngModel.data = loadEvent.target.result;
+ scope.ngModel = { meta: changeEvent.target.files[0], data: loadEvent.target.result};
+ });
+ }
+ reader.readAsDataURL( changeEvent.target.files[0] );
+ });
+
+ }
+ }
+})
\ No newline at end of file
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 8f39e9b..5e6e25b 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -211,6 +211,11 @@
height:60px;
width:80px;
}
+
+ img {
+ max-width:200px;
+ max-height:200px;
+ }
}
}
diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
index abaf068..4801314 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -24,7 +24,9 @@
<table id="poll-inline">
<!-- begin print choices -->
<tr>
- <td><button ng-click="bigVersion()" class="btn btn-default" >Big version</button></td>
+ <td>
+ <!--<button ng-click="bigVersion()" class="btn btn-default" >Big version</button>-->
+ </td>
<td ng-repeat="choice in data.choices" class="pollChoice pollAnim" ng-mouseenter="showEditHover = true" ng-mouseleave="showEditHover = false">
<div ng-if="choice.choiceType == 'TEXT'" edit-me="showEdit" >
<div ng-hide="showEdit && !globalVariables.voted" class="fixe-input" title="{{choice.description}}">
@@ -48,6 +50,18 @@
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
+ <div ng-if="choice.choiceType == 'IMAGE'">
+ <div class="fixe-input" title="{{choice.description}}">
+ {{choice.value.meta.name}}
+ <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
+ <input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
+ <br/>
+ <img ng-attr-src="{{choice.value.data}}" />
+
+ </div>
+
+
+ </div>
</td>
<td ng-if="!globalVariables.voted && globalVariables.editMode"><button class="btn btn-default btn-large" ng-click="addChoice()"> <span class="glyphicon glyphicon-plus"></span> </button></td>
</tr>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
index b81131d..bb2bf39 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -31,28 +31,38 @@
<div class="col-sm-8 btn-group">
<button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'TEXT'">Text</button>
<button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'DATE'">Date</button>
- <button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'IMAGE'" disabled>Image</button>
+ <button type="button" class="btn btn-default" ng-model="choice.choiceType" btn-radio="'IMAGE'">Image</button>
</div>
</div>
<div class="form-group" ng-if="choice.choiceType == 'TEXT'">
- <label for="popNameChoiceCheck" class="col-sm-4 control-label">Nom du Choix : </label>
+ <label for="popChoiceText" class="col-sm-4 control-label">Nom du Choix : </label>
<div class="col-sm-6">
- <input id="popNameChoiceCheck" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
+ <input id="popChoiceText" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
</div>
</div>
<div class="form-group" ng-if="choice.choiceType == 'DATE'">
- <label for="popNameChoiceDate" class="col-sm-4 control-label">Date : </label>
+ <label for="popChoiceDate" class="col-sm-4 control-label">Date : </label>
<div class="col-sm-6">
<div class="right-inner-addon ">
<i class="glyphicon glyphicon-calendar glyphicon-input"></i>
- <input id="popNameChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.valueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
+ <input id="popChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.valueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
</div>
</div>
</div>
+
+ <div class="form-group" ng-if="choice.choiceType == 'IMAGE'">
+ <label for="popChoiceImage" class="col-sm-4 control-label">Image : </label>
+
+ <div class="col-sm-6">
+ <upload-file id="popChoiceImage" ng-model="choice.valueImage" focus-me="choice.choiceType == 'IMAGE'" ></upload-file>
+ {{choice.valueImage.meta.name}}
+ </div>
+ </div>
+
<div class="form-group">
<label for="popDescChoice" class="col-sm-4 control-label">Description : </label>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-result.html b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
index dd918ea..6965664 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-result.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
@@ -24,7 +24,7 @@
<th>{{ 'poll.result.score' | translate }}</th>
</tr>
<tr ng-repeat="score in data.result.scores">
- <th> {{ score.choice.name || (score.choice.date | date:globalVariables.dateFormat) }} </th>
+ <th> {{ score.choice.value.meta.name || (score.choice.value | date:globalVariables.dateFormat) || score.choice.value }} </th>
<td>
{{score.scoreValue}}
</td>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit d3a66fccd63101da4f9bde59a1d0e9f3142b5ec6
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 12:43:36 2014 +0200
fix test : bad name error
---
.../java/org/chorem/pollen/services/service/PollServiceTest.java | 4 ++--
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
index e3c43d2..448e5a8 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
@@ -169,7 +169,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
Assert.fail();
} catch (InvalidFormException e) {
// missing choice name
- assertErrorKeyFound(e, "choice[0].name");
+ assertErrorKeyFound(e, "choice[0].value");
}
choice1.setValue("A");
@@ -187,7 +187,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
Assert.fail();
} catch (InvalidFormException e) {
// duplicated choice name
- assertErrorKeyFound(e, "choice[1].name");
+ assertErrorKeyFound(e, "choice[1].value");
}
choice2.setValue("B");
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index 4f2620b..8395de8 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -510,7 +510,6 @@ angular.module('pollControllers', [])
poll.choice = angular.copy($scope.data.choices);
angular.forEach(poll.choice, function(choice) {
- console.log(choice);
if (choice.choiceType == 'DATE') {
choice.value = choice.value.getTime();
}
@@ -932,6 +931,12 @@ angular.module('pollControllers', [])
}
var pollChoicePromise = PollChoice.query({pollId:$routeParams.pollId}, function (choices) {
+ angular.forEach(choices, function (ch) {
+ if (ch.choiceType == 'DATE') {
+ ch.value = new Date(Number(ch.value));
+ }
+ });
+
$scope.data.choices = choices;
}).$promise;
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit 20e64cb2096b24afb43df85926eb0f9099ea19f4
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 11:40:13 2014 +0200
change choiceBean
---
.../org/chorem/pollen/rest/api/PollApiTest.java | 22 ++----
.../rest/api/converter/JsonArrayConverterTest.java | 8 +-
.../rest/api/converter/JsonConverterTest.java | 4 +-
.../chorem/pollen/services/bean/ChoiceBean.java | 32 +++-----
.../pollen/services/service/ChoiceService.java | 18 ++---
.../pollen/services/service/PollServiceTest.java | 56 +++++++-------
.../services/service/VoteCountingServiceTest.java | 4 +-
.../services/service/VoterListServiceTest.java | 4 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 85 ++++++++++++++++------
.../src/main/webapp/partials/inline-poll.html | 13 ++--
.../src/main/webapp/partials/poll-popupChoice.html | 4 +-
11 files changed, 138 insertions(+), 112 deletions(-)
diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java
index 7bd1100..37cf5b1 100644
--- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java
+++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java
@@ -23,16 +23,10 @@ package org.chorem.pollen.rest.api;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.fluent.Request;
-import org.chorem.pollen.persistence.entity.Choice;
-import org.chorem.pollen.persistence.entity.ChoiceImpl;
-import org.chorem.pollen.persistence.entity.ChoiceType;
-import org.chorem.pollen.persistence.entity.CommentVisibility;
-import org.chorem.pollen.persistence.entity.Poll;
-import org.chorem.pollen.persistence.entity.PollImpl;
-import org.chorem.pollen.persistence.entity.PollType;
-import org.chorem.pollen.persistence.entity.ResultVisibility;
-import org.chorem.pollen.persistence.entity.VoteVisibility;
+import org.chorem.pollen.persistence.entity.*;
import org.chorem.pollen.services.PollenFixtures;
+import org.chorem.pollen.services.bean.ChoiceBean;
+import org.chorem.pollen.services.bean.PollenBeans;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -127,14 +121,14 @@ public class PollApiTest extends AbstractPollenRestApiTest {
poll.setVoteCountingType(1);
poll.setTitle("title");
- List<Choice> choices = new ArrayList<>();
- Choice choice1 = new ChoiceImpl();
+ List<ChoiceBean> choices = new ArrayList<>();
+ ChoiceBean choice1 = new ChoiceBean();
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("choiceA");
+ choice1.setValue("choiceA");
choices.add(choice1);
- Choice choice2 = new ChoiceImpl();
+ ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("choiceB");
+ choice2.setValue("choiceB");
choices.add(choice2);
String choiceStr = getJsonHelper().toJson(choices);
diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java
index 78294be..649e8a6 100644
--- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java
+++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonArrayConverterTest.java
@@ -32,8 +32,8 @@ public class JsonArrayConverterTest {
@Test
public void convertToType() throws Exception {
- String choicesStr = "[ {id: \"AAAA\", name: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " +
- " {id: \"BBBB\", name: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]";
+ String choicesStr = "[ {id: \"AAAA\", value: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " +
+ " {id: \"BBBB\", value: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]";
JsonArrayConverter converter = JsonArrayConverter.newConverter(new DefaultTopiaIdFactory(), ChoiceBean.class);
@@ -42,12 +42,12 @@ public class JsonArrayConverterTest {
Assert.assertEquals(2, choices.length);
Assert.assertNotNull(choices[0]);
- Assert.assertEquals("choice1", choices[0].getName());
+ Assert.assertEquals("choice1", choices[0].getValue());
Assert.assertEquals(ChoiceType.TEXT, choices[0].getChoiceType());
Assert.assertEquals(1, choices[0].getChoiceOrder());
Assert.assertNotNull(choices[1]);
- Assert.assertEquals("choice2", choices[1].getName());
+ Assert.assertEquals("choice2", choices[1].getValue());
Assert.assertEquals(ChoiceType.IMAGE, choices[1].getChoiceType());
Assert.assertEquals(2, choices[1].getChoiceOrder());
diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java
index 35bd59d..eea755d 100644
--- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java
+++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/converter/JsonConverterTest.java
@@ -64,8 +64,8 @@ public class JsonConverterTest {
public void convertEntity() {
String pollStr = "{topiaCreateDate: 1399033089600, title: \"pollTitle\", " +
- "choice: [ {name: \"choice1\", choiceType: \"TEXT\"}, " +
- "{name: \"choice2\", choiceType: \"IMAGE\"} ], voteVisibility: \"ANONYMOUS\", " +
+ "choice: [ {value: \"choice1\", choiceType: \"TEXT\"}, " +
+ "{value: \"choice2\", choiceType: \"IMAGE\"} ], voteVisibility: \"ANONYMOUS\", " +
"commentVisibility:\"NOBODY\", pollType: \"FREE\" }";
JsonConverter<Poll> converter = JsonConverter.newEntityConverter(new DefaultTopiaIdFactory(), Poll.class);
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
index 7e40513..99c7fb6 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/ChoiceBean.java
@@ -39,9 +39,7 @@ public class ChoiceBean extends PollenBean<Choice> {
protected int choiceOrder;
- protected String name;
-
- protected Date date;
+ protected String value;
protected ChoiceType choiceType;
@@ -68,13 +66,11 @@ public class ChoiceBean extends PollenBean<Choice> {
switch (entity.getChoiceType()) {
case TEXT:
- setName(entity.getName());
- setDate(null);
+ setValue(entity.getName());
break;
case DATE:
- setName(null);
- setDate(new Date(Long.parseLong(entity.getName())));
+ setValue(entity.getName());
break;
case IMAGE:
@@ -100,13 +96,13 @@ public class ChoiceBean extends PollenBean<Choice> {
if (choiceType != null) {
switch (choiceType) {
case TEXT:
- entity.setName(getName());
+ entity.setName(getValue());
break;
case DATE:
- if ( getDate() != null ) {
- entity.setName(String.valueOf(getDate().getTime()));
+ if ( getValue() != null ) {
+ entity.setName(getValue());
}
break;
@@ -134,20 +130,12 @@ public class ChoiceBean extends PollenBean<Choice> {
this.permission = permission;
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Date getDate() {
- return date;
+ public String getValue() {
+ return value;
}
- public void setDate(Date date) {
- this.date = date;
+ public void setValue(String value) {
+ this.value = value;
}
public ChoiceType getChoiceType() {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index 72852b0..f47aa77 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -236,7 +236,7 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
- toSave.setName(choice.getName());
+ toSave.setName(choice.getValue());
toSave.setDescription(choice.getDescription());
toSave.setCreator(poll.getCreator());
@@ -244,7 +244,7 @@ public class ChoiceService extends PollenServiceSupport {
case DATE:
- toSave.setName(String.valueOf(choice.getDate().getTime()));
+ toSave.setName(choice.getValue());
toSave.setDescription(choice.getDescription());
toSave.setCreator(poll.getCreator());
@@ -293,36 +293,36 @@ public class ChoiceService extends PollenServiceSupport {
case TEXT:
- String choiceName = choice.getName();
+ String choiceName = choice.getValue();
boolean nameNotBlank = checkNotBlank(errors,
- "name",
+ "value",
choiceName,
l(getLocale(), "pollen.error.choice.choiceNameEmpty"));
if (nameNotBlank) {
boolean nameAdded = choiceNames.add(choiceName);
- check(errors, "name", nameAdded, l(getLocale(), "pollen.error.choice.choiceNameExist"));
+ check(errors, "value", nameAdded, l(getLocale(), "pollen.error.choice.choiceNameExist"));
}
break;
case DATE:
- Date choiceDate = choice.getDate();
+ Date choiceDate = new Date(Long.parseLong(choice.getValue()));
boolean dateNotBlank;
if (choiceDate == null) {
- dateNotBlank = checkNotBlank(errors, "date", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
+ dateNotBlank = checkNotBlank(errors, "value", null, l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
}
else {
dateNotBlank = checkNotBlank(errors,
- "date",
+ "value",
String.valueOf(choiceDate),
l(getLocale(), "pollen.error.choice.choiceDateEmpty"));
}
if (dateNotBlank) {
boolean dateAdded = choiceNames.add(String.valueOf(choiceDate.getTime()));
- check(errors, "date", dateAdded, l(getLocale(), "pollen.error.choice.choiceDateExist"));
+ check(errors, "value", dateAdded, l(getLocale(), "pollen.error.choice.choiceDateExist"));
}
break;
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
index ce07c29..e3c43d2 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/PollServiceTest.java
@@ -85,13 +85,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean choice1 = new ChoiceBean();
choices.add(choice1);
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("B");
+ choice2.setValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
@@ -117,7 +117,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
Assert.assertEquals(createdChoice1, reloadedChoice1);
- Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+ Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
@@ -128,7 +128,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
Assert.assertEquals(createdChoice2, reloadedChoice2);
- Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+ Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
}
@@ -172,13 +172,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
assertErrorKeyFound(e, "choice[0].name");
}
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("A");
+ choice2.setValue("A");
choice2.setDescription("Choice B");
choices.add(choice2);
@@ -190,7 +190,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
assertErrorKeyFound(e, "choice[1].name");
}
- choice2.setName("B");
+ choice2.setValue("B");
PollenEntityRef<Poll> createdPoll = service.createPoll(poll, choices);
@@ -205,7 +205,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// Assert.assertNotNull(createdPoll.getCreator());
// Assert.assertNotNull(createdPoll.getCreator().getTopiaId());
-// Assert.assertNull(createdPoll.getCreator().getName());
+// Assert.assertNull(createdPoll.getCreator().getValue());
// Assert.assertNull(createdPoll.getCreator().getEmail());
// Assert.assertNull(createdPoll.getComment());
// Assert.assertNull(createdPoll.getVote());
@@ -224,7 +224,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
Assert.assertEquals(createdChoice1, reloadedChoice1);
- Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+ Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
ChoiceBean createdChoice2 = createdChoices.get(1);
@@ -234,7 +234,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
Assert.assertEquals(createdChoice2, reloadedChoice2);
- Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+ Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
}
@@ -253,13 +253,13 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean choice1 = new ChoiceBean();
// choices.add(choice1);
// choice1.setChoiceType(ChoiceType.TEXT);
-// choice1.setName("A");
+// choice1.setValue("A");
// choice1.setDescription("Choice A");
//
//
// ChoiceBean choice2 = new ChoiceBean();
// choice2.setChoiceType(ChoiceType.TEXT);
-// choice2.setName("B");
+// choice2.setValue("B");
// choice2.setDescription("Choice B");
// choices.add(choice2);
//
@@ -289,7 +289,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//
//// Assert.assertNotNull(createdPoll.getCreator());
//// Assert.assertNotNull(createdPoll.getCreator().getTopiaId());
-//// Assert.assertNull(createdPoll.getCreator().getName());
+//// Assert.assertNull(createdPoll.getCreator().getValue());
//// Assert.assertNull(createdPoll.getCreator().getEmail());
//
// List<ChoiceBean> createdChoices = choiceService.getChoices(createdPollId);
@@ -304,7 +304,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
// Assert.assertEquals(createdChoice1, reloadedChoice1);
//
-// Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+// Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
// Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice1.getCreator());
//
@@ -315,7 +315,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
// Assert.assertEquals(createdChoice2, reloadedChoice2);
//
-// Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+// Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
// Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice2.getCreator());
//
@@ -330,7 +330,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// VoterListBean reloadedVoterList = voterListService.getVoterList(createdPollId, createdVoterList.getEntityId());
// Assert.assertEquals(createdVoterList, reloadedVoterList);
//
-// Assert.assertEquals(voterList.getName(), createdVoterList.getName());
+// Assert.assertEquals(voterList.getValue(), createdVoterList.getValue());
// Assert.assertEquals(voterList.getWeight(), createdVoterList.getWeight(), 0);
//
// Assert.assertNotNull(createdVoterList.getMember());
@@ -350,14 +350,14 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//
// ChoiceBean choice1 = new ChoiceBean();
// choice1.setChoiceType(ChoiceType.TEXT);
-// choice1.setName("A");
+// choice1.setValue("A");
// choice1.setDescription("Choice A");
//
// choices.add(choice1);
//
// ChoiceBean choice2 = new ChoiceBean();
// choice2.setChoiceType(ChoiceType.TEXT);
-// choice2.setName("B");
+// choice2.setValue("B");
// choice2.setDescription("Choice B");
//
// choices.add(choice2);
@@ -387,7 +387,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// assertErrorKeyFound(e, "voterList[0].name", "voterList[0].weight", "voterList[0].member");
// }
//
-// voterList.setName("voterList1");
+// voterList.setValue("voterList1");
// voterList.setWeight(1);
//
// VoterListMemberBean voterListMember1 = new VoterListMemberBean();
@@ -402,7 +402,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// assertErrorKeyFound(e, "voterList[0].member[0].name", "voterList[0].member[0].email", "voterList[0].member[0].weight");
// }
//
-// voterListMember1.setName("voter1");
+// voterListMember1.setValue("voter1");
// voterListMember1.setWeight(0.3);
// voterListMember1.setEmail("voter1_pollen.org");
//
@@ -417,7 +417,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// voterListMember1.setEmail("voter1(a)pollen.org");
//
// VoterListMemberBean voterListMember2 = new VoterListMemberBean();
-// voterListMember2.setName("voter1");
+// voterListMember2.setValue("voter1");
// voterListMember2.setWeight(0.7);
// voterListMember2.setEmail("voter1(a)pollen.org");
// voterList.addMember(voterListMember2);
@@ -431,7 +431,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// assertErrorKeyFound(e, "voterList[0].member[1].name", "voterList[0].member[1].email");
// }
//
-// voterListMember2.setName("voter2");
+// voterListMember2.setValue("voter2");
// voterListMember2.setEmail("voter2(a)pollen.org");
//
// PollenEntityRef<Poll> createdPoll = service.createPoll(poll, choices);
@@ -457,7 +457,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//
//// Assert.assertNotNull(createdPoll.getCreator());
//// Assert.assertNotNull(createdPoll.getCreator().getTopiaId());
-//// Assert.assertNull(createdPoll.getCreator().getName());
+//// Assert.assertNull(createdPoll.getCreator().getValue());
//// Assert.assertNull(createdPoll.getCreator().getEmail());
//// Assert.assertNull(createdPoll.getComment());
//// Assert.assertNull(createdPoll.getVote());
@@ -474,7 +474,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice1 = choiceService.getChoice(createdPollId, createdChoice1.getEntityId());
// Assert.assertEquals(createdChoice1, reloadedChoice1);
//
-// Assert.assertEquals(choice1.getName(), createdChoice1.getName());
+// Assert.assertEquals(choice1.getValue(), createdChoice1.getValue());
// Assert.assertEquals(choice1.getDescription(), createdChoice1.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice1.getCreator());
//
@@ -485,7 +485,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// ChoiceBean reloadedChoice2 = choiceService.getChoice(createdPollId, createdChoice2.getEntityId());
// Assert.assertEquals(createdChoice2, reloadedChoice2);
//
-// Assert.assertEquals(choice2.getName(), createdChoice2.getName());
+// Assert.assertEquals(choice2.getValue(), createdChoice2.getValue());
// Assert.assertEquals(choice2.getDescription(), createdChoice2.getDescription());
//// Assert.assertEquals(createdPoll.getCreator(), createdChoice2.getCreator());
//
@@ -500,7 +500,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
// VoterListBean reloadedVoterList = voterListService.getVoterList(createdPollId, createdVoterList.getEntityId());
// Assert.assertEquals(createdVoterList, reloadedVoterList);
//
-// Assert.assertEquals(voterList.getName(), createdVoterList.getName());
+// Assert.assertEquals(voterList.getValue(), createdVoterList.getValue());
// Assert.assertEquals(voterList.getWeight(), createdVoterList.getWeight(), 0);
//
// Assert.assertNotNull(createdVoterList.getMember());
@@ -513,7 +513,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//// VoterListMember reloadedVoterListMember1 = voterListService.getMember(createdPoll.getTopiaId(), createdVoterList.getTopiaId(), createdVoterListMember1.getTopiaId());
//// Assert.assertEquals(createdVoterListMember1, reloadedVoterListMember1);
////
-//// Assert.assertEquals(reloadedVoterListMember1.getName(), createdVoterListMember1.getName());
+//// Assert.assertEquals(reloadedVoterListMember1.getValue(), createdVoterListMember1.getValue());
//// Assert.assertEquals(reloadedVoterListMember1.getEmail(), createdVoterListMember1.getEmail());
//// Assert.assertEquals(reloadedVoterListMember1.getWeight(), createdVoterListMember1.getWeight(), 0);
////
@@ -525,7 +525,7 @@ public class PollServiceTest extends AbstractPollenServiceTest {
//// VoterListMember reloadedVoterListMember2 = voterListService.getMember(createdPoll.getTopiaId(), createdVoterList.getTopiaId(), createdVoterListMember2.getTopiaId());
//// Assert.assertEquals(createdVoterListMember2, reloadedVoterListMember2);
////
-//// Assert.assertEquals(reloadedVoterListMember2.getName(), createdVoterListMember2.getName());
+//// Assert.assertEquals(reloadedVoterListMember2.getValue(), createdVoterListMember2.getValue());
//// Assert.assertEquals(reloadedVoterListMember2.getEmail(), createdVoterListMember2.getEmail());
//// Assert.assertEquals(reloadedVoterListMember2.getWeight(), createdVoterListMember2.getWeight(), 0);
//
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java
index e06ce45..d7f1703 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java
@@ -83,13 +83,13 @@ public class VoteCountingServiceTest extends AbstractPollenServiceTest {
ChoiceBean choice1 = new ChoiceBean();
choices.add(choice1);
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("B");
+ choice2.setValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java
index 23c3976..1fcc304 100644
--- a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java
+++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java
@@ -100,12 +100,12 @@ public class VoterListServiceTest extends AbstractPollenServiceTest {
ChoiceBean choice1 = new ChoiceBean();
choices.add(choice1);
choice1.setChoiceType(ChoiceType.TEXT);
- choice1.setName("A");
+ choice1.setValue("A");
choice1.setDescription("Choice A");
ChoiceBean choice2 = new ChoiceBean();
choice2.setChoiceType(ChoiceType.TEXT);
- choice2.setName("B");
+ choice2.setValue("B");
choice2.setDescription("Choice B");
choices.add(choice2);
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index a7ec70c..4f2620b 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -341,9 +341,9 @@ angular.module('pollControllers', [])
var initChoice = function () {
return {
- name: '',
- date: $scope.globalVariables.lastDate,
- choiceType: $scope.globalVariables.lastType
+ choiceType : $scope.globalVariables.lastType,
+ valueText : '',
+ valueDate : $scope.globalVariables.lastDate,
};
}
@@ -371,25 +371,54 @@ angular.module('pollControllers', [])
}
}
- var popupChoice = function (choice, title, callBack) {
- var oldChoice = angular.copy(choice);
+ var popupChoice = function (choiceEdit, title, callBack) {
+ var choice = angular.copy(choiceEdit);
+
var modalInstance = $modal.open({
templateUrl : 'partials/poll-popupChoice.html',
controller : PollPopChoiceCtrl,
resolve : {
title : function () { return title;},
- choice : function () { return choice;},
+ choice : function () {
+ if (choice.choiceType == 'TEXT') {
+ choice.valueText = choice.value;
+ }
+ else if (choice.choiceType == 'DATE') {
+ choice.valueDate = choice.value;
+ }
+
+ // set default date
+ if (angular.isUndefined(choice.valueDate)) {
+ choice.valueDate = $scope.globalVariables.lastDate;
+ }
+
+ return choice;
+ },
dateFormat : function () { return $scope.globalVariables.dateFormat;}
}
});
modalInstance.result.then(function (returnChoice) {
- $scope.deleteChoice(returnChoice);
+ $scope.deleteChoice(choiceEdit);
}, function () {
$scope.globalVariables.lastType = choice.choiceType;
- $scope.globalVariables.lastDate = choice.date;
- if (!angular.equals(oldChoice, choice)) {
- callBack(choice);
+
+ if (choice.choiceType == 'TEXT') {
+ choice.value = choice.valueText;
+ }
+ else if (choice.choiceType == 'DATE') {
+ choice.value = choice.valueDate;
+ $scope.globalVariables.lastDate = angular.copy(choice.valueDate);
+ }
+ delete choice.valueText;
+ delete choice.valueDate;
+
+ if (!angular.equals(choiceEdit, choice)) {
+ choiceEdit.value = choice.value;
+ choiceEdit.choiceType = choice.choiceType;
+ choiceEdit.description = choice.description;
+
+ callBack(choiceEdit);
}
});
}
@@ -481,8 +510,9 @@ angular.module('pollControllers', [])
poll.choice = angular.copy($scope.data.choices);
angular.forEach(poll.choice, function(choice) {
- if (angular.isDate(choice.date)) {
- choice.date = choice.date.getTime();
+ console.log(choice);
+ if (choice.choiceType == 'DATE') {
+ choice.value = choice.value.getTime();
}
});
@@ -542,8 +572,8 @@ angular.module('pollControllers', [])
$scope.callBackAddChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (angular.isDate(saveChoice.date)) {
- saveChoice.date = saveChoice.date.getTime();
+ if (saveChoice.choiceType == 'DATE') {
+ saveChoice.value = saveChoice.value.getTime();
}
PollChoice.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function (data) {
@@ -558,8 +588,8 @@ angular.module('pollControllers', [])
$scope.callBackEditChoice = function (choice) {
saveChoice = angular.copy(choice);
- if (angular.isDate(saveChoice.date)) {
- saveChoice.date = saveChoice.date.getTime();
+ if (saveChoice.choiceType == 'DATE') {
+ saveChoice.value = saveChoice.value.getTime();
}
PollChoice.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, saveChoice, function() {
@@ -578,9 +608,17 @@ angular.module('pollControllers', [])
$scope.data.choices.splice(index,1);
}
}, function (error) {
- angular.extend($scope.restError, error.data);
- if (angular.isDefined(error.data.choice)) {
- $rootScope.$broadcast('newError', error.data.choice[0]);
+ if (error.status == 400) {
+ angular.extend($scope.restError, error.data);
+ if (angular.isDefined(error.data.choice)) {
+ $rootScope.$broadcast('newError', error.data.choice[0]);
+ }
+ }
+ else {
+ var index = $scope.data.choices.indexOf(choice);
+ if (index > -1) {
+ $scope.data.choices.splice(index,1);
+ }
}
});
};
@@ -822,6 +860,11 @@ angular.module('pollControllers', [])
PollChoice.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}).$promise.then(function (choices) {
$scope.data.choices = choices;
+ angular.forEach(choices, function (ch) {
+ if (ch.choiceType == 'DATE') {
+ ch.value = new Date(Number(ch.value));
+ }
+ })
$scope.data.vote = {};
$scope.data.vote.choice = $scope.data.choices;
});
@@ -1209,11 +1252,11 @@ angular.module('pollControllers', [])
switch (value.choice.choiceType) {
case 'TEXT':
- scores.push([value.choice.name, value.scoreValue]);
+ scores.push([value.choice.value, value.scoreValue]);
break;
case 'DATE':
- scores.push([$filter('date')(value.choice.date, $scope.globalVariables.dateFormat), value.scoreValue]);
+ scores.push([$filter('date')(value.choice.value, $scope.globalVariables.dateFormat), value.scoreValue]);
break;
default:
diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
index 6061367..abaf068 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -28,22 +28,23 @@
<td ng-repeat="choice in data.choices" class="pollChoice pollAnim" ng-mouseenter="showEditHover = true" ng-mouseleave="showEditHover = false">
<div ng-if="choice.choiceType == 'TEXT'" edit-me="showEdit" >
<div ng-hide="showEdit && !globalVariables.voted" class="fixe-input" title="{{choice.description}}">
- {{ choice.name || ('poll.edit' | translate) }}
- <info-error error="choice.restError.name[0]" data="choice.name"></info-error>
+ {{ choice.value || ('poll.edit' | translate) }}
+ <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/></div>
<div ng-show="showEdit && !globalVariables.voted">
- <input type="text" class="form-control" ng-model="choice.name" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/>
+ <input type="text" class="form-control" ng-model="choice.value" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/>
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
<div ng-if="choice.choiceType == 'DATE'" edit-me="showEdit" >
<div ng-hide="!globalVariables.voted && showEdit || isOpen" class="fixe-input" title="{{choice.description}}">
- {{ (choice.date | date:globalVariables.dateFormat) || ('poll.edit' | translate) }}
- <info-error error="choice.restError.date[0]" data="choice.date"></info-error>
+ {{ (choice.value | date:globalVariables.dateFormat) || ('poll.edit' | translate) }}
+ <info-error error="choice.restError.value[0]" data="choice.value"></info-error>
<input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/>
</div>
<div ng-show="!globalVariables.voted && showEdit || isOpen" >
- <input type="text" class="form-control" ng-model="choice.date" focus-me="showEdit" datepicker-popup="{{globalVariables.dateFormat}}" is-open="isOpen" ng-exit="showEdit = false" ng-click="isOpen = true" auto-save="saveChoice(choice)" required/>
+
+ <input type="text" class="form-control" ng-model="choice.value" focus-me="showEdit" datepicker-popup="{{globalVariables.dateFormat}}" is-open="isOpen" ng-exit="showEdit = false" ng-click="isOpen = true" auto-save="saveChoice(choice)" required/>
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
index 3264210..b81131d 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html
@@ -39,7 +39,7 @@
<label for="popNameChoiceCheck" class="col-sm-4 control-label">Nom du Choix : </label>
<div class="col-sm-6">
- <input id="popNameChoiceCheck" type="text" ng-model="choice.name" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
+ <input id="popNameChoiceCheck" type="text" ng-model="choice.valueText" class="form-control" focus-me="choice.choiceType == 'TEXT'"/>
</div>
</div>
@@ -49,7 +49,7 @@
<div class="col-sm-6">
<div class="right-inner-addon ">
<i class="glyphicon glyphicon-calendar glyphicon-input"></i>
- <input id="popNameChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.date" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
+ <input id="popNameChoiceDate" class="form-control" datepicker-popup="{{dateFormat}}" type="text" ng-model="choice.valueDate" is-open="opened" ng-click="opened = true" focus-me="choice.choiceType == 'DATE'"/>
</div>
</div>
</div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit 6001ab6c994f2d04f9d7b216a3e581bc300c89c8
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Mon Jul 7 11:38:46 2014 +0200
eugene 2.11-SNAPSHOT to 2.12-SNAPSHOT
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index b38a5f7..828fae2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,7 +163,7 @@
<webmotionVersion>2.4.1-SNAPSHOT</webmotionVersion>
<nuitonI18nVersion>3.1</nuitonI18nVersion>
- <eugenePluginVersion>2.11-SNAPSHOT</eugenePluginVersion>
+ <eugenePluginVersion>2.12-SNAPSHOT</eugenePluginVersion>
<topiaVersion>3.0-SNAPSHOT</topiaVersion>
<nuitonWebVersion>1.17-SNAPSHOT</nuitonWebVersion>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit b4694b38abfa84ae7ded37198b63e6b351061976
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 4 15:21:46 2014 +0200
Change the title based on the current page
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 15 +++++--
pollen-ui-angular/src/main/webapp/i18n/fr.js | 19 ++++++---
pollen-ui-angular/src/main/webapp/index.html | 7 ++--
pollen-ui-angular/src/main/webapp/js/app.js | 2 +-
.../main/webapp/js/controllers/favoriteListCtrl.js | 6 ++-
.../src/main/webapp/js/controllers/mainCtrl.js | 8 ++++
.../src/main/webapp/js/controllers/pollCtrl.js | 47 +++++++++++++++-------
.../src/main/webapp/js/controllers/userCtrl.js | 24 +++++++----
pollen-ui-angular/src/main/webapp/js/directives.js | 33 +++++++++++++++
.../src/main/webapp/partials/poll-comment.html | 2 +-
.../src/main/webapp/partials/user-edit.html | 2 +-
.../main/webapp/partials/user-lostPassword.html | 2 +-
.../src/main/webapp/partials/user-register.html | 2 +-
13 files changed, 126 insertions(+), 43 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index e4643f8..38d01f0 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -1,9 +1,16 @@
var translateEN = {
-'title.forgotPassword' : 'Forget Password',
-'title.register' : 'Register',
-'title.editUser' : 'Edit Profile',
-'title.comment' : 'Comment',
+'title.home' : 'Home',
+'title.poll.create' : 'Create new poll',
+'title.poll.edit' : 'Edit poll',
+'title.poll.vote' : 'Vote',
+'title.poll.comment' : 'Comment',
+'title.poll.result' : 'Result of poll',
+'title.poll.list' : 'List of poll',
+'title.user.register' : 'Register',
+'title.user.edit' : 'Edit Profile',
+'title.user.forgotPassword' : 'Forget Password',
+'title.user.list' : 'List of user',
'newPoll' : 'New Poll',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index d6c1c7c..85aab6a 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -1,9 +1,16 @@
var translateFR = {
-'title.forgotPassword' : 'Récupération du Mot de Passe',
-'title.register' : 'Inscription',
-'title.editUser' : 'Modification de votre profile',
-'title.comment' : 'Laisser un Commentaire',
+'title.home' : 'Accueil',
+'title.poll.create' : 'Création d\'un nouveau sondage',
+'title.poll.edit' : 'Edition du sondage',
+'title.poll.vote' : 'Voter',
+'title.poll.comment' : 'Laisser un Commentaire',
+'title.poll.result' : 'Résultat du sondage',
+'title.poll.list' : 'Liste des sondages',
+'title.user.register' : 'Inscription',
+'title.user.edit' : 'Modification de votre profile',
+'title.user.forgotPassword' : 'Récupération du Mot de Passe',
+'title.user.list' : 'Liste des utilisateurs',
'newPoll' : 'Nouveau Sondage',
@@ -49,14 +56,14 @@ var translateFR = {
'poll.link.result' : 'Lien du résultat du sondage',
'poll.link.clone' : 'Cloner le sondage',
'poll.link.export' : 'Exporter le sondage',
-'poll.link.close' : 'Fermer les votes du sondage',
+'poll.link.close' : 'Clore les votes du sondage',
'poll.link.delete' : 'Supprimer le sondage',
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
'poll.saved' : 'Sondage sauvegardé',
'poll.cloned' : 'Sondage cloné',
-'poll.closed' : 'Sondage fermé',
+'poll.closed' : 'Sondage clos',
'poll.deleted' : 'Sondage supprimé',
'poll.restricted.name' : 'Nom du votant',
'poll.restricted.mail' : 'Courriel du votant',
diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html
index a995313..34ec952 100644
--- a/pollen-ui-angular/src/main/webapp/index.html
+++ b/pollen-ui-angular/src/main/webapp/index.html
@@ -19,9 +19,9 @@
#L%
-->
-<html ng-app="pollen">
+<html ng-app="pollen" ng-controller="MainCtrl">
<head>
- <title>Pollen</title>
+ <title>{{ title || "Pollen" }}</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="lib/bootstrap/dist/css/bootstrap.min.css" />
@@ -41,7 +41,7 @@
<script language="javascript" type="text/javascript" src="lib/jqplot/jquery.jqplot.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.barRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
- <script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"> </script>
+ <script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.pointLabels.min.js"></script>
<script language="javascript" type="text/javascript" src="lib/jqplot/plugins/jqplot.highlighter.min.js"></script>
@@ -57,6 +57,7 @@
<script language="javascript" type="text/javascript" src="js/app.js"></script>
<script language="javascript" type="text/javascript" src="js/directives.js"></script>
<script language="javascript" type="text/javascript" src="js/services.js"></script>
+ <script language="javascript" type="text/javascript" src="js/controllers/mainCtrl.js"></script>
<script language="javascript" type="text/javascript" src="js/controllers/pollCtrl.js"></script>
<script language="javascript" type="text/javascript" src="js/controllers/userCtrl.js"></script>
<script language="javascript" type="text/javascript" src="js/controllers/favoriteListCtrl.js"></script>
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index 8c3d08f..28ff905 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'alertControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
+var pollen = angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollControllers', 'userControllers', 'favoriteListControllers', 'localeControllers', 'alertControllers', 'ui.bootstrap', 'pascalprecht.translate', 'ngAnimate'])
.config(['$httpProvider', function($httpProvider) {
// edit header for locale and sessionToken
$httpProvider.interceptors.push('httpInterceptor');
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
index b531a7a..932e82c 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js
@@ -19,10 +19,12 @@
* #L%
*/
angular.module('favoriteListControllers', [])
-.controller('FavoriteListCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams',
- function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams) {
+.controller('FavoriteListCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', 'Page',
+ function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, Page) {
$scope.data = {};
+ Page.setTitle('user.favoriteList');
+
var paginationParameter = {pageSize: conf.favoriteListDefaultPageSize};
if (angular.isUndefined(paginationParameter.pageSize)) {
paginationParameter.pageSize = -1;
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
new file mode 100644
index 0000000..d0ccb2a
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js
@@ -0,0 +1,8 @@
+pollen.controller('MainCtrl', ['$scope', 'Page',
+ function ($scope, Page) {
+
+ $scope.$on('titleChange', function () {
+ $scope.title = Page.title();
+ })
+}])
+
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index e050af6..a7ec70c 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -19,13 +19,14 @@
* #L%
*/
angular.module('pollControllers', [])
-.controller('HomeCtrl', ['$scope', 'Poll', function ($scope, Poll) {
+.controller('HomeCtrl', ['$scope', 'Poll', 'Page', function ($scope, Poll, Page) {
+ Page.setTitle('title.home');
Poll.skeletonNew();
}])
.controller('PollCtrl',
- ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll',
- function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll) {
+ ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll', 'Page',
+ function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, Page) {
$scope.setTab = function (defaultValue) {
if (angular.isDefined($routeParams.tab)) {
return $routeParams.tab;
@@ -215,6 +216,10 @@ angular.module('pollControllers', [])
});
}
})
+
+ $scope.$watch('data.poll.title', function (newVal) {
+ Page.setValue($scope.data.poll.title);
+ });
});
$scope.voteCountingIsBoolean = function () {
@@ -452,10 +457,12 @@ angular.module('pollControllers', [])
});
}])
-.controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList',
- function ( $scope, $rootScope, $controller, $location, Poll, SessionStorage, PollVoterList) {
+.controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList', 'Page',
+ function ( $scope, $rootScope, $controller, $location, Poll, SessionStorage, PollVoterList, Page) {
$controller('PollAdminCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.create');
+
$scope.globalVariables.create = true;
var initPoll = function () {
@@ -520,10 +527,12 @@ angular.module('pollControllers', [])
}])
-.controller('PollEditCtrl', ['$scope', '$rootScope', '$controller', '$routeParams', '$location', '$timeout', '$translate', 'Poll', 'PollChoice', 'PollVote', 'PollVoterList', 'PollVoterListMember', 'FavoriteList', 'SessionStorage',
- function ( $scope, $rootScope, $controller, $routeParams, $location, $timeout, $translate, Poll, PollChoice, PollVote, PollVoterList, PollVoterListMember, FavoriteList, SessionStorage) {
+.controller('PollEditCtrl', ['$scope', '$rootScope', '$controller', '$routeParams', '$location', '$timeout', '$translate', 'Poll', 'PollChoice', 'PollVote', 'PollVoterList', 'PollVoterListMember', 'FavoriteList', 'SessionStorage', 'Page',
+ function ( $scope, $rootScope, $controller, $routeParams, $location, $timeout, $translate, Poll, PollChoice, PollVote, PollVoterList, PollVoterListMember, FavoriteList, SessionStorage, Page) {
$controller('PollAdminCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.edit');
+
$scope.globalVariables.edit = true;
////////////////////////////////
@@ -866,10 +875,12 @@ angular.module('pollControllers', [])
}])
-.controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$location',
- function ($scope, $rootScope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $location) {
+.controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$location', 'Page',
+ function ($scope, $rootScope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $location, Page) {
$controller('PollCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.vote');
+
$scope.tab = $scope.setTab('vote');
var initPoll = function () {
@@ -1000,10 +1011,12 @@ angular.module('pollControllers', [])
}])
.controller('PollCommentCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$location',
- function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $location) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$location', 'Page',
+ function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $location, Page) {
$controller('PollCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.comment');
+
if (angular.isDefined($routeParams.commentToken)) {
$scope.commentToken = $routeParams.commentToken;
}
@@ -1151,10 +1164,12 @@ angular.module('pollControllers', [])
}])
-.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter',
- function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter) {
+.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', 'Page',
+ function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, Page) {
$controller('PollCtrl', {$scope:$scope});
+ Page.setTitle('title.poll.result');
+
$scope.translateTitle = {
'0' : "{{ 'poll.result.title.zero' | translate }}",
'one' : "{{ 'poll.result.title.one' | translate }}",
@@ -1222,10 +1237,12 @@ angular.module('pollControllers', [])
}])
.controller('PollListCtrl',
- ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll',
- function ($scope, $rootScope, $controller, $routeParams, $location, Poll) {
+ ['$scope', '$rootScope', '$controller', '$routeParams', '$location', 'Poll', 'Page',
+ function ($scope, $rootScope, $controller, $routeParams, $location, Poll, Page) {
$scope.data = {};
+ Page.setTitle('title.poll.list');
+
if (angular.isDefined(conf.pollDefaultPageSize)) {
$scope.pageSize = conf.pollDefaultPageSize;
}
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
index 4935fad..a64dad8 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -19,8 +19,9 @@
* #L%
*/
angular.module('userControllers', [])
- .controller('UserRegisterCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage',
- function ($scope, $rootScope, $location, User, SessionStorage) {
+.controller('UserRegisterCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage', 'Page',
+ function ($scope, $rootScope, $location, User, SessionStorage, Page) {
+ Page.setTitle('title.user.register');
if (angular.isDefined(SessionStorage.get().user)) {
$rootScope.$broadcast('newError', 'user.error.logout.mandatory');
@@ -44,8 +45,10 @@
}
}])
-.controller('UserLostPasswordCtrl', ['$scope', '$rootScope', '$translate', '$location', 'SessionStorage', 'UserLostPassword',
- function ($scope, $rootScope, $translate, $location, SessionStorage, UserLostPassword) {
+.controller('UserLostPasswordCtrl', ['$scope', '$rootScope', '$translate', '$location', 'SessionStorage', 'UserLostPassword', 'Page',
+ function ($scope, $rootScope, $translate, $location, SessionStorage, UserLostPassword, Page) {
+ Page.setTitle('title.user.forgotPassword');
+
if (angular.isDefined(SessionStorage.get().user)) {
$rootScope.$broadcast('newError', 'user.error.logout.mandatory');
$location.url('/');
@@ -73,7 +76,10 @@
-.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', 'User', 'SessionStorage', function ($scope, $rootScope, $routeParams, $route, $location, User, SessionStorage) {
+.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', 'User', 'SessionStorage', 'Page',
+ function ($scope, $rootScope, $routeParams, $route, $location, User, SessionStorage, Page) {
+ Page.setTitle('title.user.edit');
+
if (angular.isUndefined($scope.data)) {
$scope.data = {user:{}};
}
@@ -108,8 +114,11 @@
}
}])
-.controller('UserListCtrl', ['$scope', '$routeParams', 'User',
- function ($scope, $routeParams, User) {
+.controller('UserListCtrl', ['$scope', '$routeParams', 'User', 'Page',
+ function ($scope, $routeParams, User, Page) {
+
+ Page.setTitle('title.user.list');
+
if (angular.isUndefined($scope.data)) {
$scope.data = {user:{}};
}
@@ -132,7 +141,6 @@
}
User.get({paginationParameter:paginationParameter}, function (data) {
- console.log(data);
$scope.data.users = data.elements;
$scope.data.usersPagination = data.pagination
});
diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js
index ad58548..f3ef921 100644
--- a/pollen-ui-angular/src/main/webapp/js/directives.js
+++ b/pollen-ui-angular/src/main/webapp/js/directives.js
@@ -21,6 +21,39 @@
angular.module('pollenDirective', [])
//////////////////////////////////////
+///// PAGE /////
+//////////////////////////////////////
+
+.factory('Page', ['$rootScope', '$filter', function ($rootScope, $filter) {
+ var title = '';
+ var value;
+ return {
+ title : function () {
+ var makeTitle = "Pollen";
+ if (title != '') {
+ makeTitle += " - " + $filter('translate')(title);
+
+ }
+
+ if (value !== undefined) {
+ makeTitle += " - " + value;
+ }
+
+ return makeTitle;
+ },
+ setTitle: function(newTitle, newValue) {
+ title = newTitle;
+ value = newValue;
+ $rootScope.$broadcast('titleChange');
+ },
+ setValue: function(newValue) {
+ value = newValue;
+ $rootScope.$broadcast('titleChange');
+ }
+ };
+}])
+
+//////////////////////////////////////
///// FOCUS ME /////
//////////////////////////////////////
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
index a584ca5..841eb54 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html
@@ -20,7 +20,7 @@
-->
<div>
<h1>{{ data.poll.title }}</h1>
- <h2>{{ 'title.comment' | translate }}</h2>
+ <h2>{{ 'title.poll.comment' | translate }}</h2>
<!-- begin for add comment -->
<form class="form-horizontal" ng-submit="postComment()" novalidate>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-edit.html b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
index 765d96e..1d75891 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-edit.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<h2> {{ 'title.editUser' | translate }} </h2>
+<h2> {{ 'title.user.edit' | translate }} </h2>
<form class="horizontal-form" ng-submit="editUser()">
<div class="control-group">
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html b/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
index dd28daa..d1bb5f5 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-lostPassword.html
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<h2>{{ 'title.forgotPassword' | translate }}</h2>
+<h2>{{ 'title.user.forgotPassword' | translate }}</h2>
<form ng-submit="submit()" class="form-horizontal">
<div class="control-group">
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-register.html b/pollen-ui-angular/src/main/webapp/partials/user-register.html
index ea75471..b9e5c36 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-register.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-register.html
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<h2>{{ 'title.register' | translate }}</h2>
+<h2>{{ 'title.user.register' | translate }}</h2>
<form ng-submit="submit()" class="form-horizontal">
<div class="control-group">
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 4, 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 47449ac9d41fa45daf13a09c36a57433081ce176
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 4 10:43:07 2014 +0200
change findByTopiaId() by forTopiaIdEquals().findUnique()
---
.../java/org/chorem/pollen/services/service/ChoiceService.java | 2 +-
.../java/org/chorem/pollen/services/service/CommentService.java | 4 ++--
.../org/chorem/pollen/services/service/FavoriteListService.java | 4 ++--
.../main/java/org/chorem/pollen/services/service/PollService.java | 2 +-
.../java/org/chorem/pollen/services/service/PollenUserService.java | 2 +-
.../main/java/org/chorem/pollen/services/service/VoteService.java | 6 +++---
.../java/org/chorem/pollen/services/service/VoterListService.java | 4 ++--
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 ++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 4 ++--
9 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index 1d97812..72852b0 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -184,7 +184,7 @@ public class ChoiceService extends PollenServiceSupport {
protected Choice getChoice(Poll poll, String choiceId) {
- Choice result = getChoiceDao().findByTopiaId(choiceId);
+ Choice result = getChoiceDao().forTopiaIdEquals(choiceId).findUnique();
if (!poll.equals(result.getPoll())) {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
index 5ecf45b..c9437d2 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
@@ -146,7 +146,7 @@ public class CommentService extends PollenServiceSupport {
protected Comment getComment(Poll poll, String commentId) {
- Comment result = getCommentDao().findByTopiaId(commentId);
+ Comment result = getCommentDao().forTopiaIdEquals(commentId).findUnique();
if (!poll.equals(result.getPoll())) {
@@ -177,7 +177,7 @@ public class CommentService extends PollenServiceSupport {
if (commentExists) {
- toSave = getCommentDao().findByTopiaId(comment.getEntityId());
+ toSave = getCommentDao().forTopiaIdEquals(comment.getEntityId()).findUnique();
} else {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
index 0e3e8a6..503e32e 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
@@ -290,7 +290,7 @@ public class FavoriteListService extends PollenServiceSupport {
protected FavoriteList getFavoriteList0(PollenUser user, String favoriteListId) {
- FavoriteList result = getFavoriteListDao().findByTopiaId(favoriteListId);
+ FavoriteList result = getFavoriteListDao().forTopiaIdEquals(favoriteListId).findUnique();
if (!user.equals(result.getPollenUser())) {
@@ -311,7 +311,7 @@ public class FavoriteListService extends PollenServiceSupport {
protected FavoriteListMember getFavoriteListMember0(FavoriteList favoriteList, String memberId) {
- FavoriteListMember result = getFavoriteListMemberDao().findByTopiaId(memberId);
+ FavoriteListMember result = getFavoriteListMemberDao().forTopiaIdEquals(memberId).findUnique();
if (!favoriteList.equals(result.getFavoriteList())) {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
index e35d911..6261e08 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
@@ -374,7 +374,7 @@ public class PollService extends PollenServiceSupport {
protected Poll getPoll0(String pollId) {
- return getPollDao().findByTopiaId(pollId);
+ return getPollDao().forTopiaIdEquals(pollId).findUnique();
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
index 4191c45..484d3c9 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
@@ -309,7 +309,7 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer
protected PollenUser getUser0(String userId) {
- PollenUser pollenUser = getPollenUserDao().findByTopiaId(userId);
+ PollenUser pollenUser = getPollenUserDao().forTopiaIdEquals(userId).findUnique();
return pollenUser;
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
index dad35e2..2acc2ad 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
@@ -271,7 +271,7 @@ public class VoteService extends PollenServiceSupport {
protected Vote getVote(Poll poll, String voteId) {
- Vote result = getVoteDao().findByTopiaId(voteId);
+ Vote result = getVoteDao().forTopiaIdEquals(voteId).findUnique();
if (!poll.equals(result.getPoll())) {
@@ -292,7 +292,7 @@ public class VoteService extends PollenServiceSupport {
protected VoteToChoice getVoteToChoice(Vote vote, String voteToChoiceId) {
- VoteToChoice result = getVoteToChoiceDao().findByTopiaId(voteToChoiceId);
+ VoteToChoice result = getVoteToChoiceDao().forTopiaIdEquals(voteToChoiceId).findUnique();
if (!vote.containsVoteToChoice(result)) {
@@ -321,7 +321,7 @@ public class VoteService extends PollenServiceSupport {
String choiceId = source.getChoiceId().getEntityId();
- Choice choiceLoaded = getChoiceDao().findByTopiaId(choiceId);
+ Choice choiceLoaded = getChoiceDao().forTopiaIdEquals(choiceId).findUnique();
result.setChoice(choiceLoaded);
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
index 4fc2f9c..327b8af 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
@@ -333,7 +333,7 @@ public class VoterListService extends PollenServiceSupport {
protected VoterList getVoterList0(Poll poll, String voterListId) {
- VoterList result = getVoterListDao().findByTopiaId(voterListId);
+ VoterList result = getVoterListDao().forTopiaIdEquals(voterListId).findUnique();
if (!poll.equals(result.getPoll())) {
@@ -366,7 +366,7 @@ public class VoterListService extends PollenServiceSupport {
protected VoterListMember getVoterListMember0(VoterList voterList, String memberId) {
- VoterListMember result = getVoterListMemberDao().findByTopiaId(memberId);
+ VoterListMember result = getVoterListMemberDao().forTopiaIdEquals(memberId).findUnique();
if (!voterList.equals(result.getVoterList())) {
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index dd4bbef..e050af6 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -115,7 +115,12 @@ angular.module('pollControllers', [])
})
pollDeferred.promise.then(function () {
- var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
+ var baseUrl = window.location.protocol+'//'+window.location.hostname;
+ if (window.location.port != "") {
+ baseUrl += ':'+window.location.port;
+ }
+ baseUrl += window.location.pathname;
+
$scope.globalVariables.baseUrl = baseUrl;
$scope.globalVariables.linkHome = baseUrl;
$scope.globalVariables.linkVote = baseUrl;
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 13d64d0..8f39e9b 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -311,7 +311,7 @@
color: @danger-color;
transition-duration:@short-time-transition;
- &:hover {
+ &:hover, &:focus {
color: @danger-hover-color;
transition-duration:@short-time-transition;
}
@@ -320,7 +320,7 @@
a {
transition-duration:@short-time-transition;
- &:hover {
+ &:hover, &:focus {
transition-duration:@short-time-transition;
}
}
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 4, 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 bbb77e43f2c41c08d584adf64813f74dc5d4f0ee
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Fri Jul 4 10:43:07 2014 +0200
change findByTopiaId() by forTopiaIdEquals().findAny()
---
.../java/org/chorem/pollen/services/service/ChoiceService.java | 2 +-
.../java/org/chorem/pollen/services/service/CommentService.java | 4 ++--
.../org/chorem/pollen/services/service/FavoriteListService.java | 4 ++--
.../main/java/org/chorem/pollen/services/service/PollService.java | 2 +-
.../java/org/chorem/pollen/services/service/PollenUserService.java | 2 +-
.../main/java/org/chorem/pollen/services/service/VoteService.java | 6 +++---
.../java/org/chorem/pollen/services/service/VoterListService.java | 4 ++--
pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js | 7 ++++++-
pollen-ui-angular/src/main/webapp/less/style.less | 4 ++--
9 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
index 1d97812..4609938 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
@@ -184,7 +184,7 @@ public class ChoiceService extends PollenServiceSupport {
protected Choice getChoice(Poll poll, String choiceId) {
- Choice result = getChoiceDao().findByTopiaId(choiceId);
+ Choice result = getChoiceDao().forTopiaIdEquals(choiceId).findAny();
if (!poll.equals(result.getPoll())) {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
index 5ecf45b..2da83ee 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
@@ -146,7 +146,7 @@ public class CommentService extends PollenServiceSupport {
protected Comment getComment(Poll poll, String commentId) {
- Comment result = getCommentDao().findByTopiaId(commentId);
+ Comment result = getCommentDao().forTopiaIdEquals(commentId).findAny();
if (!poll.equals(result.getPoll())) {
@@ -177,7 +177,7 @@ public class CommentService extends PollenServiceSupport {
if (commentExists) {
- toSave = getCommentDao().findByTopiaId(comment.getEntityId());
+ toSave = getCommentDao().forTopiaIdEquals(comment.getEntityId()).findAny();
} else {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
index 0e3e8a6..68f5f2f 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListService.java
@@ -290,7 +290,7 @@ public class FavoriteListService extends PollenServiceSupport {
protected FavoriteList getFavoriteList0(PollenUser user, String favoriteListId) {
- FavoriteList result = getFavoriteListDao().findByTopiaId(favoriteListId);
+ FavoriteList result = getFavoriteListDao().forTopiaIdEquals(favoriteListId).findAny();
if (!user.equals(result.getPollenUser())) {
@@ -311,7 +311,7 @@ public class FavoriteListService extends PollenServiceSupport {
protected FavoriteListMember getFavoriteListMember0(FavoriteList favoriteList, String memberId) {
- FavoriteListMember result = getFavoriteListMemberDao().findByTopiaId(memberId);
+ FavoriteListMember result = getFavoriteListMemberDao().forTopiaIdEquals(memberId).findAny();
if (!favoriteList.equals(result.getFavoriteList())) {
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
index e35d911..b3ac539 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
@@ -374,7 +374,7 @@ public class PollService extends PollenServiceSupport {
protected Poll getPoll0(String pollId) {
- return getPollDao().findByTopiaId(pollId);
+ return getPollDao().forTopiaIdEquals(pollId).findAny();
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
index 4191c45..a447453 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java
@@ -309,7 +309,7 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer
protected PollenUser getUser0(String userId) {
- PollenUser pollenUser = getPollenUserDao().findByTopiaId(userId);
+ PollenUser pollenUser = getPollenUserDao().forTopiaIdEquals(userId).findAny();
return pollenUser;
}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
index dad35e2..04711f9 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java
@@ -271,7 +271,7 @@ public class VoteService extends PollenServiceSupport {
protected Vote getVote(Poll poll, String voteId) {
- Vote result = getVoteDao().findByTopiaId(voteId);
+ Vote result = getVoteDao().forTopiaIdEquals(voteId).findAny();
if (!poll.equals(result.getPoll())) {
@@ -292,7 +292,7 @@ public class VoteService extends PollenServiceSupport {
protected VoteToChoice getVoteToChoice(Vote vote, String voteToChoiceId) {
- VoteToChoice result = getVoteToChoiceDao().findByTopiaId(voteToChoiceId);
+ VoteToChoice result = getVoteToChoiceDao().forTopiaIdEquals(voteToChoiceId).findAny();
if (!vote.containsVoteToChoice(result)) {
@@ -321,7 +321,7 @@ public class VoteService extends PollenServiceSupport {
String choiceId = source.getChoiceId().getEntityId();
- Choice choiceLoaded = getChoiceDao().findByTopiaId(choiceId);
+ Choice choiceLoaded = getChoiceDao().forTopiaIdEquals(choiceId).findAny();
result.setChoice(choiceLoaded);
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
index 4fc2f9c..9a43ee7 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java
@@ -333,7 +333,7 @@ public class VoterListService extends PollenServiceSupport {
protected VoterList getVoterList0(Poll poll, String voterListId) {
- VoterList result = getVoterListDao().findByTopiaId(voterListId);
+ VoterList result = getVoterListDao().forTopiaIdEquals(voterListId).findAny();
if (!poll.equals(result.getPoll())) {
@@ -366,7 +366,7 @@ public class VoterListService extends PollenServiceSupport {
protected VoterListMember getVoterListMember0(VoterList voterList, String memberId) {
- VoterListMember result = getVoterListMemberDao().findByTopiaId(memberId);
+ VoterListMember result = getVoterListMemberDao().forTopiaIdEquals(memberId).findAny();
if (!voterList.equals(result.getVoterList())) {
diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
index dd4bbef..e050af6 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -115,7 +115,12 @@ angular.module('pollControllers', [])
})
pollDeferred.promise.then(function () {
- var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
+ var baseUrl = window.location.protocol+'//'+window.location.hostname;
+ if (window.location.port != "") {
+ baseUrl += ':'+window.location.port;
+ }
+ baseUrl += window.location.pathname;
+
$scope.globalVariables.baseUrl = baseUrl;
$scope.globalVariables.linkHome = baseUrl;
$scope.globalVariables.linkVote = baseUrl;
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 13d64d0..8f39e9b 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -311,7 +311,7 @@
color: @danger-color;
transition-duration:@short-time-transition;
- &:hover {
+ &:hover, &:focus {
color: @danger-hover-color;
transition-duration:@short-time-transition;
}
@@ -320,7 +320,7 @@
a {
transition-duration:@short-time-transition;
- &:hover {
+ &:hover, &:focus {
transition-duration:@short-time-transition;
}
}
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
July 3, 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 04caf751191aa4d5e6aa1b66519dcf41404a10d1
Merge: 980786d a02e287
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 3 16:49:02 2014 +0200
Merge branch 'feature/voteCountingApi' into develop
.../pollen/rest/api/v1/VoteCountingTypeApi.java | 23 ++++
pollen-rest-api/src/main/resources/mapping | 5 +
.../pollen/services/bean/VoteCountingTypeBean.java | 75 ++++++++++++
.../services/service/VoteCountingTypeService.java | 67 +++++++++++
.../src/main/webapp/js/controllers/localeCtrl.js | 3 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 126 +++++++++++++--------
pollen-ui-angular/src/main/webapp/js/services.js | 9 ++
.../src/main/webapp/partials/inline-poll.html | 4 +-
.../src/main/webapp/partials/poll-settings.html | 12 +-
9 files changed, 265 insertions(+), 59 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 a02e287b235048245fd512b5006b7b18a0284644
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 3 16:45:23 2014 +0200
UI get voteCountingType from server
---
.../pollen/services/bean/VoteCountingTypeBean.java | 23 ++--
.../src/main/webapp/js/controllers/localeCtrl.js | 3 +-
.../src/main/webapp/js/controllers/pollCtrl.js | 126 +++++++++++++--------
pollen-ui-angular/src/main/webapp/js/services.js | 9 ++
.../src/main/webapp/partials/inline-poll.html | 4 +-
.../src/main/webapp/partials/poll-settings.html | 12 +-
6 files changed, 110 insertions(+), 67 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java
index 8e86c07..4ccb153 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java
@@ -1,12 +1,7 @@
package org.chorem.pollen.services.bean;
-import org.chorem.pollen.services.service.VoteCountingService;
-import org.chorem.pollen.votecounting.VoteCounting;
-import org.chorem.pollen.votecounting.VoteCountingFactory;
import org.chorem.pollen.votecounting.model.ChoiceToVoteRenderType;
-import java.util.Locale;
-
/**
* Created on 03/07/14.
*
@@ -23,7 +18,7 @@ public class VoteCountingTypeBean {
protected String shortHelper;
- protected ChoiceToVoteRenderType renderType;
+ protected String renderType;
public int getId() {
@@ -58,11 +53,23 @@ public class VoteCountingTypeBean {
this.shortHelper = shortHelper;
}
- public ChoiceToVoteRenderType getRenderType() {
+ public String getRenderType() {
return renderType;
}
- public void setRenderType(ChoiceToVoteRenderType renderType) {
+ public void setRenderType(String renderType) {
this.renderType = renderType;
}
+
+ public void setRenderType(ChoiceToVoteRenderType renderType) {
+ switch (renderType) {
+ case CHECKBOX:
+ this.renderType = "checkbox";
+ break;
+
+ case TEXTFIELD:
+ this.renderType = "text";
+ break;
+ }
+ }
}
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 d370ab8..9805d8b 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js
@@ -19,7 +19,7 @@
* #L%
*/
angular.module('localeControllers', [])
-.controller('LocaleCtrl', ['$scope', '$translate', 'SessionStorage',function ($scope, $translate, SessionStorage) {
+.controller('LocaleCtrl', ['$scope', '$rootScope', '$translate', 'SessionStorage',function ($scope, $rootScope, $translate, SessionStorage) {
$scope.debug = conf.debug;
$scope.locale = SessionStorage.get().locale;
if (angular.isUndefined($scope.locale)) {
@@ -42,6 +42,7 @@ angular.module('localeControllers', [])
SessionStorage.save({locale:locale});
$scope.locale = locale;
$translate.use(locale);
+ $rootScope.$broadcast('switchLocale');
}
}
}])
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 68baa88..dd4bbef 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -67,16 +67,32 @@ angular.module('pollControllers', [])
SessionStorage.save({'menuMinify': $scope.globalVariables.minify});
}
- $translate('dateFormat').then(function (dateFormat) {
- $scope.globalVariables.dateFormat = dateFormat;
- });
+ var setDateFormat = function () {
+ $translate('dateFormat').then(function (dateFormat) {
+ $scope.globalVariables.dateFormat = dateFormat;
+ });
+ }; setDateFormat();
+
+ $scope.$on('switchLocale', function() {
+ setDateFormat();
+ })
$scope.data = {};
$scope.data.poll = {};
+ $scope.pollDeferred = $q.defer();
+
+ var setVoteCountingType = function () {
+ $scope.pollDeferred.promise.then(function () {
+ Poll.voteCountingType({id:$scope.data.poll.voteCountingType}, function (data) {
+ $scope.data.voteCountingType = data;
+ $scope.pollDeferred.resolve();
+ })
+ });
+ }
+
if (angular.isDefined($routeParams.pollId)) {
- var pollDeferred = $q.defer();
- $scope.pollDeferred = pollDeferred;
+ var pollDeferred = $scope.pollDeferred;
Poll.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, function (poll) {
$scope.data.poll = poll;
$scope.globalVariables.pollToken = poll.permission;
@@ -95,6 +111,10 @@ angular.module('pollControllers', [])
});
pollDeferred.promise.then(function () {
+ setVoteCountingType();
+ })
+
+ pollDeferred.promise.then(function () {
var baseUrl = window.location.protocol+'//'+window.location.hostname+window.location.pathname;
$scope.globalVariables.baseUrl = baseUrl;
$scope.globalVariables.linkHome = baseUrl;
@@ -156,13 +176,6 @@ angular.module('pollControllers', [])
}
});
- $scope.getInputType = function () {
- if ($scope.voteCountingIsBoolean()) {
- return 'checkbox';
- } else {
- return 'text';
- }
- }
$scope.getChoiceValue = function (choiceValue) {
if ($scope.voteCountingIsBoolean()) {
@@ -176,27 +189,32 @@ angular.module('pollControllers', [])
return 0.0;
}
else {
- choiceValue;
+ return choiceValue;
}
}
}
$timeout(function () {
- $scope.$watch('data.poll.voteCountingType', function (newVal, oldVal) {
- if (angular.isDefined(oldVal) && (newVal == 1 || oldVal == 1) && newVal != oldVal) {
- angular.forEach($scope.data.votants, function(votant, key) {
- angular.forEach(votant.choice, function (choice) {
- choice.inputType = $scope.getInputType();
- choice.voteValue = $scope.getChoiceValue(choice.voteValue);
- })
- });
- }
- })
+ $scope.$watch('data.poll.voteCountingType', function (newVal, oldVal) {
+ if (newVal != oldVal && oldVal !== undefined) {
+ setVoteCountingType();
+ }
+ });
+
+ $scope.$watch('data.voteCountingType.renderType', function (newVal, oldVal) {
+ if (newVal !== undefined) {
+ angular.forEach($scope.data.votants, function(votant, key) {
+ angular.forEach(votant.choice, function (choice) {
+ choice.voteValue = $scope.getChoiceValue(choice.voteValue);
+ });
+ });
+ }
+ })
});
$scope.voteCountingIsBoolean = function () {
- if (angular.isDefined($scope.data.poll) && angular.isDefined($scope.data.poll.voteCountingType)) {
- return $scope.data.poll.voteCountingType == 1;
+ if (angular.isDefined($scope.data.voteCountingType)) {
+ return $scope.data.voteCountingType.renderType == 'checkbox';
}
return false;
}
@@ -247,7 +265,7 @@ angular.module('pollControllers', [])
}])
-.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$timeout', '$routeParams', function ($scope, $controller, $modal, $timeout, $routeParams) {
+.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$timeout', '$routeParams', 'Poll', function ($scope, $controller, $modal, $timeout, $routeParams, Poll) {
$controller('PollCtrl', {$scope:$scope});
$scope.tab = $scope.setTab('edit');
@@ -315,8 +333,7 @@ angular.module('pollControllers', [])
return {
name: '',
date: $scope.globalVariables.lastDate,
- choiceType: $scope.globalVariables.lastType,
- inputType: $scope.getInputType()
+ choiceType: $scope.globalVariables.lastType
};
}
@@ -399,6 +416,35 @@ angular.module('pollControllers', [])
return 'Non';
}
}
+
+ ////////////////////////////////
+ //// VOTE COUNTING TYPE /////
+ ////////////////////////////////
+
+ var initVoteCountingType = function () {
+ Poll.allVoteCountingType(function (data) {
+ $scope.data.allVoteCountingType = data;
+ setHelper();
+ })
+ }; initVoteCountingType();
+
+ var setHelper = function () {
+ angular.forEach($scope.data.allVoteCountingType, function (value) {
+ if (value.id == $scope.data.poll.voteCountingType) {
+ $scope.voteCountingTypeHelper = value.helper;
+ }
+ });
+ };
+
+ $scope.$on('switchLocale', function() {
+ initVoteCountingType();
+ });
+
+ $timeout(function () {
+ $scope.$watch('data.poll.voteCountingType', function (newVal) {
+ setHelper();
+ })
+ });
}])
.controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList',
@@ -770,15 +816,7 @@ angular.module('pollControllers', [])
$scope.data.votants = votes;
angular.forEach($scope.data.votants, function (vote) {
angular.forEach(vote.choice, function (choice) {
- if ($scope.voteCountingIsBoolean()) {
- if (choice.voteValue != null && choice.voteValue != 0.0) {
- choice.voteValue = true;
- }
- else {
- choice.voteValue = false;
- }
- }
- choice.inputType = $scope.getInputType();
+ choice.voteValue = $scope.getChoiceValue(choice.voteValue);
})
})
});
@@ -843,15 +881,7 @@ angular.module('pollControllers', [])
$scope.data.votants = votes;
angular.forEach($scope.data.votants, function (vote) {
angular.forEach(vote.choice, function (choice) {
- if ($scope.voteCountingIsBoolean()) {
- if (choice.voteValue != null && choice.voteValue != 0.0) {
- choice.voteValue = true;
- }
- else {
- choice.voteValue = false;
- }
- }
- choice.inputType = $scope.getInputType();
+ choice.voteValue = $scope.getChoiceValue(choice.voteValue);
})
})
});
@@ -891,7 +921,7 @@ angular.module('pollControllers', [])
for (var i = 0; i < $scope.data.choices.length; ++i) {
- $scope.data.vote.choice.push({'choiceId':$scope.data.choices[i].id, 'voteValue': defaultValue, 'inputType': $scope.getInputType()});
+ $scope.data.vote.choice.push({'choiceId':$scope.data.choices[i].id, 'voteValue': defaultValue});
}
}
@@ -956,7 +986,7 @@ angular.module('pollControllers', [])
}
$scope.toggleValue = function (choice, event) {
- if (choice.inputType == 'checkbox') {
+ if ($scope.data.voteCountingType.renderType == 'checkbox') {
choice.voteValue = !choice.voteValue;
event.stopPropagation();
}
diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js
index 1333cae..c9495f8 100644
--- a/pollen-ui-angular/src/main/webapp/js/services.js
+++ b/pollen-ui-angular/src/main/webapp/js/services.js
@@ -56,6 +56,15 @@ angular.module('pollenServices', ['ngResource'])
'clone' : {
method : 'POST',
url : conf.restURL+'/polls/:pollId/clone'
+ },
+ 'allVoteCountingType': {
+ method : 'GET',
+ isArray: true,
+ url : conf.restURL+'/voteCountingTypes/:id'
+ },
+ 'voteCountingType': {
+ method : 'GET',
+ url : conf.restURL+'/voteCountingTypes/:id'
}
});
}])
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 d5f4474..6061367 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -60,7 +60,7 @@
</input-error>
</td>
<td ng-repeat="choice in data.vote.choice" class="pollChoice" ng-class="{voteTrue:choice.voteValue, voteFalse:!choice.voteValue}" ng-click="toggleValue(choice, $event);">
- <input type="{{choice.inputType}}" name="{{choice.choiceId}}" ng-model="choice.voteValue" ng-click="toggleValue(choice, $event);" />
+ <input type="{{data.voteCountingType.renderType}}" name="{{choice.choiceId}}" ng-model="choice.voteValue" ng-click="toggleValue(choice, $event);" />
</td>
<td>
<input class="btn btn-primary btn-large" type="button" value="{{ 'action.vote' | translate }}" ng-click="voter()" />
@@ -72,7 +72,7 @@
<tr ng-repeat="vote in data.votants track by $index" class="pollAnim">
<td class="pollChoice"> {{vote.voterName}}</td>
<td ng-repeat="choice in vote.choice" class="pollChoice" ng-class="{voteTrue:choice.voteValue, voteFalse:!choice.voteValue}">
- <input type="{{choice.inputType}}" ng-model="choice.voteValue" disabled />
+ <input type="{{data.voteCountingType.renderType}}" ng-model="choice.voteValue" disabled />
</td>
<td>
<button class="btn btn-info" ng-if="vote.permission && !globalVariables.editMode" ng-click="editVote(vote)"><span class="glyphicon glyphicon-pencil"></span></button>
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 06d4df7..99df8ab 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-settings.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-settings.html
@@ -130,15 +130,11 @@
<label class="col-sm-4 control-label">Type : </label>
<div class="col-sm-8">
<div class="btn-group">
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="1" auto-save="autoSavePoll()">Normal</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="2" auto-save="autoSavePoll()">Pourcentage</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="3" auto-save="autoSavePoll()">Condorcet</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="4" auto-save="autoSavePoll()">Nombre</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="5" auto-save="autoSavePoll()">Borda</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="6" auto-save="autoSavePoll()">Vote alternatif</button>
- <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="7" auto-save="autoSavePoll()">Coombs</button>
+
+ <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>
- <p>Description du types de vote</p>
+ <p ng-bind-html="toHTML(voteCountingTypeHelper)"></p>
</div>
</div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit 03df50919f584a82a9303832cbd38bfce2698db1
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Thu Jul 3 14:34:03 2014 +0200
add VoteCountingTypeApi
---
.../pollen/rest/api/v1/VoteCountingTypeApi.java | 23 ++++++++
pollen-rest-api/src/main/resources/mapping | 5 ++
.../pollen/services/bean/VoteCountingTypeBean.java | 68 ++++++++++++++++++++++
.../services/service/VoteCountingTypeService.java | 67 +++++++++++++++++++++
4 files changed, 163 insertions(+)
diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java
new file mode 100644
index 0000000..1fcd5ad
--- /dev/null
+++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java
@@ -0,0 +1,23 @@
+package org.chorem.pollen.rest.api.v1;
+
+import org.chorem.pollen.services.bean.VoteCountingTypeBean;
+import org.chorem.pollen.services.service.VoteCountingTypeService;
+import org.debux.webmotion.server.WebMotionController;
+
+import java.util.List;
+
+/**
+ * Created on 03/07/14.
+ *
+ * @author garandel
+ * @since 2.0
+ */
+public class VoteCountingTypeApi extends WebMotionController {
+ public List<VoteCountingTypeBean> getVoteCountingTypes(VoteCountingTypeService voteCountingTypeService) {
+ return voteCountingTypeService.getVoteCountingTypes();
+ }
+
+ public VoteCountingTypeBean getVoteCountingType(VoteCountingTypeService voteCountingTypeService, int id) {
+ return voteCountingTypeService.getVoteCountingType(id);
+ }
+}
diff --git a/pollen-rest-api/src/main/resources/mapping b/pollen-rest-api/src/main/resources/mapping
index 4340a23..0c6b559 100644
--- a/pollen-rest-api/src/main/resources/mapping
+++ b/pollen-rest-api/src/main/resources/mapping
@@ -129,6 +129,11 @@ PUT /v1/users/{userId}?token={} PollenUserApi.validateUserEmai
GET /v1/polls/{pollId}/results VoteCountingApi.getMainResult
GET /v1/polls/{pollId}/groupResults VoteCountingApi.getGroupResult
+# VoteCountingTypeApi
+
+GET /v1/voteCountingTypes VoteCountingTypeApi.getVoteCountingTypes
+GET /v1/voteCountingTypes/{id} VoteCountingTypeApi.getVoteCountingType
+
# VoterListApi
PUT /v1/polls/{pollId}/favoriteLists/{favoriteListId} VoterListApi.importFavoriteList
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java
new file mode 100644
index 0000000..8e86c07
--- /dev/null
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java
@@ -0,0 +1,68 @@
+package org.chorem.pollen.services.bean;
+
+import org.chorem.pollen.services.service.VoteCountingService;
+import org.chorem.pollen.votecounting.VoteCounting;
+import org.chorem.pollen.votecounting.VoteCountingFactory;
+import org.chorem.pollen.votecounting.model.ChoiceToVoteRenderType;
+
+import java.util.Locale;
+
+/**
+ * Created on 03/07/14.
+ *
+ * @author agarandel
+ * @since 2.0
+ */
+public class VoteCountingTypeBean {
+
+ protected int id;
+
+ protected String name;
+
+ protected String helper;
+
+ protected String shortHelper;
+
+ protected ChoiceToVoteRenderType renderType;
+
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getHelper() {
+ return helper;
+ }
+
+ public void setHelper(String helper) {
+ this.helper = helper;
+ }
+
+ public String getShortHelper() {
+ return shortHelper;
+ }
+
+ public void setShortHelper(String shortHelper) {
+ this.shortHelper = shortHelper;
+ }
+
+ public ChoiceToVoteRenderType getRenderType() {
+ return renderType;
+ }
+
+ public void setRenderType(ChoiceToVoteRenderType renderType) {
+ this.renderType = renderType;
+ }
+}
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java
new file mode 100644
index 0000000..3bbd957
--- /dev/null
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java
@@ -0,0 +1,67 @@
+package org.chorem.pollen.services.service;
+
+import org.chorem.pollen.services.bean.VoteCountingTypeBean;
+import org.chorem.pollen.votecounting.VoteCounting;
+import org.chorem.pollen.votecounting.VoteCountingFactory;
+import org.chorem.pollen.votecounting.VoteCountingNotFound;
+import org.chorem.pollen.votecounting.VoteCountingStrategy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Created on 03/07/14.
+ *
+ * @author agarandel
+ * @since 2.0
+ */
+public class VoteCountingTypeService extends PollenServiceSupport {
+
+ public List<VoteCountingTypeBean> getVoteCountingTypes() {
+ List<VoteCountingTypeBean> voteCountingTypes = new ArrayList<VoteCountingTypeBean>();
+
+ try {
+ int i = 1;
+ while ( i > 0 ) {
+
+ voteCountingTypes.add(idToVoteCountingType(i));
+
+ ++i;
+ }
+ }
+ catch (VoteCountingNotFound e) {
+ if (voteCountingTypes.size() == 0) {
+ throw e;
+ }
+ }
+
+ return voteCountingTypes;
+ }
+
+ public VoteCountingTypeBean getVoteCountingType(int id) {
+ try {
+ return idToVoteCountingType(id);
+ }
+ catch (VoteCountingNotFound e) {
+ return null;
+ }
+ }
+
+ protected VoteCountingTypeBean idToVoteCountingType(int id) throws VoteCountingNotFound {
+ VoteCountingFactory factory = serviceContext.getVoteCountingFactory();
+ Locale l = serviceContext.getLocale();
+
+ VoteCountingTypeBean newVoteCountingType = new VoteCountingTypeBean();
+
+ VoteCounting voteCounting = factory.getVoteCounting(id);
+
+ newVoteCountingType.setId(voteCounting.getId());
+ newVoteCountingType.setName(voteCounting.getName(l));
+ newVoteCountingType.setHelper(voteCounting.getHelp(l));
+ newVoteCountingType.setShortHelper(voteCounting.getShortHelp(l));
+ newVoteCountingType.setRenderType(voteCounting.getVoteValueEditorType());
+
+ return newVoteCountingType;
+ }
+}
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
05/05: Merge branch 'develop' of https://git.chorem.org/pollen into develop
by chorem.org scm July 2, 2014
by chorem.org scm July 2, 2014
July 2, 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 980786db24be7e84d83daefbf735aab1c45e212b
Merge: a4d70d7 4e9d45d
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 18:52:34 2014 +0200
Merge branch 'develop' of https://git.chorem.org/pollen into develop
--
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 a4d70d7750993dc86ac5260727e7dd5e10c0fa34
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 18:51:57 2014 +0200
List User for admin
---
pollen-ui-angular/src/main/webapp/js/app.js | 1 +
.../src/main/webapp/js/controllers/userCtrl.js | 56 ++++++++++++++++++----
.../src/main/webapp/partials/poll-link.html | 1 +
.../src/main/webapp/partials/user-edit.html | 22 ++++-----
.../src/main/webapp/partials/user-list.html | 11 +++++
5 files changed, 71 insertions(+), 20 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js
index a8bf214..8c3d08f 100644
--- a/pollen-ui-angular/src/main/webapp/js/app.js
+++ b/pollen-ui-angular/src/main/webapp/js/app.js
@@ -64,6 +64,7 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'pollC
.when('/poll/result/:pollId/:token?', {templateUrl: './partials/poll.html', controller :"PollResultCtrl"})
.when('/poll/comment/:pollId/:commentToken?', {templateUrl: './partials/poll.html', controller :"PollCommentCtrl"})
.when('/poll/list/:cmd?', {templateUrl: './partials/poll-list.html', controller :"PollListCtrl"})
+ .when('/user/list', {templateUrl: './partials/user-list.html', controller:"UserListCtrl"})
.when('/user/register', {templateUrl: './partials/user-register.html', controller:"UserRegisterCtrl"})
.when('/user/edit', {templateUrl: './partials/user-edit.html', controller:"UserEditCtrl"})
.when('/user/lostpassword', {templateUrl: './partials/user-lostPassword.html', controller:"UserLostPasswordCtrl"})
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 20b38da..4935fad 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js
@@ -73,19 +73,24 @@
-.controller('UserEditCtrl', ['$scope', '$rootScope', '$location', 'User', 'SessionStorage', function ($scope, $rootScope, $location, User, SessionStorage) {
- $scope.currentUser = SessionStorage.get().user;
+.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', 'User', 'SessionStorage', function ($scope, $rootScope, $routeParams, $route, $location, User, SessionStorage) {
+ if (angular.isUndefined($scope.data)) {
+ $scope.data = {user:{}};
+ }
+
+ $scope.data.user = angular.copy(SessionStorage.get().user);
- if (angular.isUndefined($scope.currentUser)) {
+ if (angular.isUndefined($scope.data.user)) {
$rootScope.$broadcast('newError', 'user.error.login.mandatory' );
$location.url('/');
}
- $scope.currentUser.password = '';
+ $scope.data.user.password = '';
$scope.editUser = function () {
- User.update($scope.currentUser, function (data) {
+ User.update($scope.data.user, function (data) {
SessionStorage.save({user:data});
+ $rootScope.$broadcast('editUser');
$rootScope.$broadcast('newSuccess', 'user.edit.success');
}, function (error) {
$scope.restError = error.data;
@@ -93,9 +98,8 @@
}
$scope.editPassword = function () {
- if ($scope.currentUser.newPassword == $scope.currentUser.newPassword2) {
- User.editPassword($scope.currentUser, function (data) {
- SessionStorage.save({user:data});
+ if ($scope.data.user.newPassword == $scope.data.user.newPassword2) {
+ User.editPassword($scope.data.user, function (data) {
$rootScope.$broadcast('newSuccess', 'user.edit.success');
}, function (error) {
$scope.restError = error.data;
@@ -104,6 +108,36 @@
}
}])
+.controller('UserListCtrl', ['$scope', '$routeParams', 'User',
+ function ($scope, $routeParams, User) {
+ if (angular.isUndefined($scope.data)) {
+ $scope.data = {user:{}};
+ }
+
+ if (angular.isDefined(conf.pollDefaultPageSize)) {
+ $scope.pageSize = conf.pollDefaultPageSize;
+ }
+ else {
+ $scope.pageSize = -1;
+ }
+
+ var paginationParameter = {pageSize:$scope.pageSize};
+ if (angular.isDefined($routeParams.page)) {
+ if (angular.isDefined($routeParams.pageSize)) {
+ paginationParameter = {pageSize:$routeParams.pageSize};
+ $scope.pageSize = $routeParams.pageSize;
+ }
+
+ paginationParameter.pageNumber = $routeParams.page;
+ }
+
+ User.get({paginationParameter:paginationParameter}, function (data) {
+ console.log(data);
+ $scope.data.users = data.elements;
+ $scope.data.usersPagination = data.pagination
+ });
+}])
+
.controller('UserLoginCtrl', ['$scope', 'UserLogin', 'UserLogout', 'User', 'SessionStorage', '$route', '$location', '$translate', function ($scope, UserLogin, UserLogout, User, SessionStorage, $route, $location, $translate) {
if (angular.isUndefined($scope.data)) {
$scope.data = {user:{}};
@@ -111,7 +145,11 @@
$scope.$on('sessionExpired', function() {
$scope.logout();
- })
+ });
+
+ $scope.$on('editUser', function() {
+ $scope.currentUser = SessionStorage.get().user;
+ });
$scope.currentUser = SessionStorage.get().user;
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-link.html b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
index 73822bc..21fd606 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-link.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-link.html
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
+
<ul>
<li class="toMini" ng-click="toggleMinify()">
<a class="fakeLink" ng-show="globalVariables.minify"><span class="glyphicon glyphicon-chevron-right"></span></a>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-edit.html b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
index c995f7d..765d96e 100644
--- a/pollen-ui-angular/src/main/webapp/partials/user-edit.html
+++ b/pollen-ui-angular/src/main/webapp/partials/user-edit.html
@@ -26,7 +26,7 @@
{{ 'user.name' | translate }}
</label>
<div class="col-sm-6">
- <input type="text" id="formName" class="form-control" ng-model="currentUser.name" auto-save="editUser()" />
+ <input type="text" id="formName" class="form-control" ng-model="data.user.name" auto-save="editUser()" />
</div>
<div class="col-sm-1">
</div>
@@ -39,10 +39,10 @@
</label>
<div class="col-sm-6">
- <input type="email" id="formEmail" name="email" class="form-control" ng-model="currentUser.email" auto-save="editUser()" />
+ <input type="email" id="formEmail" name="email" class="form-control" ng-model="data.user.email" auto-save="editUser()" />
</div>
<div class="col-sm-1">
- <info-error error="restError.email[0]" data="currentUser.email"></info-error>
+ <info-error error="restError.email[0]" data="data.user.email"></info-error>
</div>
</div>
@@ -51,10 +51,10 @@
{{ 'user.passwordCurrent' | translate }}
</label>
<div class="col-sm-6">
- <input type="password" id="formPassword" class="form-control" ng-model="currentUser.password" auto-save="editUser()" />
+ <input type="password" id="formPassword" class="form-control" ng-model="data.user.password" auto-save="editUser()" />
</div>
<div class="col-sm-1">
- <info-error error="restError.password[0]" data="currentUser.password"></info-error>
+ <info-error error="restError.password[0]" data="data.user.password"></info-error>
</div>
</div>
@@ -73,10 +73,10 @@
{{ 'user.passwordCurrent' | translate }}
</label>
<div class="col-sm-6">
- <input type="password" id="formCurrentPassword" class="form-control" ng-model="currentUser.password" />
+ <input type="password" id="formCurrentPassword" class="form-control" ng-model="data.user.password" />
</div>
<div class="col-sm-1">
- <info-error error="restError.password[0]" data="currentUser.password"></info-error>
+ <info-error error="restError.password[0]" data="data.user.password"></info-error>
</div>
</div>
@@ -85,10 +85,10 @@
{{ 'user.passwordNew' | translate }}
</label>
<div class="col-sm-6">
- <input type="password" id="formNewPassword" class="form-control" ng-model="currentUser.newPassword" auto-save="editPassword()"/>
+ <input type="password" id="formNewPassword" class="form-control" ng-model="data.user.newPassword" auto-save="editPassword()"/>
</div>
<div class="col-sm-1">
- <info-error error="restError.newPassword[0]" data="currentUser.newPassword"></info-error>
+ <info-error error="restError.newPassword[0]" data="data.user.newPassword"></info-error>
</div>
</div>
@@ -97,10 +97,10 @@
{{ 'user.password2' | translate }}
</label>
<div class="col-sm-6">
- <input type="password" id="formNewPassword2" class="form-control" ng-model="currentUser.newPassword2" auto-save="editPassword()"/>
+ <input type="password" id="formNewPassword2" class="form-control" ng-model="data.user.newPassword2" auto-save="editPassword()"/>
</div>
<div class="col-sm-1">
- <span class="glyphicon glyphicon-exclamation-sign danger" tooltip="{{ 'user.error.password.diff' | translate }}" ng-if="currentUser.newPassword != currentUser.newPassword2"></span>
+ <span class="glyphicon glyphicon-exclamation-sign danger" tooltip="{{ 'user.error.password.diff' | translate }}" ng-if="data.user.newPassword != data.user.newPassword2"></span>
</div>
</div>
</form>
diff --git a/pollen-ui-angular/src/main/webapp/partials/user-list.html b/pollen-ui-angular/src/main/webapp/partials/user-list.html
new file mode 100644
index 0000000..02867b7
--- /dev/null
+++ b/pollen-ui-angular/src/main/webapp/partials/user-list.html
@@ -0,0 +1,11 @@
+
+<div ng-if="!data.users[0]"><h1>{{ 'user.error.listEmpty' | translate }}</h1></div>
+
+<div ng-repeat="user in data.users">
+ <h2><a href="#/user/edit/{{user.id}}">{{user.name || user.email}}</a></h2>
+ <hr/>
+</div>
+
+<make-pagination current-page="data.usersPagination.currentPage"
+ last-page="data.usersPagination.lastPage"
+ page-size="data.usersPagination.pageSize"></make-pagination>
--
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 ecd6fa0d70e52756980d8cc31d07a53eb3c87e5f
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 16:37:08 2014 +0200
translate poll.link
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 10 ++++++++--
pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 +-
pollen-ui-angular/src/main/webapp/partials/poll-list.html | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index beffd49..e4643f8 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -44,12 +44,18 @@ var translateEN = {
'poll.tab.conf' : 'Configuration',
'poll.tab.participant' : 'Participants',
-'poll.link.edit' : 'Edit Url',
-'poll.link.vote' : 'Vote Url',
+'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',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 7a3c2a0..d6c1c7c 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -51,11 +51,11 @@ var translateFR = {
'poll.link.export' : 'Exporter le sondage',
'poll.link.close' : 'Fermer les votes du sondage',
'poll.link.delete' : 'Supprimer le sondage',
-'poll.link.hide' : 'Minifier le cadre',
'poll.edit' : 'Clique pour éditer',
'poll.desc' : 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise',
'poll.saved' : 'Sondage sauvegardé',
+'poll.cloned' : 'Sondage cloné',
'poll.closed' : 'Sondage fermé',
'poll.deleted' : 'Sondage supprimé',
'poll.restricted.name' : 'Nom du votant',
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 5e8d310..1d61471 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
@@ -2,7 +2,7 @@
<div ng-if="!data.polls[0]"><h1>{{ 'poll.error.listEmpty' | translate }}</h1></div>
<div ng-repeat="poll in data.polls">
- <h2><a href="#/poll/vote/{{poll.id}}">{{poll.title}}</a> <a href="#/poll/edit/{{poll.id}}"><i class="glyphicon glyphicon-pencil"></i></a></h2>
+ <h2><a href="#/poll/vote/{{poll.id}}">{{poll.title}}</a></h2>
<p ng-bind-html="toHTML(poll.description)"></p>
<hr/>
</div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit 0cbc2651d9f12e9d7192f8184c6379343f0962f6
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 16:08:53 2014 +0200
clone voterList
---
.../pollen/services/service/PollService.java | 26 +++++++++++++++++-----
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
index ffdbf77..e35d911 100644
--- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
+++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
@@ -26,11 +26,7 @@ package org.chorem.pollen.services.service;
import com.google.common.base.Function;
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.PaginationParameterBean;
-import org.chorem.pollen.services.bean.PaginationResultBean;
-import org.chorem.pollen.services.bean.PollBean;
-import org.chorem.pollen.services.bean.PollenEntityRef;
+import org.chorem.pollen.services.bean.*;
import org.chorem.pollen.services.service.security.PermissionVerb;
import org.nuiton.util.pagination.PaginationParameter;
import org.nuiton.util.pagination.PaginationResult;
@@ -219,7 +215,10 @@ public class PollService extends PollenServiceSupport {
checkNotNull(pollId);
checkPermission(PermissionVerb.clonePoll, pollId);
- PollBean clonedPoll = toBean(PollBean.class, getPoll0(pollId));
+ Poll poll = getPoll0(pollId);
+
+ // Clone Poll
+ PollBean clonedPoll = toBean(PollBean.class, poll);
clonedPoll.setEntityId(null);
clonedPoll.setPermission(null);
@@ -231,6 +230,7 @@ public class PollService extends PollenServiceSupport {
clonedPoll.setTitle(clonedPoll.getTitle() + " (clone)");
+ // Clone Choice
List<ChoiceBean> clonedChoices = getChoiceService().getChoices(pollId);
for (ChoiceBean choice : clonedChoices) {
choice.setEntityId(null);
@@ -238,6 +238,20 @@ public class PollService extends PollenServiceSupport {
}
Poll savedPoll = savePoll(clonedPoll, clonedChoices);
+
+ //clone VoterList
+ List<VoterListBean> clonedVoterList = toBeanList(VoterListBean.class, getVoterListService().getVoterLists0(poll));
+ for (VoterListBean voterList : clonedVoterList) {
+ List<VoterListMemberBean> clonedVoterListMember = toBeanList(VoterListMemberBean.class , getVoterListService().getVoterListMembers0(voterList.toEntity()));
+
+ voterList.setEntityId(null);
+ VoterList savedVoterList = getVoterListService().saveVoterList(savedPoll, voterList);
+
+ for (VoterListMemberBean member : clonedVoterListMember) {
+ member.setEntityId(null);
+ getVoterListService().saveVoterListMember(savedVoterList, member);
+ }
+ }
commit();
getNotificationService().onPollCreated(savedPoll);
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
01/05: improve UI (print message when no poll in list, fix color vote)
by chorem.org scm July 2, 2014
by chorem.org scm July 2, 2014
July 2, 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 c804cdcd2f0dc6d3f027f22ad99b8a8508f3d3a2
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 14:43:26 2014 +0200
improve UI (print message when no poll in list,fix color vote)
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 1 +
pollen-ui-angular/src/main/webapp/i18n/fr.js | 1 +
pollen-ui-angular/src/main/webapp/less/style.less | 20 +++++++++-----------
.../src/main/webapp/partials/big-poll.html | 18 ++++++++++++------
.../src/main/webapp/partials/inline-poll.html | 4 ++--
.../src/main/webapp/partials/poll-list.html | 2 ++
pollen-ui-angular/src/main/webapp/partials/poll.html | 2 --
7 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index d6cb8e7..beffd49 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -64,6 +64,7 @@ var translateEN = {
'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.',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 94e7ad3..7a3c2a0 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -70,6 +70,7 @@ var translateFR = {
'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é',
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 6939672..13d64d0 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -205,11 +205,13 @@
margin:auto;
margin-bottom:8px;
}
-}
-.btn-large {
- height:60px;
- width:80px;
+ #poll-inline {
+ .btn-large {
+ height:60px;
+ width:80px;
+ }
+ }
}
@@ -232,10 +234,11 @@
height:25px;
}
- .voteTrue {
+ &.voteTrue {
background-color:@brand-success;
}
- .voteFalse {
+
+ &.voteFalse {
background-color:@brand-danger;
}
}
@@ -285,11 +288,6 @@
}
}
-.pollBigVote {
- float:right;
- margin-top:5px;
-}
-
.pool-alert {
position: fixed;
top:65px;
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 99be716..9dc5c09 100644
--- a/pollen-ui-angular/src/main/webapp/partials/big-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/big-poll.html
@@ -60,18 +60,24 @@
<input type="checkbox" ng-model="data.vote.choice[$index].voteValue" name="{{data.vote.choice[$index].choiceId}}"/>
</div>
</div>
+
<div class="row pollBigChoice">
<div class="col-sm-10">
- <button class="btn btn-info btn-large" ng-click="addChoice()" ng-if="globalVariables.editMode" ><span class="glyphicon glyphicon-plus"></span> Ajouter un choix</button>
+ <button class="btn btn-info" ng-click="addChoice()" ng-if="globalVariables.editMode" ><span class="glyphicon glyphicon-plus"></span> Ajouter un choix</button>
</div>
<div class="col-sm-2">
<button ng-click="inlineVersion()" class="btn btn-default">inline version</button>
</div>
</div>
-<div class="pollBigVote">
- <input-error error="data.vote.restError.voterName[0]" data="data.vote.voterName">
- <input type="text" class="form-control" placeholder="{{ 'user.name' | translate }}" ng-model="data.vote.voterName" input-error="data.vote.restError.voterName[0]" />
- </input-error>
- <button class="btn btn-primary" ng-click="voter()">{{ 'action.vote' | translate }}</button>
+<div class="row" ng-show="!globalVariables.editMode" ng-if="!data.poll.isClosed">
+ <div class="col-sm-6"> </div>
+ <div class="col-sm-4">
+ <input-error error="data.vote.restError.voterName[0]" data="data.vote.voterName">
+ <input type="text" class="form-control" placeholder="{{ 'user.name' | translate }}" ng-model="data.vote.voterName" input-error="data.vote.restError.voterName[0]" />
+ </input-error>
+ </div>
+ <div class="col-sm-2">
+ <button class="btn btn-primary" ng-click="voter()">{{ 'action.vote' | translate }}</button>
+ </div>
</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 87d801c..d5f4474 100644
--- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
@@ -21,7 +21,7 @@
~
-->
- <table>
+ <table id="poll-inline">
<!-- begin print choices -->
<tr>
<td><button ng-click="bigVersion()" class="btn btn-default" >Big version</button></td>
@@ -56,7 +56,7 @@
<tr ng-show="!globalVariables.editMode" ng-if="! data.poll.isClosed">
<td class="pollChoice">
<input-error error="data.vote.restError.voterName[0]" data="data.vote.voterName">
- <input type="text" class="form-control" placeholder="{{ 'user.name' | translate }}" ng-model="data.vote.voterName" input-error="data.vote.restError.voterName[0]" />
+ <input type="text" class="form-control" placeholder="{{ 'user.name' | translate }}" ng-model="data.vote.voterName" input-error="data.vote.restError.voterName[0]" focus-me="true" />
</input-error>
</td>
<td ng-repeat="choice in data.vote.choice" class="pollChoice" ng-class="{voteTrue:choice.voteValue, voteFalse:!choice.voteValue}" ng-click="toggleValue(choice, $event);">
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 e036126..5e8d310 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
@@ -1,4 +1,6 @@
+<div ng-if="!data.polls[0]"><h1>{{ 'poll.error.listEmpty' | translate }}</h1></div>
+
<div ng-repeat="poll in data.polls">
<h2><a href="#/poll/vote/{{poll.id}}">{{poll.title}}</a> <a href="#/poll/edit/{{poll.id}}"><i class="glyphicon glyphicon-pencil"></i></a></h2>
<p ng-bind-html="toHTML(poll.description)"></p>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html
index 234c6fd..ac7d5c1 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@ -30,8 +30,6 @@
<li ng-class="{active: tab == 'participant'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{globalVariables.linkParticipant || '#/poll/create/participant'}}" ng-click="tab = 'participant'">{{ 'poll.tab.participant' | translate }}</a></li>
</ul>
- <div ng-include="'./partials/poll-link.html'" ng-if="tab == 'home'"></div>
-
<div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'edit' || tab == 'vote'"></div>
<div ng-include="'./partials/poll-settings.html'" ng-if="tab == 'conf'"></div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
02/02: improve UI (print message when no poll in list, fix color vote)
by chorem.org scm July 2, 2014
by chorem.org scm July 2, 2014
July 2, 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 4e9d45d3a262196b2b5c9d9608aafe9467edd69d
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 14:43:26 2014 +0200
improve UI (print message when no poll in list,fix color vote)
---
pollen-ui-angular/src/main/webapp/i18n/en.js | 1 +
pollen-ui-angular/src/main/webapp/i18n/fr.js | 1 +
pollen-ui-angular/src/main/webapp/less/style.less | 5 +++--
pollen-ui-angular/src/main/webapp/partials/poll-list.html | 2 ++
pollen-ui-angular/src/main/webapp/partials/poll.html | 2 --
5 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js
index d6cb8e7..beffd49 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/en.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/en.js
@@ -64,6 +64,7 @@ var translateEN = {
'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.',
diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js
index 94e7ad3..7a3c2a0 100644
--- a/pollen-ui-angular/src/main/webapp/i18n/fr.js
+++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js
@@ -70,6 +70,7 @@ var translateFR = {
'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é',
diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less
index 6939672..5c98406 100644
--- a/pollen-ui-angular/src/main/webapp/less/style.less
+++ b/pollen-ui-angular/src/main/webapp/less/style.less
@@ -232,10 +232,11 @@
height:25px;
}
- .voteTrue {
+ &.voteTrue {
background-color:@brand-success;
}
- .voteFalse {
+
+ &.voteFalse {
background-color:@brand-danger;
}
}
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 e036126..5e8d310 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-list.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-list.html
@@ -1,4 +1,6 @@
+<div ng-if="!data.polls[0]"><h1>{{ 'poll.error.listEmpty' | translate }}</h1></div>
+
<div ng-repeat="poll in data.polls">
<h2><a href="#/poll/vote/{{poll.id}}">{{poll.title}}</a> <a href="#/poll/edit/{{poll.id}}"><i class="glyphicon glyphicon-pencil"></i></a></h2>
<p ng-bind-html="toHTML(poll.description)"></p>
diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html
index 234c6fd..ac7d5c1 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll.html
@@ -30,8 +30,6 @@
<li ng-class="{active: tab == 'participant'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{globalVariables.linkParticipant || '#/poll/create/participant'}}" ng-click="tab = 'participant'">{{ 'poll.tab.participant' | translate }}</a></li>
</ul>
- <div ng-include="'./partials/poll-link.html'" ng-if="tab == 'home'"></div>
-
<div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'edit' || tab == 'vote'"></div>
<div ng-include="'./partials/poll-settings.html'" ng-if="tab == 'conf'"></div>
--
To stop receiving notification emails like this one, please contact
chorem.org SCM administrator <admin+scm(a)chorem.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository pollen.
See http://git.chorem.org/pollen.git
commit 6bb1d317eec19d2c67efbcfed89695615c0c50d5
Author: Adrien Garandel <a.garandel(a)dralagen.fr>
Date: Wed Jul 2 14:42:26 2014 +0200
fix name result for type date
---
.../src/main/webapp/js/controllers/pollCtrl.js | 17 ++++++++++++++---
.../src/main/webapp/partials/poll-result.html | 2 +-
2 files changed, 15 insertions(+), 4 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 ae27703..68baa88 100644
--- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
+++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
@@ -1116,8 +1116,8 @@ angular.module('pollControllers', [])
}])
-.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate',
- function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate) {
+.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter',
+ function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter) {
$controller('PollCtrl', {$scope:$scope});
$scope.translateTitle = {
@@ -1157,7 +1157,18 @@ angular.module('pollControllers', [])
if ($scope.data.choices[i].id == value.choiceId) {
value.choice = $scope.data.choices[i];
- scores.push([value.choice.name, value.scoreValue]);
+ switch (value.choice.choiceType) {
+ case 'TEXT':
+ scores.push([value.choice.name, value.scoreValue]);
+ break;
+
+ case 'DATE':
+ scores.push([$filter('date')(value.choice.date, $scope.globalVariables.dateFormat), value.scoreValue]);
+ break;
+
+ default:
+ scores.push([key, value.scoreValue]);
+ }
// finish loop
i = $scope.data.choices.length;
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 5277130..dd918ea 100644
--- a/pollen-ui-angular/src/main/webapp/partials/poll-result.html
+++ b/pollen-ui-angular/src/main/webapp/partials/poll-result.html
@@ -24,7 +24,7 @@
<th>{{ 'poll.result.score' | translate }}</th>
</tr>
<tr ng-repeat="score in data.result.scores">
- <th> {{score.choice.name}} </th>
+ <th> {{ score.choice.name || (score.choice.date | date:globalVariables.dateFormat) }} </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