summaryrefslogtreecommitdiffstats
path: root/extensions/TrackingFlags/template/en/default/hook/bug/create/create-form.html.tmpl
blob: c027c6b7f1aade0ad93c543ef6fec43a61fb748e (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.
  #%]

[% RETURN UNLESS tracking_flag_components %]

<script type="text/javascript">
  $(function() {
    var tracking_flag_components = [% tracking_flag_components FILTER none %];
    var highest_status_firefox = '[% highest_status_firefox FILTER js %]';

    $('#component')
      .click(function() {
        // First, we disable all flags.
        $('table.tracking_flags select').attr('disabled', true);
        // Now enable flags available for the selected component.
        var component = $('#component').val();
        if (!component || !tracking_flag_components[component])
          return;
        $.each(tracking_flag_components[component], function(i, v) {
          $('#' + v).attr('disabled', false);
        });
      }).click();

  [% IF highest_status_firefox %]
    $('#version, #bug_status')
      .change(function() {
        var version = $('#version').val();
        if ($('#bug_status').val() != 'UNCONFIRMED'
            && (
              version.toLowerCase() == 'trunk'
              || version == highest_status_firefox + ' Branch'
              || version == 'Firefox ' + highest_status_firefox
            ))
        {
          $('#cf_status_firefox' + highest_status_firefox).val('affected');
        }
        else {
          $('#cf_status_firefox' + highest_status_firefox).val('---');
        }
      }).change();
  [% END %]
  });
</script>