Skip to content

Commit d2f1bbd

Browse files
committed
FORMS-834 : add scale type for radio entry
1 parent 46734c1 commit d2f1bbd

File tree

6 files changed

+62
-5
lines changed

6 files changed

+62
-5
lines changed

src/java/fr/paris/lutece/plugins/forms/resources/forms_messages.properties

+5
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,11 @@ createEntry.viewNumber=View number
605605
createEntry.labelPresentation=presentation model
606606
createEntry.selectPresentationInLine=In line
607607
createEntry.selectPresentationNotInLine=In column
608+
createEntry.labelAlignmentText=Text alignment
609+
createEntry.selectAlignmentTop=At the top
610+
createEntry.selectAlignmentToTheRight=To the right
611+
createEntry.labelTextLeft=Left field
612+
createEntry.labelTextRight=Right field
608613
create_entry.label_role_associated=role
609614
createEntry.labelMandatoryCheckBoxHelp=Every check box must be checked
610615
createEntry.labelMandatoryCommentForEntryTypeSession=Check this box if you want to display the form only if there is a value in the attribute of this session

src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fr.properties

+5
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,11 @@ createEntry.viewNumber=Num\u00e9ro de la vue
609609
createEntry.labelPresentation=Modèle de pr\u00e9sentation
610610
createEntry.selectPresentationInLine=En ligne
611611
createEntry.selectPresentationNotInLine=En colonne
612+
createEntry.labelAlignmentText=Alignement du texte
613+
createEntry.selectAlignmentTop=En haut
614+
createEntry.selectAlignmentToTheRight=A droite
615+
createEntry.labelTextLeft=Champ gauche
616+
createEntry.labelTextRight=Champ droite
612617
create_entry.label_role_associated=Associer un r\u00f4le
613618
createEntry.labelMandatoryCheckBoxHelp=Toutes les cases à cocher doivent obligatoirement être coch\u00e9es
614619
createEntry.labelMandatoryCommentForEntryTypeSession=Cochez cette case si vous souhaitez afficher le formulaire uniquement s'il y a une valeur dans cet attribut de session.

webapp/WEB-INF/templates/admin/plugins/forms/entries/create_entry_type_radio_button.html

+13
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@
4545
<option value=0 <#if presentation_type = '0' >selected="selected"</#if> >#i18n{forms.createEntry.selectPresentationNotInLine}</option>
4646
</@select>
4747
</@formGroup>
48+
<@formGroup labelFor='alignment_text' labelKey='#i18n{forms.createEntry.labelAlignmentText}'>
49+
<#assign alignment_type = getName('alignment_text',list_param_default_values)!1>
50+
<@select id='alignment_text' name='alignment_text'>
51+
<option value=1 <#if alignment_type = '1' >selected="selected"</#if> >#i18n{forms.createEntry.selectAlignmentTop}</option>
52+
<option value=0 <#if alignment_type = '0' >selected="selected"</#if> >#i18n{forms.createEntry.selectAlignmentToTheRight}</option>
53+
</@select>
54+
</@formGroup>
55+
<@formGroup labelFor='entry_text_left' labelKey='#i18n{forms.createEntry.labelTextLeft}' helpKey='#i18n{forms.createEntry.labelTextLeft}'>
56+
<@input type='text' name='left_text' id='left_text' value='' maxlength=100 />
57+
</@formGroup>
58+
<@formGroup labelFor='entry_text_right' labelKey='#i18n{forms.createEntry.labelTextRight}' helpKey='#i18n{forms.createEntry.labelTextRight}'>
59+
<@input type='text' name='right_text' id='right_text' value='' maxlength=100 />
60+
</@formGroup>
4861
<@formGroup labelFor='mandatory' labelKey='#i18n{forms.createEntry.labelMandatory}'>
4962
<@checkBox orientation='switch' name='mandatory' id='mandatory' value='1' checked=getChecked('mandatory',list_param_default_values) />
5063
</@formGroup>

webapp/WEB-INF/templates/admin/plugins/forms/entries/modify_entry_type_radio_button.html

