src/cm/templates/site/macros/user_actions.html
author Yves-Marie Haussonne <ymh.work+github@gmail.com>
Fri, 09 May 2014 18:35:26 +0200
changeset 656 a84519031134
parent 38 be1807d390d4
permissions -rw-r--r--
add link to "privacy policy" in the header test

{% load com %}
{% load i18n %}
{% load tagging_tags %}
<b>
	{% ifequal user request.user %}
    <a title="{% blocktrans %}Your profile{% endblocktrans %}" class="main_object_title" href="{% url profile %}">{{ user.get_profile.admin_print }}</a>
    {% else %}
    <a title="{% blocktrans with user.get_profile.admin_print as userprint %}Edit user {{ userprint }}{% endblocktrans %}" class="main_object_title" href="{% url user-edit user.get_profile.key %}">{{ user.get_profile.admin_print }}</a>
    {% endifequal %}
</b>

{% tags_for_object user.get_profile as tag_list %}
{% if tag_list %}<div class="tag_list>">{% blocktrans %}tags:{% endblocktrans %}&nbsp;{% for tag in tag_list %}<a class="tag" title="{% blocktrans with tag.name as tag_name %}Filter by tag: {{ tag_name }}{% endblocktrans %}" href="?{% newparams 'tag_selected' tag.name %}"">{{ tag.name }}</a>&nbsp;{% endfor %}</div>{% endif %}

<div class="hidden-user-actions user-actions-{{ user.get_profile.key }}" style="visibility:hidden;">
{% ifequal user request.user %}
  <a title="Your profile" href="{% url profile %}">{% blocktrans %}Your profile{% endblocktrans %}</a> 
{% else %}
  <a title="Edit user" href="{% url user-edit user.get_profile.key %}">{% blocktrans %}Edit{% endblocktrans %}</a> 
| <a href="{% url user-contact user.get_profile.key %}">{% blocktrans %}Contact{% endblocktrans %}</a>               
{% if user.get_profile.is_suspended %}
	{% if user.is_active %}
		| <a id="user-enable-{{ user.get_profile.key }}" href="#">{% blocktrans %}Enable access{% endblocktrans %}</a>
	{% else %}
		{% include "site/macros/user_moderation.html" %}
	{% endif %}
{% else %}
        | <a id="user-suspend-{{ user.get_profile.key }}" href="#">{% blocktrans %}Suspend access{% endblocktrans %}</a>
        | <a id="user-resend-{{ user.get_profile.key }}" href="#">{% blocktrans %}(Re-)send invitation{% endblocktrans %}</a>
{% endif %}
{% endifequal %}  
</div>
<script type="text/javascript">
<!--
$(function() {
    $("#user-suspend-{{ user.get_profile.key }}").click(function(){
        url = '{% url user-suspend user.get_profile.key %}';
    	question = "{% blocktrans %}Are you sure you want to suspend this user's access to the workspace?{% endblocktrans %}";
        if (confirm(question)) {
            $.post(url, function(data){
                  window.location = '{% url user %}';
                });                        
        }
    });
    $("#user-enable-{{ user.get_profile.key }}").click(function(){
        url = '{% url user-enable user.get_profile.key %}';
    	question = "{% blocktrans %}Are you sure you want to enable this user's access to the workspace?{% endblocktrans %}";
        if (confirm(question)) {
            $.post(url, function(data){
                  window.location = '{% url user %}';
                });                        
        }
    });
    $("#user-resend-{{ user.get_profile.key }}").click(function(){
    	url = '{% url user-send-invitation user.get_profile.key %}';
    	question = "{% blocktrans %}Are you sure you want to send this user an invitation to the workspace?{% endblocktrans %}";
        if (confirm(question)) {
            $.post(url, function(data){
                  window.location = '{% url user %}';
                });                        
        }
    });
    
    $(".user-{{ user.get_profile.key }}").mouseover(function(){
        $(".user-actions-{{ user.get_profile.key }}").css('visibility','visible');
        $(".user-{{ user.get_profile.key }}").addClass('hover');                       
    });
    $(".user-{{ user.get_profile.key }}").mouseout(function(){
        $(".user-actions-{{ user.get_profile.key }}").css('visibility','hidden');   
        $(".user-{{ user.get_profile.key }}").removeClass('hover');                       
    });
}) ;
--> 
</script>