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 5aa98831e51d6f9856abaee5907d57dfb704b0d3 Author: Kevin Morin <morin@codelutin.com> Date: Tue Jul 18 15:07:54 2017 +0200 fixes #82 focus sur les nouveaux choix --- pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html | 12 ++++++++++++ pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html index 32df6368..dfcda103 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html @@ -133,6 +133,8 @@ require("../components/time-picker.tag.html"); }; } + this.on("mount", this.focus); + this.setTextType = () => { this.opts.choice.choiceType = "TEXT"; }; @@ -222,6 +224,16 @@ require("../components/time-picker.tag.html"); this.refs.choiceResource.value = ""; }; + this.focus = () => { + if (this.opts.choice.choiceType === "TEXT") { + this.refs.choiceText.focus(); + } else if (this.opts.choice.choiceType === "RESOURCE") { + this.refs.choiceResource.focus(); + } else { + this.refs.choiceDate.focus(); + } + }; + </script> <style> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html index 2130a4e1..1dc4b270 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html @@ -5,7 +5,7 @@ require("./Choice.tag.html"); class="o-form-element"> <div class="c-input-group"> <div class="o-field"> - <Choice ref="choice" + <Choice ref="choice{index}" class="choice c-field" name={"choice" + index} disabled={form.hasVotes} @@ -37,10 +37,16 @@ require("./Choice.tag.html"); this.choiceType = this.form.choiceType || "TEXT"; this.installBundle(this.session, "poll_choices", this.opts.emitter); + this.on("mount", () => { + this.refs["choice0"].focus(); + }); + this.addOneChoice = () => { if (!this.form.hasVotes) { this.submit(); this.form.addNewChoice(); + this.update(); + this.refs["choice" + (this.form.choices.length - 1)].focus(); } }; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.