From f40c0a98a1875161d6f5e83c6c30d8d4029de99b Mon Sep 17 00:00:00 2001 From: Dejan Noveski Date: Mon, 13 Feb 2012 23:54:25 +0100 Subject: Moderation from inbox - Ability to remove all flags and close/delete entries from flagged items inbox --- askbot/skins/common/media/js/user.js | 30 +++++++++++++++++-- askbot/skins/default/media/style/style.css | 10 +++++++ .../default/templates/user_profile/user_inbox.html | 34 ++++++++++++++++++---- askbot/views/commands.py | 13 ++++++++- askbot/views/users.py | 2 ++ 5 files changed, 81 insertions(+), 8 deletions(-) diff --git a/askbot/skins/common/media/js/user.js b/askbot/skins/common/media/js/user.js index d80adad6..f3b4ed8e 100644 --- a/askbot/skins/common/media/js/user.js +++ b/askbot/skins/common/media/js/user.js @@ -18,7 +18,7 @@ $(document).ready(function(){ }; var submit = function(id_list, elements, action_type){ - if (action_type == 'delete' || action_type == 'mark_new' || action_type == 'mark_seen'){ + if (action_type == 'delete' || action_type == 'mark_new' || action_type == 'mark_seen' || action_type == 'remove_flag' || action_type == 'close'){ $.ajax({ type: 'POST', cache: false, @@ -27,7 +27,7 @@ $(document).ready(function(){ url: askbot['urls']['manageInbox'], success: function(response_data){ if (response_data['success'] === true){ - if (action_type == 'delete'){ + if (action_type == 'delete' || action_type == 'remove_flag' || action_type == 'close'){ elements.remove(); } else if (action_type == 'mark_new'){ @@ -61,11 +61,27 @@ $(document).ready(function(){ return; } } + if (action_type == 'close'){ + msg = ngettext('Close this entry?', + 'Close these entries?', data['id_list'].length); + if (confirm(msg) === false){ + return; + } + } + if (action_type == 'remove_flag'){ + msg = ngettext('Remove all flags on this entry?', + 'Remove all flags on these entries?', data['id_list'].length); + if (confirm(msg) === false){ + return; + } + } submit(data['id_list'], data['elements'], action_type); }; setupButtonEventHandlers($('#re_mark_seen'), function(){startAction('mark_seen')}); setupButtonEventHandlers($('#re_mark_new'), function(){startAction('mark_new')}); setupButtonEventHandlers($('#re_dismiss'), function(){startAction('delete')}); + setupButtonEventHandlers($('#re_remove_flag'), function(){startAction('remove_flag')}); + setupButtonEventHandlers($('#re_close'), function(){startAction('close')}); setupButtonEventHandlers( $('#sel_all'), function(){ @@ -92,6 +108,16 @@ $(document).ready(function(){ setCheckBoxesIn('#responses .seen', false); } ); + + setupButtonEventHandlers($('.re_expand'), + function(e){ + e.preventDefault(); + var re_snippet = $(this).find(".re_snippet:first") + var re_content = $(this).find(".re_content:first") + $(re_snippet).slideToggle(); + $(re_content).slideToggle(); + } + ); }); /** diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index d52c4f11..737dcdd2 100644 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -3153,3 +3153,13 @@ pre.prettyprint { #leading-sidebar { float: left; } + +a.re_expand{ + color: #616161; + text-decoration:none; +} + +a.re_expand .re_content{ + display:none; + margin-left:77px; +} \ No newline at end of file diff --git a/askbot/skins/default/templates/user_profile/user_inbox.html b/askbot/skins/default/templates/user_profile/user_inbox.html index e7e3dbfe..9d5d3db6 100644 --- a/askbot/skins/default/templates/user_profile/user_inbox.html +++ b/askbot/skins/default/templates/user_profile/user_inbox.html @@ -56,6 +56,17 @@ inbox_section - forum|flags {% endif %} + {% if inbox_section == 'flags' %} +
+ {% trans %}select:{% endtrans %} + {% trans %}all{% endtrans %} | + {% trans %}seen{% endtrans %} | + {% trans %}new{% endtrans %} | + {% trans %}none{% endtrans %}
+ + +
+ {% endif %}
{% for response in responses %}
@@ -63,7 +74,7 @@ inbox_section - forum|flags "{{ response.response_title.strip()|escape}}"

- {% if inbox_section == 'forum' %}{% endif %} +
{{ macros.gravatar(response.user, 48) }}
@@ -71,13 +82,20 @@ inbox_section - forum|flags {{ response.response_type }} ({{ response.timestamp|diff_date(True) }}):
- {{ response.response_snippet}} + {% if inbox_section != 'flags' %} + {{ response.response_snippet }} + {% endif %}
+ {% if inbox_section == 'flags' %} + +
{{ response.response_snippet }}
+
{{ response.response_content }}
+ {% endif %}
{% if response.nested_responses %} {%for nested_response in response.nested_responses %} {%endfor%} {%endif%} @@ -96,7 +121,6 @@ inbox_section - forum|flags
{% endblock %} {% block userjs %} -