diff options
author | Byron Jones <glob@mozilla.com> | 2016-03-23 04:25:52 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2016-03-23 04:25:52 +0100 |
commit | 74c6f9974fddc33163ae78c5927c6569f2eb28c0 (patch) | |
tree | a1ffee4e352dafa5b1709fb392bee7c4d69dafec /template/en | |
parent | 0c94e1dd07b705ba000c008b08c8f5aa27731932 (diff) | |
download | bugzilla-74c6f9974fddc33163ae78c5927c6569f2eb28c0.tar.gz bugzilla-74c6f9974fddc33163ae78c5927c6569f2eb28c0.tar.xz |
Bug 1251236 - Please show the diff on the attachment details page when a patch has been reviewed in MozReview
Diffstat (limited to 'template/en')
-rw-r--r-- | template/en/default/attachment/edit.html.tmpl | 135 |
1 files changed, 70 insertions, 65 deletions
diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl index 8dc29c1e6..c7d85e270 100644 --- a/template/en/default/attachment/edit.html.tmpl +++ b/template/en/default/attachment/edit.html.tmpl @@ -175,73 +175,78 @@ </b></p> </div> [% ELSIF attachment.is_viewable %] - <div> - [% INCLUDE global/textarea.html.tmpl - id = 'editFrame' - name = 'comment' - classes = 'bz_default_hidden' - minrows = 10 - cols = 80 - wrap = 'soft' - disabled = 'disabled' - defaultcontent = (attachment.contenttype.match('^text\/')) ? - attachment.data.replace('(.*\n|.+)', '>$1') : undef - %] - [% IF attachment.contenttype == 'text/plain' AND is_safe_url(attachment.data) %] - <p> - <a href="[% attachment.data FILTER html %]"> - [% IF attachment.datasize < 120 %] - [% attachment.data FILTER html %] - [% ELSE %] - [% attachment.data FILTER truncate(80) FILTER html %] - ... - [% attachment.data.match('.*(.{20})$').0 FILTER html %] - [% END %] - </a> - </p> - [% ELSIF attachment.contenttype == "text/html" %] - [%# For security reasons (clickjacking, embedded scripts), we never - # render HTML pages from here. The source code is displayed instead. %] + [%# to override attachment viewing, hook edit-view and set custom_attachment_viewer to 1 %] + [% custom_attachment_viewer = 0 %] + [% Hook.process('view') %] + [% UNLESS custom_attachment_viewer %] + <div> [% INCLUDE global/textarea.html.tmpl - id = 'viewFrame' - minrows = 10 - cols = 80 - defaultcontent = attachment.data - readonly = 'readonly' + id = 'editFrame' + name = 'comment' + classes = 'bz_default_hidden' + minrows = 10 + cols = 80 + wrap = 'soft' + disabled = 'disabled' + defaultcontent = (attachment.contenttype.match('^text\/')) ? + attachment.data.replace('(.*\n|.+)', '>$1') : undef %] - [% ELSE %] - <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %] - [%- "&content_type=text/plain" IF attachment.contenttype.match('^text/x-') %]"> - <b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs. - <a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b> - </iframe> - [% END %] - <script type="text/javascript"> - <!-- - var patchviewerinstalled = 0; - var attachment_id = [% attachment.id %]; - if (typeof document.getElementById == "function") { - [% IF use_patchviewer %] - var patchviewerinstalled = 1; - document.write('<iframe id="viewDiffFrame" class="bz_default_hidden"><\/iframe>'); - [% END %] - [% IF user.id %] - document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Edit Attachment As Comment<\/button>'); - document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Undo Edit As Comment<\/button>'); - document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Redo Edit As Comment<\/button>'); - var editFrame = document.getElementById('editFrame'); - if (editFrame) { - editFrame.disabled = false; - } - [% END %] - [% IF use_patchviewer %] - document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">View Attachment As Diff<\/button>'); - [% END %] - document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" class="bz_default_hidden">View Attachment As Raw<\/button>'); - } - //--> - </script> - </div> + [% IF attachment.contenttype == 'text/plain' AND is_safe_url(attachment.data) %] + <p> + <a href="[% attachment.data FILTER html %]"> + [% IF attachment.datasize < 120 %] + [% attachment.data FILTER html %] + [% ELSE %] + [% attachment.data FILTER truncate(80) FILTER html %] + ... + [% attachment.data.match('.*(.{20})$').0 FILTER html %] + [% END %] + </a> + </p> + [% ELSIF attachment.contenttype == "text/html" %] + [%# For security reasons (clickjacking, embedded scripts), we never + # render HTML pages from here. The source code is displayed instead. %] + [% INCLUDE global/textarea.html.tmpl + id = 'viewFrame' + minrows = 10 + cols = 80 + defaultcontent = attachment.data + readonly = 'readonly' + %] + [% ELSE %] + <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %] + [%- "&content_type=text/plain" IF attachment.contenttype.match('^text/x-') %]"> + <b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs. + <a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b> + </iframe> + [% END %] + <script type="text/javascript"> + <!-- + var patchviewerinstalled = 0; + var attachment_id = [% attachment.id %]; + if (typeof document.getElementById == "function") { + [% IF use_patchviewer %] + var patchviewerinstalled = 1; + document.write('<iframe id="viewDiffFrame" class="bz_default_hidden"><\/iframe>'); + [% END %] + [% IF user.id %] + document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Edit Attachment As Comment<\/button>'); + document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Undo Edit As Comment<\/button>'); + document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Redo Edit As Comment<\/button>'); + var editFrame = document.getElementById('editFrame'); + if (editFrame) { + editFrame.disabled = false; + } + [% END %] + [% IF use_patchviewer %] + document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">View Attachment As Diff<\/button>'); + [% END %] + document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" class="bz_default_hidden">View Attachment As Raw<\/button>'); + } + //--> + </script> + </div> + [% END %] [% ELSE %] <div id="noview"> <p><b> |