Skip to content

Commit 516071e

Browse files
committed
fix(survey): update commandButton actions to use actionListener
1 parent e924e97 commit 516071e

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

src/main/webapp/WEB-INF/templates/blocks/survey/answer.xhtml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@
6868
</div>
6969

7070
<div class="col d-flex justify-content-end">
71-
<p:commandButton value="#{msg.discard_changes}" action="#{surveyAnswerBean.onDiscard}" ajax="true" immediate="true" update="@form" styleClass="ui-button-danger" rendered="#{userBean.admin}"/>
72-
<p:commandButton value="#{msg.submit}" action="#{surveyAnswerBean.onSubmit}" ajax="true" update="@form" styleClass="ui-button-info" rendered="#{not surveyAnswerBean.hasNextPage}">
71+
<p:commandButton value="#{msg.discard_changes}" styleClass="ui-button-danger" rendered="#{userBean.admin}"
72+
actionListener="#{surveyAnswerBean.onDiscard}" ajax="true" immediate="true" update="@form"/>
73+
<p:commandButton value="#{msg.submit}" styleClass="ui-button-info" rendered="#{not surveyAnswerBean.hasNextPage}"
74+
actionListener="#{surveyAnswerBean.onSubmit}" ajax="true" update="@form">
7375
<p:confirm message="#{msg['survey.answer_submit_confirmation']}"/>
7476
</p:commandButton>
7577
</div>

src/main/webapp/WEB-INF/templates/blocks/survey/questions.xhtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<h:outputText value="#{msg['survey.empty']}" rendered="#{empty surveyEditBean.pages}"/>
1212

1313
<ui:repeat id="pi" value="#{surveyEditBean.pages}" var="page" varStatus="pageStatus">
14-
<div class="survey-page bg-body-tertiary d-flex flex-nowrap mb-3">
14+
<div class="survey-page bg-body-tertiary d-flex flex-nowrap mb-5">
1515
<ui:decorate template="/WEB-INF/templates/blocks/survey/snippet_page_edit.xhtml">
1616
<ui:param name="page" value="#{page}"/>
1717
<ui:param name="pageStatus" value="#{pageStatus}"/>
@@ -20,8 +20,8 @@
2020
</ui:repeat>
2121

2222
<h:form id="survey_add" styleClass="d-flex flex-nowrap">
23-
<p:commandButton action="#{surveyEditBean.onAddPage}" styleClass="ui-button-info ui-button-flat" value="#{msg['survey.mod_add_page']}"
24-
process="@this" immediate="true" update="@form:@parent"/>
23+
<p:commandButton styleClass="ui-button-info ui-button-flat" value="#{msg['survey.mod_add_page']}"
24+
actionListener="#{surveyEditBean.onAddPage}" process="@this" immediate="true" update="@form:@parent"/>
2525
</h:form>
2626
</h:panelGroup>
2727
</div>

src/main/webapp/WEB-INF/templates/blocks/survey/snippet_page_edit.xhtml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<!--@elvariable id="pageStatus" type="org.apache.myfaces.view.facelets.component.RepeatStatus"-->
1010

1111
<f:subview id="p${page.id}">
12-
<div class="d-flex flex-column justify-content-center bg-info" style="width: 3rem;" faces:rendered="#{not empty pageStatus}">
12+
<div class="d-flex flex-column justify-content-center #{pageStatus.index % 2 == 0 ? 'bg-info' : 'bg-warning'}" style="width: 3rem;" faces:rendered="#{not empty pageStatus}">
1313
<p:commandButton form="page_edit" alt="#{msg['move_up']}" styleClass="ui-button-flat text-body mx-0" icon="fas fa-angle-up" rendered="#{not pageStatus.first}"
1414
actionListener="#{surveyEditBean.onMovePage(page, -1)}" update="pages" process="@this" immediate="true"/>
1515
<p:commandButton form="page_edit" alt="#{msg['move_down']}" styleClass="ui-button-flat text-body mx-0" icon="fas fa-angle-down" rendered="#{not pageStatus.last}"
16-
action="#{surveyEditBean.onMovePage(page, 1)}" update="pages" process="@this" immediate="true"/>
16+
actionListener="#{surveyEditBean.onMovePage(page, 1)}" update="pages" process="@this" immediate="true"/>
1717
</div>
1818

1919
<div class="flex-grow-1 p-2">
@@ -93,13 +93,13 @@
9393

9494
<div class="d-flex flex-nowrap">
9595
<p:commandButton form="page_edit" styleClass="ui-button-success ui-button-flat" value="#{msg['survey.mod_add_question']}"
96-
action="#{surveyPageEditBean.onAddQuestion(page)}" process="@this" immediate="true" update="questions"/>
96+
actionListener="#{surveyPageEditBean.onAddQuestion(page)}" process="@this" immediate="true" update="questions"/>
9797
<p:commandButton form="page_edit" styleClass="ui-button-success ui-button-flat" value="#{msg['survey.mod_add_header']}"
98-
action="#{surveyPageEditBean.onAddHeader(page)}" process="@this" immediate="true" update="questions"/>
98+
actionListener="#{surveyPageEditBean.onAddHeader(page)}" process="@this" immediate="true" update="questions"/>
9999
<p:commandButton form="page_edit" styleClass="ms-auto ui-button-info ui-button-flat" value="#{msg['survey.mod_duplicate']}"
100-
action="#{surveyEditBean.onDuplicatePage(page)}" process="@this" immediate="true" update="pages"/>
100+
actionListener="#{surveyEditBean.onDuplicatePage(page)}" process="@this" immediate="true" update="pages"/>
101101
<p:commandButton form="page_edit" styleClass="ui-button-danger ui-button-flat" value="#{msg['survey.mod_delete_page']}"
102-
action="#{surveyEditBean.onDeletePage(page)}" process="@this" immediate="true" update="pages" rendered="#{not empty pageStatus}"/>
102+
actionListener="#{surveyEditBean.onDeletePage(page)}" process="@this" immediate="true" update="pages" rendered="#{not empty pageStatus}"/>
103103
</div>
104104
</div>
105105
</f:subview>