+15
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@
5050
<option value=0 <#if !entry.fieldInLine >selected="selected" </#if>>#i18n{forms.createEntry.selectPresentationNotInLine}</option>
5151
</@select>
5252
</@formGroup>
53+
<@formGroup labelFor='alignment_text' labelKey='#i18n{forms.createEntry.labelAlignmentText}'>
54+
<#assign alignment_type=getFieldValueByCode( entry, "alignment_text")>
55+
<@select id='alignment_text' name='alignment_text'>
56+
<option value=1 <#if alignment_type = '1' >selected="selected"</#if> >#i18n{forms.createEntry.selectAlignmentTop}</option>
57+
<option value=0 <#if alignment_type = '0' >selected="selected"</#if> >#i18n{forms.createEntry.selectAlignmentToTheRight}</option>
58+
</@select>
59+
</@formGroup>
60+
<@formGroup labelFor='entry_radio_left' labelKey='#i18n{forms.createEntry.labelTextLeft}' helpKey='#i18n{forms.createEntry.labelTextLeft}'>
61+
<#assign text_left=getFieldValueByCode( entry, "left_text")>
62+
<@input type='text' name='left_text' id='left_text' value=text_left maxlength=100 />
63+
</@formGroup>
64+
<@formGroup labelFor='entry_radio_right' labelKey='#i18n{forms.createEntry.labelTextRight}' helpKey='#i18n{forms.createEntry.labelTextRight}'>
65+
<#assign text_right=getFieldValueByCode( entry, "right_text")>
66+
<@input type='text' name='right_text' id='right_text' value=text_right maxlength=100 />
67+
</@formGroup>
5368
<@formGroup>
5469
<@checkBox orientation='switch' labelFor='mandatory' labelKey='#i18n{forms.createEntry.labelMandatory}' name='mandatory' id='mandatory' value='1' checked=entry.mandatory labelKey='#i18n{forms.createEntry.labelMandatory}' />
5570
</@formGroup>

webapp/WEB-INF/templates/skin/plugins/forms/entries/fill_entry_type_radio_button.html

+21-4
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,31 @@
1111
<#assign idConditional = idName + field.idField>
1212
<#assign hide=hide+"hideId(${idConditional}.id);">
1313
</#if>
14+
<#if field.code == 'left_text'>
15+
<#assign leftText = field.value>
16+
</#if>
17+
<#if field.code == 'right_text'>
18+
<#assign rightText = field.value>
19+
</#if>
20+
<#if field.code == 'alignment_text'>
21+
<#assign fieldAlignment = field.value>
22+
</#if>
1423
</#list>
1524
${entry.CSSClass!}
1625

1726
<div class="form-group">
1827
<label class="control-label col-xs-12 col-sm-12 col-md-3 col-lg-3" for="form${entry.idEntry}" id="form${entry.idEntry}">${entry.title}<#if entry.mandatory> *</#if></label>
1928
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
2029
<#assign inLine = entry.fieldInLine>
30+
${leftText!}
2131
<#list entry.fields as field>
2232
<#if field.code == 'answer_choice'>
2333
<#assign idName = buildEntryName( entry, entry_iteration_number )>
2434
<#if entry.fieldInLine != true><div class="radio"></#if>
25-
<label <#if entry.fieldInLine>class="radio-inline"</#if> for="${idName}_${field.idField}" <#if field.comment?? && field.comment != ''>title="${field.comment}"</#if> >
35+
<#if fieldAlignment?? && fieldAlignment == "1">
36+
<label <#if entry.fieldInLine>class="custom-control custom-radio custom-control-inline"</#if> for="${idName}_${field.idField}" <#if field.comment?? && field.comment != ''>title="${field.comment}"</#if> >
37+
<div class="radio-above">
38+
</#if>
2639
<input type="radio" id="${idName}_${field.idField}" name="${idName}" value="${field.idField}"
2740
<#if list_responses?? && list_responses?has_content>
2841
<#list list_responses as response>
@@ -40,9 +53,12 @@
4053
<#assign idConditional = idName + field.idField>
4154
displayId(${idConditional}.id);</#if>"
4255
/>
43-
<#if !field.noDisplayTitle>
44-
${field.title}
45-
</#if>
56+
<#if !field.noDisplayTitle>
57+
${field.title}
58+
</#if>
59+
<#if fieldAlignment?? && fieldAlignment == "1">
60+
</div>
61+
</#if>
4662
</label>
4763
<#if entry.fieldInLine != true></div></#if>
4864

@@ -58,6 +74,7 @@
5874
<#if entry.fieldInLine&&entry.helpMessage?exists&&entry.helpMessage!=''>
5975
<span class="help-block">${entry.helpMessage}</span>
6076
</#if>
77+
${rightText!}
6178
</div>
6279
</div>
6380

webapp/css/plugins/forms/forms.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55

66
.cam-wrapper{ position: relative; border: 1px dotted #000; display: flex; justify-content: center;}
77
.cam-wrapper > video{ max-width: 100%; }
8-
.btn-cam{ position: absolute !important; bottom:15px; right:15px; }
8+
.btn-cam{ position: absolute !important; bottom:15px; right:15px; }
9+
10+
.radio-above{ display: flex; flex-direction: column-reverse; padding:15px; }

0 commit comments

Comments
 (0)