Skip to content

Commit 8a5da66

Browse files
committed
added question-identifiers
1 parent 33736b3 commit 8a5da66

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

app/views/org_admin/questions/_show.html.erb

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,31 @@
1818
<%= sanitize question.text %>
1919
</div>
2020
</dd>
21+
<!--Question Identifiers block - This verifies if org has permission to add question Identifiers-->
22+
<% org = Org.find(question.section.phase.template.org_id)%>
23+
<% if org.can_add_question_identifiers? && question.question_identifiers.present?
24+
# Check if any element has non-empty name and value
25+
has_valid_identifiers = question.question_identifiers.any? do |identifier|
26+
if !identifier[:name].blank? && !identifier[:value].blank? %>
27+
<dt><%= _('Question Identifiers')%></dt>
28+
<% question.question_identifiers.to_a.each do |q_identifier| %>
29+
<dd><%= raw _('<b>Value:</b>')%> <%= q_identifier.value %></dd>
30+
<dd><%= raw _('<b>Name:</b>')%> <%= q_identifier.name %></dd>
31+
<% end %>
32+
<br>
33+
<% end %>
34+
<% end %>
35+
<% end %>
2136
<!-- question.option_based? -->
2237
<% if question.option_based? %>
2338
<dt><%= _('Question options') %></dt>
2439
<dd><%= question.question_options.order(:number).collect(&:text).join(', ') %></dd>
40+
<br>
2541
<% end %>
2642
<!-- Default value -->
2743
<% if q_format.textfield? || q_format.textarea? %>
28-
<% if !question.default_value.nil? %>
29-
<dt><%= _('Default value')%></dt>
44+
<% if !question.default_value.nil? && !question.default_value.empty? %>
45+
<dt><%= _('Default value') %></dt>
3046
<dd>
3147
<% if q_format.textarea? %>
3248
<div class="display-readonly-textarea-content">
@@ -48,7 +64,8 @@
4864
<%= _('No additional comment area will be displayed.')%>
4965
<% end %>
5066
</dd>
51-
67+
<br>
68+
5269
<!-- question conditions -->
5370
<% if conditions.count > 0 %>
5471
<dt><%= _('Question conditions') %></dt>

0 commit comments

Comments
 (0)