summaryrefslogtreecommitdiffstats
path: root/extensions/Splinter
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-05-15 17:34:22 +0200
committerByron Jones <bjones@mozilla.com>2013-05-15 17:34:22 +0200
commite7c1850247b48e8446c144d835fe6a4a1a67d9c3 (patch)
treecb53657ceea66d60f99525aed26a97299531ffa3 /extensions/Splinter
parentb29e02fc461d92a33679a3d7d1407d14185cb7f5 (diff)
downloadbugzilla-e7c1850247b48e8446c144d835fe6a4a1a67d9c3.tar.gz
bugzilla-e7c1850247b48e8446c144d835fe6a4a1a67d9c3.tar.xz
Bug 821889: Make it so that Splinter shouts loudly when a patch introduces Windows line endings
Diffstat (limited to 'extensions/Splinter')
-rw-r--r--extensions/Splinter/Extension.pm1
-rw-r--r--extensions/Splinter/template/en/default/pages/splinter.html.tmpl3
-rw-r--r--extensions/Splinter/web/splinter.css2
-rw-r--r--extensions/Splinter/web/splinter.js10
4 files changed, 11 insertions, 5 deletions
diff --git a/extensions/Splinter/Extension.pm b/extensions/Splinter/Extension.pm
index ecf61ea9a..eef9e89af 100644
--- a/extensions/Splinter/Extension.pm
+++ b/extensions/Splinter/Extension.pm
@@ -76,6 +76,7 @@ sub page_before_template {
$vars->{'attach_id'} = $attachment->id;
$vars->{'attach_data'} = $attachment->data;
+ $vars->{'attach_is_crlf'} = $attachment->{data} =~ /\012\015/ ? 1 : 0;
}
my $field_object = new Bugzilla::Field({ name => 'attachments.status' });
diff --git a/extensions/Splinter/template/en/default/pages/splinter.html.tmpl b/extensions/Splinter/template/en/default/pages/splinter.html.tmpl
index fc4748548..fa6fd8316 100644
--- a/extensions/Splinter/template/en/default/pages/splinter.html.tmpl
+++ b/extensions/Splinter/template/en/default/pages/splinter.html.tmpl
@@ -99,6 +99,7 @@
attachment.isPatch = [% attachment.ispatch ? 1 : 0 %];
attachment.isObsolete = [% attachment.isobsolete ? 1 : 0 %];
attachment.isPrivate = [% attachment.isprivate ? 1 : 0 %];
+ attachment.isCRLF = [% attach_is_crlf FILTER none %];
theBug.attachments.push(attachment);
[% END %]
@@ -129,7 +130,7 @@
</div>
<div id="attachInfo" style="display:none;">
- <span id="attachObsolete"></span>
+ <span id="attachWarning"></span>
<b>Attachment <a id="attachLink"><span id="attachId"></span></a>:</b>
<span id="attachDesc"></span> -
<span id="attachCreator"></span> -
diff --git a/extensions/Splinter/web/splinter.css b/extensions/Splinter/web/splinter.css
index e43dff8fa..7e27372b3 100644
--- a/extensions/Splinter/web/splinter.css
+++ b/extensions/Splinter/web/splinter.css
@@ -34,7 +34,7 @@ textarea:focus {
margin-bottom: 1em;
}
-#attachObsolete {
+#attachWarning {
font-weight: bold;
color: #c00000;
}
diff --git a/extensions/Splinter/web/splinter.js b/extensions/Splinter/web/splinter.js
index a3220a158..b43ad0736 100644
--- a/extensions/Splinter/web/splinter.js
+++ b/extensions/Splinter/web/splinter.js
@@ -2620,9 +2620,13 @@ Splinter.init = function () {
Dom.get("attachCreator").appendChild(document.createTextNode(Splinter.Bug._formatWho(Splinter.theAttachment.whoName,
Splinter.theAttachment.whoEmail)));
Dom.get("attachDate").innerHTML = Splinter.Utils.formatDate(Splinter.theAttachment.date);
- if (Splinter.theAttachment.isObsolete) {
- Dom.get("attachObsolete").innerHTML = 'OBSOLETE';
- }
+ var warnings = [];
+ if (Splinter.theAttachment.isObsolete)
+ warnings.push('OBSOLETE');
+ if (Splinter.theAttachment.isCRLF)
+ warnings.push('WINDOWS PATCH');
+ if (warnings.length > 0)
+ Dom.get("attachWarning").innerHTML = warnings.join(', ');
Dom.setStyle('attachInfo', 'display', 'block');
Dom.setStyle('quickHelpShow', 'display', 'block');