summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/template/en/default/bug_modal/tracking_flags.html.tmpl
blob: 5f22338cddd07d52a1a6b255eab2b73135857e63 (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
[%# 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.
  #%]

[%#
  # type: tracking flag type (eg. "project", "tracking")
  #%]

[%
  flags = [];
  set_flags = [];
  FOREACH flag IN tracking_flags;
    NEXT UNLESS flag.flag_type == type;
    flags.push(flag);
    NEXT IF flag.bug_flag(bug.id).value == "---";
    set_flags.push(flag);
  END;
  RETURN UNLESS flags.size;
%]

[%# view %]
[% IF set_flags.size %]
  <div class="flags edit-hide">
    <table class="layout-table tracking-flags">
      [% IF type == "tracking" %]
        <tr>
          <th></th>
          <th>Tracking</th>
          <th>Status</th>
        </tr>
      [% END %]
      [% FOREACH row IN tracking_flags_table %]
        [%
          NEXT UNLESS row.type == type;
          tracking_value = row.tracking.bug_flag(bug_id).value || "---";
          status_value = row.status.bug_flag(bug_id).value || "---";
          NEXT IF tracking_value == "---" && status_value == "---";
        %]
        <tr>
          <td class="tracking-flag-name">[% row.name FILTER html %]</td>
          [% IF type == "tracking" %]
            <td class="tracking-flag-tracking">[% tracking_value FILTER html %]</td>
          [% END %]
          <td class="tracking-flag-status">[% status_value FILTER html %]</td>
        </tr>
      [% END %]
    </table>
  </div>
[% END %]

[%# edit %]
<div class="flags edit-show" style="display:none">
  <table class="layout-table tracking-flags">
    [% IF type == "tracking" %]
      <tr>
        <th></th>
        <th>Tracking</th>
        <th>Status</th>
      </tr>
    [% END %]
    [% FOREACH row IN tracking_flags_table %]
      [% NEXT UNLESS row.type == type %]
      <tr>
        <td class="tracking-flag-name">[% row.name FILTER html %]</td>
        [% IF type == "tracking" %]
          <td class="tracking-flag-tracking">[% INCLUDE tf_select flag=row.tracking %]</td>
        [% END %]
        <td class="tracking-flag-status">[% INCLUDE tf_select flag=row.status %]</td>
      </tr>
    [% END %]
  </table>
</div>

[% BLOCK tf_select %]
  [% RETURN UNLESS flag %]
  <select id="[% flag.name FILTER html %]" name="[% flag.name FILTER html %]">
    [%
      flag_bug_value = flag.bug_flag(bug_id).value;
      FOREACH value IN flag.values;
        IF value.name != flag_bug_value;
          NEXT IF !value.is_active || !flag.can_set_value(value.name);
        END;
    %]
        <option value="[% value.name FILTER html %]"
          id="v[% value.id FILTER html %]_[% flag.name FILTER html %]"
          [% " selected" IF flag_bug_value == value.name %]
        >
          [% value.name FILTER html %]
        </option>
    [% END %]
  </select>
[% END %]