Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
42d5e455
Commit
42d5e455
authored
Oct 14, 2014
by
Koosha KM
Committed by
David Lawrence
Oct 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1059723: Reply button should become AJAX-based
r=dkl,a=sgreen
parent
847191ac
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
6 deletions
+89
-6
Markdown.pm
Bugzilla/Markdown.pm
+31
-1
Template.pm
Bugzilla/Template.pm
+4
-2
global.css
skins/standard/global.css
+9
-0
comments.html.tmpl
template/en/default/bug/comments.html.tmpl
+45
-3
No files found.
Bugzilla/Markdown.pm
View file @
42d5e455
...
...
@@ -75,7 +75,7 @@ sub _Markdown {
my
$self
=
shift
;
my
$text
=
shift
;
$text
=
Bugzilla::Template::
quoteUrls
(
$text
);
$text
=
Bugzilla::Template::
quoteUrls
(
$text
,
undef
,
undef
,
undef
,
undef
,
1
);
return
$self
->
SUPER::
_Markdown
(
$text
,
@_
);
}
...
...
@@ -392,6 +392,36 @@ sub _DoCodeBlocks {
return
$text
;
}
sub
_DoBlockQuotes
{
my
(
$self
,
$text
)
=
@_
;
$text
=~
s{
( # Wrap whole match in $1
(?:
^[ \t]*>[ \t]? # '>' at the start of a line
.+\n # rest of the first line
(?:.+\n)* # subsequent consecutive lines
\n* # blanks
)+
)
}{
my $bq = $1;
$bq =~ s/^[ \t]*>[ \t]?//gm; # trim one level of quoting
$bq =~ s/^[ \t]+$//mg; # trim whitespace-only lines
$bq = $self->_RunBlockGamut($bq, {wrap_in_p_tags => 1}
);
# recurse
$bq
=~
s/^/ /mg
;
# These leading spaces screw with <pre> content, so we need to fix that:
$bq
=~
s{(\s*<pre>.+?</pre>)}{
my $pre = $1;
$pre =~ s/^ //mg;
$pre;
}egs
;
"<blockquote>\n$bq\n</blockquote>\n\n"
;
}
egmx
;
return
$text
;
}
sub
_EncodeCode
{
my
(
$self
,
$text
)
=
@_
;
...
...
Bugzilla/Template.pm
View file @
42d5e455
...
...
@@ -148,10 +148,11 @@ sub get_format {
# If you want to modify this routine, read the comments carefully
sub
quoteUrls
{
my
(
$text
,
$bug
,
$comment
,
$user
,
$bug_link_func
)
=
@_
;
my
(
$text
,
$bug
,
$comment
,
$user
,
$bug_link_func
,
$for_markdown
)
=
@_
;
return
$text
unless
$text
;
$user
||=
Bugzilla
->
user
;
$bug_link_func
||=
\&
get_bug_link
;
$for_markdown
||=
0
;
# We use /g for speed, but uris can have other things inside them
# (http://foo/bug#3 for example). Filtering that out filters valid
...
...
@@ -222,10 +223,11 @@ sub quoteUrls {
$text
=
html_quote
(
$text
);
unless
(
$for_markdown
)
{
# Color quoted text
$text
=~
s
~^
(
&
gt
;
.+
)
$~
<
span
class
=
"quote"
>
$1
</
span
>~
mg
;
$text
=~
s
~</
span
>\
n
<
span
class
=
"quote"
>~\
n
~
g
;
}
# mailto:
# Use |<nothing> so that $1 is defined regardless
# @ is the encoded '@' character.
...
...
skins/standard/global.css
View file @
42d5e455
...
...
@@ -243,6 +243,15 @@
textarea
{
font-family
:
monospace
;
}
blockquote
{
border-left
:
0.2em
solid
#CCC
;
color
:
#65379C
;
padding
:
0
;
margin-left
:
0.5em
;
margin-bottom
:
-1em
;
white-space
:
pre
;
}
/* generic (end) */
/* Links that control whether or not something is visible. */
...
...
template/en/default/bug/comments.html.tmpl
View file @
42d5e455
...
...
@@ -14,13 +14,16 @@
<script type="text/javascript">
<!--
/* Adds the reply text to the 'comment' textarea */
function replyToComment(id, real_id, name) {
function replyToComment(id, real_id, name
, text
) {
var prefix = "(In reply to " + name + " from comment #" + id + ")\n";
var replytext = "";
[% IF user.settings.quote_replies.value == 'quoted_reply' %]
/* pre id="comment_name_N" */
if (text == null) {
var text_elem = document.getElementById('comment_text_'+id);
var text = getText(text_elem);
text = getText(text_elem);
}
replytext = prefix + wrapReplyText(text);
[% ELSIF user.settings.quote_replies.value == 'simple_reply' %]
replytext = prefix;
...
...
@@ -41,6 +44,39 @@
textarea.focus();
}
function replyToMarkdownComment(id, real_id, name) {
var textarea = document.getElementById('comment');
var comment = textarea.value;
textarea.value += "Fetching comment...";
YAHOO.util.Connect.setDefaultPostHeader('application/json', true);
YAHOO.util.Connect.asyncRequest('POST', 'jsonrpc.cgi',
{
success: function(res) {
var data = YAHOO.lang.JSON.parse(res.responseText);
if (!data.error) {
textarea.value = comment;
var text = data.result.comments[real_id].text;
replyToComment(id, real_id, name, text);
} else {
replyToComment(id, real_id, name, null);
}
},
failure: function(res) {
/* On failure, quote the comment as plain-text */
replyToComment(id, real_id, name, null);
}
},
YAHOO.lang.JSON.stringify({
version: "1.1",
method: "Bug.comments",
params: {
Bugzilla_api_token: BUGZILLA.api_token,
comment_ids: [real_id],
}
})
);
}
//-->
</script>
...
...
@@ -126,7 +162,13 @@
[% END %]
[<a class="bz_reply_link" href="#add_comment"
[% IF user.settings.quote_replies.value != 'off' %]
onclick="replyToComment('[% comment.count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER html FILTER js %]'); return false;"
onclick="
[% IF feature_enabled('jsonrpc') && comment.is_markdown %]
replyToMarkdownComment('[% comment.count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER html FILTER js %]'); return false;"
[% ELSE %]
replyToComment('[% comment.count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER html FILTER js %]', null); return false;"
[% END %]
[% END %]
>reply</a>]
[% END %]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment