summaryrefslogtreecommitdiffstats
path: root/extensions/Review/template/en/default/hook/global/header-start.html.tmpl
blob: ff166ac4c97586113d2a33521d0bd5ad2ebffaee (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
[%# 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.
  #%]

[% IF user.review_request_count
      || user.feedback_request_count
      || user.needinfo_request_count
%]
  [% style_urls.push('extensions/Review/web/styles/badge.css') %]
[% END %]

[% RETURN UNLESS template.name == 'attachment/edit.html.tmpl'
      || template.name == 'attachment/create.html.tmpl'
      || template.name == 'attachment/diff-header.html.tmpl'
      || template.name == 'bug/create/create.html.tmpl'
      || template.name == 'pages/splinter.html.tmpl' %]

[% style_urls.push('extensions/Review/web/styles/review.css') %]
[% javascript_urls.push('extensions/Review/web/js/review.js') %]

[% IF bug %]
  [%# create attachment %]
  [% mentors = bug.mentors %]
  [% product_obj = bug.product_obj %]
  [% component_obj = bug.component_obj %]
[% ELSIF attachment.bug %]
  [%# edit attachment %]
  [% mentors = attachment.bug.mentors %]
  [% product_obj = attachment.bug.product_obj %]
  [% component_obj = attachment.bug.component_obj %]
[% ELSE %]
  [%# create bug %]
  [% mentors = [] %]
  [% product_obj = product %]
  [% component_obj = 0 %]
[% END %]

[% review_js = BLOCK %]
  review_suggestions = {
    _mentors: [
      [% FOREACH u = mentors %]
        [% PROCESS reviewer %][% "," UNLESS loop.last %]
      [% END %]
    ],

    [% IF product_obj.reviewers %]
      _product: [
        [% FOREACH u = product_obj.reviewers_objs %]
          [% PROCESS reviewer %][% "," UNLESS loop.last %]
        [% END %]
      ],
    [% END %]

    [% IF component_obj %]
      [%# single component (create/edit attachment) %]
      '[% component_obj.name FILTER js %]': [
        [% FOREACH u = component_obj.reviewers_objs %]
          [% PROCESS reviewer %][% "," UNLESS loop.last %]
        [% END %]
      ],
    [% ELSE %]
      [%# all components (create bug) %]
      [% FOREACH c = product_obj.components %]
        [% NEXT UNLESS c.reviewers %]
        '[% c.name FILTER js %]': [
          [% FOREACH u = c.reviewers_objs %]
            [% PROCESS reviewer %][% "," UNLESS loop.last %]
          [% END %]
        ],
      [% END %]
    [% END %]

    [%# to keep IE happy, no trailing commas %]
    _end: 1
  };

  [% IF component_obj %]
    static_component = '[% component_obj.name FILTER js %]';
  [% ELSE %]
    static_component = false;
  [% END %]
[% END %]
[% javascript = javascript _ review_js %]

[% BLOCK reviewer %]
  { login: '[% u.login FILTER js%]', identity: '[% u.identity FILTER js %]', review_count: [% u.review_count FILTER js %] }
[% END %]