aboutsummaryrefslogtreecommitdiff
blob: c5be18151353df5d8cd825cfe246872612a81c62 (plain)
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
<def tag="view" for="QuestionContentText">
  <%raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}" unless can_view?%>
  <div>
    <%= this.content.to_html%>
  </div>
</def>

<def tag="view" for="QuestionContentMultipleChoice">
  <%raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}" unless can_view?%>
  <%= this.content.to_html %>
  <ul>
    <repeat:options>
      <li><%= h this.content%></li>
    </repeat>
  </ul>
</def>

<def tag="view" for="RichTypes::CheckList">
  <%raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}" unless can_view?%>
  <input disabled/>
</def>

<def tag="view" for="QuestionContentEmail">
  <%=
    if this.viewable_by?(current_user, :req_text)
      "#{h(this.req_text).sub("\n", "<br/>\n")}<br/>"
    else
      raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}"
    end
  %>

  <%=
    if this.viewable_by?(current_user, :description)
      "#{this.description.to_html}"
    else
      raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}"
    end
  %>

  <if test="&current_user.signed_up?">
    Your answer should have subject (without quotes) "<%= "#{this.question.id}-#{current_user.token}" %>".
  </if>
</def>