src/main/webapp/WEB-INF/templates/blocks/survey/snippet_question_edit.xhtml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<h:form id="question_edit" styleClass="survey-question bg-body-secondary mb-3 d-flex flex-nowrap" rendered="#{!question.deleted}">
1414
<div class="d-flex flex-column justify-content-center bg-primary" faces:rendered="#{not empty questionStatus}">
1515
<p:commandButton alt="#{msg['move_up']}" styleClass="ui-button-flat text-body mx-0" icon="fas fa-angle-up" rendered="#{!questionStatus.first}"
16-
actionListener="#{surveyPageEditBean.onMoveQuestion(page, question, -1)}" update="questions" process="@this"/>
16+
actionListener="#{surveyPageEditBean.onMoveQuestion(page, question, -1)}" update="questions" process="@this" immediate="true"/>
1717
<p:commandButton alt="#{msg['move_down']}" styleClass="ui-button-flat text-body mx-0" icon="fas fa-angle-down" rendered="#{!questionStatus.last}"
18-
action="#{surveyPageEditBean.onMoveQuestion(page, question, 1)}" update="questions" process="@this"/>
18+
actionListener="#{surveyPageEditBean.onMoveQuestion(page, question, 1)}" update="questions" process="@this" immediate="true"/>
1919
</div>
2020

2121
<div class="flex-grow-1 p-3">
@@ -28,36 +28,36 @@
2828
<p:message for="@previous"/>
2929
</div>
3030

31-
<div class="field" faces:rendered="#{question.type eq 'INPUT_TEXT' or question.type eq 'INPUT_TEXTAREA'}">
32-
<p:outputLabel for="@next" value="#{msg['survey.mod_placeholder_text']}:" styleClass="fw-bold"/>
33-
<p:inputTextarea value="#{question.placeholder}" rows="1">
34-
<p:ajax event="change" listener="#{surveyPageEditBean.onQuestionChange(question)}"/>
35-
</p:inputTextarea>
36-
<p:message for="@previous"/>
37-
</div>
38-
3931
<div class="field">
4032
<p:outputLabel for="@next" value="#{msg['survey.mod_description_text']}:" styleClass="fw-bold"/>
4133
<p:textEditor value="#{question.description}" allowBlocks="false">
4234
<p:ajax event="change" listener="#{surveyPageEditBean.onQuestionChange(question)}"/>
4335
<f:facet name="toolbar">
44-
<span class="ql-formats">
45-
<button class="ql-bold"></button>
46-
<button class="ql-italic"></button>
47-
<button class="ql-underline"></button>
48-
<button class="ql-strike"></button>
49-
</span>
5036
<span class="ql-formats">
51-
<button class="ql-link" />
52-
<button class="ql-image" />
53-
<button class="ql-video" />
54-
<button class="ql-formula" />
55-
</span>
37+
<button class="ql-bold"></button>
38+
<button class="ql-italic"></button>
39+
<button class="ql-underline"></button>
40+
<button class="ql-strike"></button>
41+
</span>
42+
<span class="ql-formats">
43+
<button class="ql-link" />
44+
<button class="ql-image" />
45+
<button class="ql-video" />
46+
<button class="ql-formula" />
47+
</span>
5648
</f:facet>
5749
</p:textEditor>
5850
<p:message for="@previous"/>
5951
</div>
6052

53+
<div class="field" faces:rendered="#{question.type eq 'INPUT_TEXT' or question.type eq 'INPUT_TEXTAREA'}">
54+
<p:outputLabel for="@next" value="#{msg['survey.mod_placeholder_text']}:" styleClass="fw-bold"/>
55+
<p:inputTextarea value="#{question.placeholder}" rows="1">
56+
<p:ajax event="change" listener="#{surveyPageEditBean.onQuestionChange(question)}"/>
57+
</p:inputTextarea>
58+
<p:message for="@previous"/>
59+
</div>
60+
6161
<div faces:id="type_row" class="row field align-items-end" faces:rendered="#{question.type ne 'FULLWIDTH_HEADER'}">
6262
<p:outputPanel styleClass="col d-flex flex-column">
6363
<p:outputLabel for="@next" value="#{msg['survey.mod_question_type']}:" styleClass="fw-bold"/>
@@ -115,13 +115,13 @@
115115

116116
<p:tooltip for="@next" value="#{msg['survey.mod_delete_option']}"/>
117117
<p:commandButton styleClass="rounded-button ui-button-flat ui-button-secondary align-self-center" icon="fas fa-minus"
118-
action="#{surveyPageEditBean.onQuestionOptionDelete(question, answer)}" update="@form:options" process="@this"/>
118+
actionListener="#{surveyPageEditBean.onQuestionOptionDelete(question, answer)}" update="@form:options" process="@this"/>
119119
</h:panelGroup>
120120
</ui:repeat>
121121

122122
<p:tooltip for="@next" value="#{msg['survey.mod_add_answer']}"/>
123123
<p:commandButton styleClass="rounded-button ui-button-flat ui-button-secondary align-self-center" icon="fas fa-plus"
124-
action="#{surveyPageEditBean.onQuestionOptionAdd(question)}" update="@form:options" process="@this"/>
124+
actionListener="#{surveyPageEditBean.onQuestionOptionAdd(question)}" update="@form:options" process="@this"/>
125125
</div>
126126
</ui:fragment>
127127
</p:outputPanel>

0 commit comments

Comments
 (0)