You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/12/12 16:32:22 UTC
[1/5] allura git commit: [#8263] Add reaction indicator near the
comment box
Repository: allura
Updated Branches:
refs/heads/master 411553677 -> c680776c1
[#8263] Add reaction indicator near the comment box
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c680776c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c680776c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c680776c
Branch: refs/heads/master
Commit: c680776c1336bdac3fc6fa2f6272be23ca677d1b
Parents: 3e52528
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Tue Dec 11 13:26:57 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Dec 12 16:32:04 2018 +0000
----------------------------------------------------------------------
.../lib/widgets/resources/js/reactions.js | 40 +++++++++++---------
Allura/allura/nf/allura/css/site_style.css | 19 ++++++++++
.../allura/templates/widgets/post_widget.html | 7 ++--
3 files changed, 44 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/c680776c/Allura/allura/lib/widgets/resources/js/reactions.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/reactions.js b/Allura/allura/lib/widgets/resources/js/reactions.js
index dc880a6..a889e7d 100644
--- a/Allura/allura/lib/widgets/resources/js/reactions.js
+++ b/Allura/allura/lib/widgets/resources/js/reactions.js
@@ -67,24 +67,28 @@ $('.reaction-button').each(function() {
});
function reactComment(btn ,r) {
-var reacts_list = btn.closest('.post-content').find('.reactions');
-$.ajax({
- type: 'post',
- url: btn.data('commentlink') + 'post_reaction',
- data: {
- 'r' : r,
- '_session_id' : $.cookie('_session_id')
- },
- success: function(res) {
- var react_html = '';
+ var reacts_list = btn.closest('.post-content').find('.reactions');
+ var currentemoji = $(btn).data('currentreact');
+ $.ajax({
+ type: 'post',
+ url: btn.data('commentlink') + 'post_reaction',
+ data: {
+ 'r' : r,
+ '_session_id' : $.cookie('_session_id')
+ },
+ success: function(res) {
+ var react_html = '';
- for (var i in res.counts) {
- react_html += '<span>' + global_reactions[i] + '</span> ' + res.counts[i];
+ for (var i in res.counts) {
+ react_html += '<div class="reaction' + (currentemoji == i ? ' reaction-current' : '') + '">' +
+ '<div class="emoj">' + global_reactions[i] +'</div>' +
+ '<div class="emoj-count">' + res.counts[i] + '</div>' +
+ '</div>';
+ }
+
+ reacts_list.html(react_html);
+ twemoji.parse(reacts_list[0]);
+ btn.tooltipster('hide');
}
-
- reacts_list.html(react_html);
- twemoji.parse(reacts_list[0]);
- btn.tooltipster('hide');
- }
-});
+ });
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/allura/blob/c680776c/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 503f54b..6c7db3b 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2539,6 +2539,25 @@ div.attachment_item{
padding: 5px;
}
+#comment .display_post .reactions .reaction {
+ display: inline-block;
+ padding: 2px;
+}
+
+#comment .display_post .reactions .reaction-current {
+ background-color: rgb(240,240,240);
+ border-radius: 2px;
+}
+#comment .display_post .reactions .reaction .emoj {
+ display: inline-block;
+}
+
+#comment .display_post .reactions .reaction .emoj-count {
+ display: inline-block;
+ font-size: 11px;
+ margin-left: 3px;
+}
+
#comment ul {
list-style: none;
margin: 0 0 0 0;
http://git-wip-us.apache.org/repos/asf/allura/blob/c680776c/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index f4504b4..bcca961 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -50,13 +50,14 @@
</div>
{% set pending = value.status == 'pending' %}
{% set moderator = h.has_access(value, 'moderator')() %}
+ {% set current_reaction = h.get_current_reaction(value.react_users) %}
<div class="grid-16 post-content bubble" style="width: {{indent == 0 and 652 or (indent <= 40 and 642-indent*10 or 65)}}px; {% if indent != 0 %} margin-right:0px {% endif %}">
<div class="header">
{{lib.user_link(value.author())}} - <i style="color: #777">{{lib.abbr_date(value.timestamp)}}</i>
<div class="tools">
{% if not c.user.is_anonymous() %}
- <a href="#" id="react_{{value.slug.replace('/','_')}}" data-commentlink="{{value.url()}}" data-currentreact="{{ h.get_current_reaction(value.react_users) }}" class="reaction-button icon btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"{%if value.status == 'pending'%} style="display:none"{%endif%}>
+ <a href="#" id="react_{{value.slug.replace('/','_')}}" data-commentlink="{{value.url()}}" data-currentreact="{{ current_reaction }}" class="reaction-button icon btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"{%if value.status == 'pending'%} style="display:none"{%endif%}>
<span><i class="fa fa-smile-o" aria-hidden="true"></i></span></a>
{% endif %}
{% if (h.has_access(value.thread, 'post')() and value.status == 'ok') or moderator %}
@@ -84,9 +85,7 @@
<div{% if h.has_access(value, 'moderate') %} class="active-md" data-markdownlink="{{value.url()}}" {% endif %}>{{g.markdown.cached_convert(value, 'text')|safe}}</div>
<div class='reactions' style='user-select: none; cursor: default'>
- {% for reaction in value.react_counts %}
- <span>{{ h.emojize(reaction) }}</span> {{ value.react_counts[reaction] }}
- {% endfor %}
+ {% for reaction in value.react_counts %}<div class="reaction{% if current_reaction == reaction %} reaction-current{% endif %}"><div class="emoj">{{ h.emojize(reaction) }}</div><div class="emoj-count">{{ value.react_counts[reaction] }}</div></div>{% endfor %}
</div>
{{lib.related_artifacts(value)}}
{% if value.edit_count %}
[4/5] allura git commit: [#8263] Move methods from app_globals to
helpers
Posted by br...@apache.org.
[#8263] Move methods from app_globals to helpers
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/3e525285
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3e525285
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3e525285
Branch: refs/heads/master
Commit: 3e525285cf1e58efab2504dd5b503d5b10034436
Parents: 40c302d
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Tue Dec 11 13:24:40 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Dec 12 16:32:04 2018 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 9 ---------
Allura/allura/lib/helpers.py | 11 +++++++++++
Allura/allura/lib/utils.py | 4 ++--
Allura/allura/templates/widgets/post_widget.html | 4 ++--
4 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/3e525285/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 6856245..58d5b0e 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -34,7 +34,6 @@ import traceback
import activitystream
import pkg_resources
import markdown
-import emoji
import pygments
import pygments.lexers
import pygments.formatters
@@ -615,14 +614,6 @@ class Globals(object):
"image_height": logo['image_height']
}
- def emojize(self, text):
- """Coverts emoji codes to unicode emojis"""
- return emoji.emojize(text, use_aliases=True)
-
- def get_current_reaction(self, d):
- """Return current selected reaction for given react_users dict"""
- return utils.get_key_from_value(d, c.user.username)
-
class Icon(object):
http://git-wip-us.apache.org/repos/asf/allura/blob/3e525285/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index bbf36e4..70c768f 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -39,6 +39,7 @@ from functools import partial
from cStringIO import StringIO
import cgi
+import emoji
import tg
import genshi.template
try:
@@ -1338,3 +1339,13 @@ def hide_private_info(message):
return email_re.sub(r'\1@...', message)
else:
return message
+
+
+def emojize(text):
+ """Coverts emoji codes to unicode emojis"""
+ return emoji.emojize(text, use_aliases=True)
+
+
+def get_current_reaction(react_users_dict):
+ """Return current selected reaction for given react_users dict"""
+ return utils.get_key_from_value(react_users_dict, c.user.username)
http://git-wip-us.apache.org/repos/asf/allura/blob/3e525285/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index dbc83c9..e07323c 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -30,9 +30,9 @@ import magic
from itertools import groupby
import operator as op
import collections
-import emoji
import tg
+import emoji
import pylons
import json
from formencode import Invalid
@@ -783,7 +783,7 @@ def get_reactions_json():
""" Returns global reactions json """
j = OrderedDict()
for em in get_reaction_emoji_list():
- j[em] = pylons.app_globals.emojize(em)
+ j[em] = emoji.emojize(em, use_aliases=True)
return json.dumps(j)
http://git-wip-us.apache.org/repos/asf/allura/blob/3e525285/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index c65768e..f4504b4 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -56,7 +56,7 @@
<div class="tools">
{% if not c.user.is_anonymous() %}
- <a href="#" id="react_{{value.slug.replace('/','_')}}" data-commentlink="{{value.url()}}" data-currentreact="{{ g.get_current_reaction(value.react_users) }}" class="reaction-button icon btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"{%if value.status == 'pending'%} style="display:none"{%endif%}>
+ <a href="#" id="react_{{value.slug.replace('/','_')}}" data-commentlink="{{value.url()}}" data-currentreact="{{ h.get_current_reaction(value.react_users) }}" class="reaction-button icon btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"{%if value.status == 'pending'%} style="display:none"{%endif%}>
<span><i class="fa fa-smile-o" aria-hidden="true"></i></span></a>
{% endif %}
{% if (h.has_access(value.thread, 'post')() and value.status == 'ok') or moderator %}
@@ -85,7 +85,7 @@
<div{% if h.has_access(value, 'moderate') %} class="active-md" data-markdownlink="{{value.url()}}" {% endif %}>{{g.markdown.cached_convert(value, 'text')|safe}}</div>
<div class='reactions' style='user-select: none; cursor: default'>
{% for reaction in value.react_counts %}
- <span>{{ g.emojize(reaction) }}</span> {{ value.react_counts[reaction] }}
+ <span>{{ h.emojize(reaction) }}</span> {{ value.react_counts[reaction] }}
{% endfor %}
</div>
{{lib.related_artifacts(value)}}
[2/5] allura git commit: [#8263] Fix div resizing issue
Posted by br...@apache.org.
[#8263] Fix div resizing issue
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/40c302d5
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/40c302d5
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/40c302d5
Branch: refs/heads/master
Commit: 40c302d5ccda254c903b95e74592e4cc3f8764b7
Parents: e9ca812
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Nov 28 09:56:50 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Dec 12 16:32:04 2018 +0000
----------------------------------------------------------------------
Allura/allura/nf/allura/css/site_style.css | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/40c302d5/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index aed30d8..503f54b 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3812,8 +3812,9 @@ fieldset.preferences legend {
.post-reactions-list .emoji_button {
padding: 1px 2px 1px 2px;
- margin-left: 2px;
+ margin-left: 1px;
display: inline-block;
+ border: transparent solid 1px;
}
.post-reactions-list .current {
[5/5] allura git commit: [#8263] Add styles for current reaction
indication
Posted by br...@apache.org.
[#8263] Add styles for current reaction indication
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e9ca8128
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e9ca8128
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e9ca8128
Branch: refs/heads/master
Commit: e9ca812838a8f13dbd77528c6d1168e672249c67
Parents: 2d72026
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Nov 28 09:50:18 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Dec 12 16:32:04 2018 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/reactions.js | 15 ++++++++++++---
Allura/allura/nf/allura/css/site_style.css | 13 ++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/e9ca8128/Allura/allura/lib/widgets/resources/js/reactions.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/reactions.js b/Allura/allura/lib/widgets/resources/js/reactions.js
index 1f9d1c2..dc880a6 100644
--- a/Allura/allura/lib/widgets/resources/js/reactions.js
+++ b/Allura/allura/lib/widgets/resources/js/reactions.js
@@ -33,7 +33,16 @@ $('.reaction-button').tooltipster({
interactive: true,
functionReady: function(instance, helper) {
$(helper).find('.emoji_button').click(function() {
- reactComment(instance, $(this).data('emoji'));
+ var r = $(this).data('emoji');
+ if($(this).hasClass('current')) {
+ $(this).removeClass('current');
+ $(instance).data('currentreact', '');
+ }
+ else {
+ $(this).addClass('current');
+ $(instance).data('currentreact', r);
+ }
+ reactComment(instance, r);
});
}
});
@@ -45,8 +54,8 @@ $('.reaction-button').each(function() {
var currentemoji = $(this).data('currentreact');
var emohtml = '';
for(var emo in global_reactions) {
- emohtml += '<span class=\'emoji_button' + (currentemoji == emo ? ' current' : '') + '\' data-emoji=\'' + emo + '\'>' +
- twemoji.parse(global_reactions[emo]) + '</span>';
+ emohtml += '<div class=\'emoji_button' + (currentemoji == emo ? ' current' : '') + '\' data-emoji=\'' + emo + '\'>' +
+ twemoji.parse(global_reactions[emo]) + '</div>';
}
var tooltiptext = '<div class="post-reactions-list">' + emohtml + '</div>';
$(this).tooltipster('content', tooltiptext);
http://git-wip-us.apache.org/repos/asf/allura/blob/e9ca8128/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index af187a9..aed30d8 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3810,9 +3810,20 @@ fieldset.preferences legend {
width: 100%;
}
+.post-reactions-list .emoji_button {
+ padding: 1px 2px 1px 2px;
+ margin-left: 2px;
+ display: inline-block;
+}
+
+.post-reactions-list .current {
+ border: #999 solid 1px;
+ border-radius: 2px 2px;
+}
+
.post-reactions-list img.emoji {
width: 16px;
- margin-left: 4px;
+ margin: 2px 0px -2px 1px;
cursor: pointer;
}
[3/5] allura git commit: [#8263] Identify current selected emoji of
comment
Posted by br...@apache.org.
[#8263] Identify current selected emoji of comment
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2d72026f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2d72026f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2d72026f
Branch: refs/heads/master
Commit: 2d72026f94b5e499479e103ace829b8ec5c6adf2
Parents: 4115536
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Nov 28 08:54:15 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Dec 12 16:32:04 2018 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 4 ++++
Allura/allura/lib/utils.py | 10 +++++++++-
Allura/allura/lib/widgets/resources/js/reactions.js | 4 ++--
Allura/allura/templates/widgets/post_widget.html | 2 +-
4 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2d72026f/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 974b682..6856245 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -619,6 +619,10 @@ class Globals(object):
"""Coverts emoji codes to unicode emojis"""
return emoji.emojize(text, use_aliases=True)
+ def get_current_reaction(self, d):
+ """Return current selected reaction for given react_users dict"""
+ return utils.get_key_from_value(d, c.user.username)
+
class Icon(object):
http://git-wip-us.apache.org/repos/asf/allura/blob/2d72026f/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index feaf25a..dbc83c9 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -784,4 +784,12 @@ def get_reactions_json():
j = OrderedDict()
for em in get_reaction_emoji_list():
j[em] = pylons.app_globals.emojize(em)
- return json.dumps(j)
\ No newline at end of file
+ return json.dumps(j)
+
+
+def get_key_from_value(d, val):
+ """ Get key from given value. return empty str if not exists """
+ for k, v in d.items():
+ if val in v:
+ return k
+ return ''
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/allura/blob/2d72026f/Allura/allura/lib/widgets/resources/js/reactions.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/reactions.js b/Allura/allura/lib/widgets/resources/js/reactions.js
index 50fb674..1f9d1c2 100644
--- a/Allura/allura/lib/widgets/resources/js/reactions.js
+++ b/Allura/allura/lib/widgets/resources/js/reactions.js
@@ -42,10 +42,10 @@ $('.reaction-button').each(function() {
var btnId = $(this).attr('id');
$(this).click(function(e) {
e.preventDefault();
-
+ var currentemoji = $(this).data('currentreact');
var emohtml = '';
for(var emo in global_reactions) {
- emohtml += '<span class=\'emoji_button\' data-emoji=\'' + emo + '\'>' +
+ emohtml += '<span class=\'emoji_button' + (currentemoji == emo ? ' current' : '') + '\' data-emoji=\'' + emo + '\'>' +
twemoji.parse(global_reactions[emo]) + '</span>';
}
var tooltiptext = '<div class="post-reactions-list">' + emohtml + '</div>';
http://git-wip-us.apache.org/repos/asf/allura/blob/2d72026f/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index fc3f555..c65768e 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -56,7 +56,7 @@
<div class="tools">
{% if not c.user.is_anonymous() %}
- <a href="#" id="react_{{value.slug.replace('/','_')}}" data-commentlink="{{value.url()}}" class="reaction-button icon btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"{%if value.status == 'pending'%} style="display:none"{%endif%}>
+ <a href="#" id="react_{{value.slug.replace('/','_')}}" data-commentlink="{{value.url()}}" data-currentreact="{{ g.get_current_reaction(value.react_users) }}" class="reaction-button icon btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"{%if value.status == 'pending'%} style="display:none"{%endif%}>
<span><i class="fa fa-smile-o" aria-hidden="true"></i></span></a>
{% endif %}
{% if (h.has_access(value.thread, 'post')() and value.status == 'ok') or moderator %}