summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/template/en/default/bug_modal/flags.html.tmpl
blob: 3e0da1173ba4b7a7b705abbaa5df311f29800099 (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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[%#
  # types: array of flag_type objects
  # no_label: if set to a true value, flag name and status will not be outputted (default: false)
  # view_only: if true, don't output edit ui (default: false)
  #%]

[% IF view_only %]
  <div class="flags edit-hide">
    [% FOREACH type IN types %]
      [% FOREACH flag IN type.flags %]
        <div class="flag">
          [% INCLUDE bug_modal/user.html.tmpl u=flag.requestee nick_only=1 %]
          [% activity_id = bug.find_activity_id_for_flag(flag) %]
          [% IF activity_id %]
            <a href="#[% activity_id FILTER none %]"
          [% ELSE %]
            <span
          [% END %]
            class="[% " activity-ref" IF activity_id %]"
          >
            [% INCLUDE bug_modal/rel_time.html.tmpl ts=flag.creation_date %]
          [% activity_id ? "</a>" : "</span>" %]
        </div>
      [% END %]
    [% END %]
  </div>
  [% RETURN %]
[% END %]

<div id="bug-flags" class="flags">
  <table class="layout-table">
  [%
    FOREACH type IN types;
      FOREACH flag IN type.flags;
        IF flag.requestee && flag.requestee.id == user.id;
          INCLUDE edit_flag t=type f=flag;
        ELSE;
        %]
          <tbody class="edit-hide">
            [% INCLUDE view_flag t=type f=flag %]
          </tbody>
          <tbody class="edit-show" style="display:none">
            [% INCLUDE edit_flag t=type f=flag %]
          </tbody>
        [%
        END;
      END;
    END;
  %]
    <tbody class="edit-show" style="display:none">
    [%
      FOREACH type IN types;
        NEXT IF !type.is_active || type.flags.size;
        INCLUDE edit_flag t=type;
      END;

      FOREACH type IN types;
        NEXT IF !type.is_active || !type.is_multiplicable;
        INCLUDE edit_flag t=type;
      END;
    %]
    </tbody>
  </table>
</div>

[% BLOCK view_flag %]
  <tr>
    <td class="flag-setter">
      [% INCLUDE bug_modal/user.html.tmpl u=f.setter nick_only=1 %]
    </td>

    <td class="flag-name">
      [% activity_id = bug.find_activity_id_for_flag(f) %]
      [% IF activity_id %]
        <a href="#[% activity_id FILTER none %]"
      [% ELSE %]
        <span
      [% END %]
        class="rel-time-title[% " activity-ref" IF activity_id %]"
        title="[% f.creation_date FILTER time_duration FILTER html %]"
        data-time="[% f.creation_date FILTER epoch FILTER none %]"
      >
        [% f.type.name FILTER html %]
      [% activity_id ? "</a>" : "</span>" %]
    </td>

    <td class="flag-value">
      [% f.status FILTER html %]
    </td>

    [% IF f.requestee %]
      <td class="flag-requestee">
        [% INCLUDE bug_modal/user.html.tmpl u=f.requestee nick_only=1 %]
      </td>
    [% END %]
  </tr>
[% END %]

[% BLOCK edit_flag %]
[%
  flag_id = f ? "flag-$f.id" : "flag_type-$t.id";
%]
  <tr>
    <td class="flag-setter">
      [% IF f %]
        [% INCLUDE bug_modal/user.html.tmpl u=f.setter nick_only=1 %]
      [% ELSIF t.flags.size %]
        addl.
      [% END %]
    </td>

    <td class="flag-name">
      <label title="[% t.description FILTER html %]" for="[% flag_id FILTER html %]">
        [%~ t.name FILTER html FILTER no_break ~%]
      </label>
    </td>

    <td class="flag-value">
      <input type="hidden" id="[% flag_id FILTER html %]-dirty">
      <select id="[% flag_id FILTER html %]" name="[% flag_id FILTER html %]"
        title="[% t.description FILTER html %]"
        [% UNLESS (t.is_requestable && user.can_request_flag(t)) || user.can_set_flag(t) %]
          disabled
        [% END %]
        class="bug-flag">
        [% IF !f || (user.can_request_flag(t)) || f.setter_id == user.id %]
          <option value="X"></option>
        [% END %]
        [% IF t.is_active %]
          [% IF (t.is_requestable && user.can_request_flag(t)) || (f && f.status == "?") %]
            <option value="?" [% "selected" IF f && f.status == "?" %]>?</option>
          [% END %]
          [% IF user.can_set_flag(t) || (f && f.status == "+") %]
            <option value="+" [% "selected" IF f && f.status == "+" %]>+</option>
          [% END %]
          [% IF user.can_set_flag(t) || (f && f.status == "-") %]
            <option value="-" [% "selected" IF f && f.status == "-" %]>-</option>
          [% END %]
        [% ELSE %]
          <option value="[% f.status FILTER html %]" selected>[% f.status FILTER html %]</option>
        [% END %]
      </select>
    </td>

    [% IF (t.is_requestable && t.is_requesteeble) || (f && f.requestee) %]
      <td class="flag-requestee">
        [% flag_name = f ? "requestee-$f.id" : "requestee_type-$t.id" %]
        <div id="[% flag_name FILTER none %]-container"
            [% UNLESS f && f.requestee +%] style="display:none"[% END %]>
          [%
            flag_requestee = (f && f.requestee) ? f.requestee.login : '';
            flag_multiple  = f ? 0 : t.is_multiplicable * 3;
            flag_empty_ok  = f ? 1 : !t.is_multiplicable;
            INCLUDE global/userselect.html.tmpl
              name     = flag_name
              id       = flag_name
              value    = flag_requestee
              emptyok  = flag_empty_ok
              classes  = [ "requestee" ]
          %]
        </div>
      <td>
    [% END %]

  </tr>
[% END %]