branch develop updated (83dec30 -> cec06d0)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 83dec30 correction des test des liste de voteurs new cec06d0 dans la visialisation des choix proposer le téléchargement d'une ressource qui n'est pas une image The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit cec06d033e5a5404962f9234be00f76ae0b3f816 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Apr 10 16:51:37 2017 +0200 dans la visialisation des choix proposer le téléchargement d'une ressource qui n'est pas une image Summary of changes: .../pollen/rest/api/v1/PollenResourceApi.java | 7 +++++ pollen-rest-api/src/main/resources/mapping | 1 + .../pollen/services/service/PollService.java | 6 +++-- pollen-ui-riot-js/src/main/web/i18n.json | 6 +++-- .../src/main/web/js/ResourceService.js | 4 +++ .../src/main/web/tag/poll/ChoiceView.tag.html | 31 +++++++++++++++++++--- 6 files changed, 48 insertions(+), 7 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit cec06d033e5a5404962f9234be00f76ae0b3f816 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Apr 10 16:51:37 2017 +0200 dans la visialisation des choix proposer le téléchargement d'une ressource qui n'est pas une image --- .../pollen/rest/api/v1/PollenResourceApi.java | 7 +++++ pollen-rest-api/src/main/resources/mapping | 1 + .../pollen/services/service/PollService.java | 6 +++-- pollen-ui-riot-js/src/main/web/i18n.json | 6 +++-- .../src/main/web/js/ResourceService.js | 4 +++ .../src/main/web/tag/poll/ChoiceView.tag.html | 31 +++++++++++++++++++--- 6 files changed, 48 insertions(+), 7 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java index 688c76c..25812bc 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java @@ -54,6 +54,13 @@ public class PollenResourceApi extends WebMotionController { return renderStream(resource.getResourceContent(), resource.getContentType()); } + public Render getDownloadResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId) { + + ResourceStreamBean resource = pollenResourceService.getResource(resourceId.getEntityId()); + + return renderDownload(resource.getResourceContent(), resource.getName(), resource.getContentType()); + } + public Render getPreviewResource(PollenResourceService pollenResourceService, PollenEntityId<PollenResource> resourceId) throws IOException { ResourceStreamBean resource = pollenResourceService.getResource(resourceId.getEntityId()); diff --git a/pollen-rest-api/src/main/resources/mapping b/pollen-rest-api/src/main/resources/mapping index aacf80e..8dbf62f 100644 --- a/pollen-rest-api/src/main/resources/mapping +++ b/pollen-rest-api/src/main/resources/mapping @@ -120,6 +120,7 @@ PUT /v1/polls/{pollId}/reopen PollApi.reopenPoll # PollenResourceApi GET /v1/resources/{resourceId} PollenResourceApi.getResource +GET /v1/resources/{resourceId}/download PollenResourceApi.getDownloadResource GET /v1/resources/{resourceId}/meta PollenResourceApi.getMetaResource GET /v1/resources/{resourceId}/preview PollenResourceApi.getPreviewResource POST /v1/resources PollenResourceApi.createResource 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 b2723e1..73c5e5c 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 @@ -225,10 +225,12 @@ public class PollService extends PollenServiceSupport { ErrorMap errorMap = checkPoll(poll); errorMap.failIfNotEmpty(); Set<String> newParticipants = Sets.newHashSet(); - if (PollType.FREE.equals(poll.getPollType())) { + if (PollType.FREE.equals(poll.getPollType()) ) { Poll pollDb = getPoll0(poll.getEntityId()); newParticipants.addAll(Sets.newHashSet(poll.getParticipants())); - newParticipants.removeAll(Sets.newHashSet(pollDb.getParticipants().split("\\s+"))); + if (pollDb.getParticipants() != null) { + newParticipants.removeAll(Sets.newHashSet(pollDb.getParticipants().split("\\s+"))); + } } Poll savedPoll = savePoll(poll, null); diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 7a5427b..adf795f 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -284,7 +284,8 @@ "choice_addFile": "Ajouter un fichier", "choice_date": "Renseignez une date", "choice_time": "Ajouter une heure à la date", - "choice_description": "Ajouter un descriptif du choix" + "choice_description": "Ajouter un descriptif du choix", + "choice_download": "Télécharger" }, "en": { "pagination_all": "All", @@ -562,6 +563,7 @@ "choice_addFile": "Add image", "choice_date": "Set a date", "choice_time": "add hours to date", - "choice_description": "add description" + "choice_description": "add description", + "choice_download": "Download" } } diff --git a/pollen-ui-riot-js/src/main/web/js/ResourceService.js b/pollen-ui-riot-js/src/main/web/js/ResourceService.js index 767a3e3..7d3ce2e 100644 --- a/pollen-ui-riot-js/src/main/web/js/ResourceService.js +++ b/pollen-ui-riot-js/src/main/web/js/ResourceService.js @@ -36,6 +36,10 @@ class ResourceService extends FetchService { return this.get("/v1/resources/" + resourceId + "/preview"); } + getMeta(resourceId) { + return this.get("/v1/resources/" + resourceId + "/meta"); + } + delete(resourceId) { return this.doDelete("/v1/resources/" + resourceId); } diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html index 437f1ee..35ae63a 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html @@ -15,9 +15,13 @@ {formatDate(parseInt(opts.choice.choiceValue, 10))} </span> <div class="choice-ressource" - if={opts.choice.choiceType === "RESOURCE"}> + if={opts.choice.choiceType === "RESOURCE" && meta && meta.contentType.match(/^image\//i)}> <img class="image-preview" src="{session.configuration.endPoint}/v1/resources/{opts.choice.choiceValue}/preview"/> </div> + <div class="choice-ressource" + if={opts.choice.choiceType === "RESOURCE" && meta && !meta.contentType.match(/^image\//i)}> + {meta.name} + </div> <div if={opts.choice.choiceType === "RESOURCE" || opts.choice.description} class="info"> <i class="fa fa-question-circle" aria-hidden="true"></i> </div> @@ -37,8 +41,20 @@ <h2 if={opts.choice.choiceType === "DATETIME"}> {formatDate(parseInt(opts.choice.choiceValue, 10))} </h2> - <div if={opts.choice.choiceType === "RESOURCE"}> - <img class="image-preview" src="{session.configuration.endPoint}/v1/resources/{opts.choice.choiceValue}"/> + <div if={opts.choice.choiceType === "RESOURCE" && meta && meta.contentType.match(/^image\//i)}> + <img if={meta && meta.contentType.match(/^image\//i)} + class="image-preview" + src="{session.configuration.endPoint}/v1/resources/{opts.choice.choiceValue}"/> + </div> + <div if={opts.choice.choiceType === "RESOURCE" && meta && !meta.contentType.match(/^image\//i)}> + <h2>{meta.name}</h2> + <a class="c-button c-button--info"if={meta && !meta.contentType.match(/^image\//i)} + href="{session.configuration.endPoint}/v1/resources/{opts.choice.choiceValue}/download" + target="_blank"> + <i class="fa fa-download"></i> + {__.download} + + </a> </div> </header> <div class="c-card__body"> @@ -49,9 +65,18 @@ </div> <script type="es6"> + let ResourceService = require("../../js/ResourceService"); this.session = require("../../js/Session"); + this.installBundle(this.session, "choice"); this.showModalImage = false; + if (this.opts.choice.choiceType === "RESOURCE") { + ResourceService.getMeta(this.opts.choice.choiceValue).then(meta => { + this.meta = meta; + this.update(); + }); + } + this.openModalImage = () => { if (this.opts.choice.description || this.opts.choice.choiceType === "RESOURCE") { this.showModalImage = true; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm