summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/template/en/default/hook/bug/edit-after_op_sys.html.tmpl
blob: ff7740f932cc12a802c746674d3a2b21a96f2de8 (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
[%# 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.
  #%]

[%# because the "from reporter" button adds likely unnecessary noise to a bug,
  # we only show it on unconfirmed or untriaged bugs %]
[%
  RETURN UNLESS
    (bug.status.value == "UNCONFIRMED" || bug.component == "Untriaged")
    && bug.check_can_change_field('op_sys', 0, 1);
  hw_os = bug.reporters_hw_os;
  RETURN UNLESS hw_os.size;
  RETURN IF bug.rep_platform == hw_os.0 && bug.op_sys == hw_os.1;

  title = "Set platform to reporter's: " _ hw_os.0 _ " / " _ hw_os.1;
%]

[%
  IF bug_modal;
    INCLUDE modal;
  ELSE;
    INCLUDE classic;
  END;
%]

[% BLOCK classic %]
  <span id="rep_hw_os">
    (<a href="javascript:void(0)" title="[% title FILTER html %]" id="rep_hw_os">from reporter</a>)
  </span>
[% END %]

[% BLOCK modal %]
  <button id="rep_hw_os" type="button" class="minor" title="[% title FILTER html %]">
    From&nbsp;Reporter
  </button>
[% END %]

<script [% script_nonce FILTER none %] type="text/javascript">
  $('#rep_hw_os').click(function() {
    $('#rep_platform').val('[% hw_os.0 FILTER js FILTER html %]');
    $('#op_sys').val('[% hw_os.1 FILTER js FILTER html %]');
    $('#rep_hw_os').hide();
  });
</script>