/
answerOptionRow.twig
155 lines (147 loc) · 5.86 KB
/
answerOptionRow.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{#
/**
* Answer option row view
*
* @var bool $first
* @var bool $assessmentvisible
* @var int $scale_id
* @var Question $question
* @var string $language
* @var Answer $answerOption
* @var AnswerL10n $answerl10ns
*
* NB: If you edit this view, remember to check if subquestion row view need also to be updated.
*/
#}
<tr
class='row-container'
id='row_{{ language }}_{{ answerOption.aid }}_{{ scale_id }}'
data-common-id="{{ answerOption.aid }}_{{ scale_id }}"
>
{# If survey is not activated and first language #}
{% if first %}
<!-- Move icon -->
<td
style="text-align: center;"
>
<span
class="fa fa-bars bigIcons move-icon"
role="button"
data-toggle="tooltip"
data-title="{{ gT("Drag to sort") }}"
></span>
</td>
<!-- Code -->
<td class="code-title" style="vertical-align: middle;">
{% if oldCode %}
<input
type='hidden'
class='oldcode code-title'
id='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][oldcode]'
name='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][oldcode]'
value="{{ answerOption.code }}"
/>
{% endif %}
<input
type='text'
class="code form-control input"
id='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][code]'
name='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][code]'
class='code code-title'
value="{{ answerOption.code }}"
maxlength='5'
required='required'
{% if question.survey.active == 'Y' %}
readonly="readonly"
{% endif %}
onfocusout="LS.questionEditor.showAnswerOptionCodeUniqueError(this);"
/>
</td>
{# If survey is not active, and it's not the first language : no move button, code not editable #}
{% else %}
<!-- Move icon -->
<td class="move-icon-disable"> </td>
<!-- Code -->
<td class="code-title" style="vertical-align: middle;">{{ answerOption.code }}</td>
{% endif %}
<!-- Assessment Value -->
{% if assessmentvisible and first %}
<td class="assessment-value">
<input
type='text'
class='assessment form-control input'
id='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][assessment]'
name='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][assessment]'
value="{{ answerOption.assessment_value }}"
maxlength='5'
size='5'
onkeypress="returnwindow.LS.goodchars(event,'-1234567890')"
/>
</td>
{% elseif first %}
<td style='display:none;' class="assessment-value">
<input
type='text'
class='assessment'
id='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][assessment]'
name='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][assessment]'
value="{{ answerOption.assessment_value }}"
maxlength='5'
size='5'
onkeypress="returnwindow.LS.goodchars(event,'-1234567890')"
/>
</td>
{% elseif assessmentvisible %}
<td class="assessment-value">
{{ answerOption.assessment_value }}
</td>
{% else %}
<td style='display:none;' class="assessment-value"></td>
{% endif %}
<!-- Answer -->
<td class="answeroption-text" style="vertical-align: middle;">
<div class="input-group">
<input
type='text'
size='20'
class='answer form-control input'
id='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][answeroptionl10n][{{ language }}]'
name='answeroptions[{{ answerOption.aid }}][{{ scale_id }}][answeroptionl10n][{{ language }}]'
placeholder='{{ gT("Some example answer option") }}'
data-contents-dir="{{ getLanguageRTL(language) ? 'rtl' : 'ltr' }}"
value="{{ answerOptionl10n.answer|escape('html_attr') }}"
/>
<span class="input-group-addon">
{{ getEditor(
"editanswer",
"answeroptions["~answerOption.aid~"]["~scale_id~"][answeroptionl10n]["~language~"]",
"["~gT("Answer option:", "js")~"]("~language~")",
question.sid,
question.gid,
question.qid,
'editanswer'
) }}
</span>
</div>
</td>
<!-- Icons edit/delete -->
<td style="vertical-align: middle; white-space: nowrap;" class="answeroption-actions">
{% if activated != 'Y' and first %}
<button type="button" class="btn btn-default btn-sm btnaddanswer">
<i
class="icon-add text-success"
data-assessmentvisible='{{ assessmentvisible }}'
data-position="{{ position }}"
data-code="{{ answerOption.code }}"
data-scale-id="{{ scale_id }}"
data-toggle="tooltip"
data-placement="bottom"
title="{{ gT("Insert a new answer option after this one") }}"
></i>
</button>
<button type="button" class="btn btn-default btn-sm btndelanswer">
<i class="fa fa-trash text-danger " data-toggle="tooltip" data-placement="bottom" title="{{ gT("Delete this entry") }}"></i>
</button>
{% endif %}
</td>
</tr>