{% extends "site/layout/base_text.html" %}
{% load com %}
{% load i18n %}
{% load local_perms %}

{% block title %}
{% blocktrans %}Text followup{% endblocktrans %}
{% endblock %}

{% block main %}
{% get_local_perm request can_manage_workspace as can_manage_workspace %}
{% get_local_perm request can_view_unapproved_comment as can_view_unapproved_comment %}

<script type="text/javascript">
<!--
tb_conf['current_tab'] = 'followup';
-->
</script>

<div id="followup_settings" class="tab-meta">   

<h2 class="title_first">{% blocktrans %}Feeds{% endblocktrans %}</h2>

<h3>{% blocktrans %}Public feed{% endblocktrans %}</h3>

<div>
<a href="{{SITE_URL}}{% url text-feed text.key  %}" title="{% blocktrans with text.title as title %}Public feed for text {{ title }}{% endblocktrans %}">
	<img style="vertical-align:middle;" src="{{ CM_MEDIA_PREFIX }}img/xml.gif" /> {{SITE_URL}}{% url text-feed text.key  %} 
</a>
</div>
{% blocktrans %}This is the public feed for the text.{% endblocktrans %}

{% if user.is_authenticated %}
<form id="notifications" enctype="multipart/form-data" action="." method="post">{% csrf_token %}

{% if can_view_unapproved_comment %}
<h3>{% blocktrans %}Private feed{% endblocktrans %}</h3>

{% if text.private_feed_key %}
<div>
<a href="{{SITE_URL}}{% url text-private-feed text.key text.private_feed_key %}" title="{% blocktrans %}Private feed for text {% endblocktrans %}">
	<img style="vertical-align:middle;" src="{{ CM_MEDIA_PREFIX }}img/xml.gif" /> {{SITE_URL}}{% url text-private-feed text.key text.private_feed_key %} 
</a>
</div>
{% blocktrans %}This is the private feed for the text. Don't share this address with others unless you want them to see all activities on this text.{% endblocktrans %}
<br />
<input name="reset" type="submit" id="reset" value="{% blocktrans %}Reset private feed url{% endblocktrans %}"/>

{% else %}
<div>
<input name="activate" type="submit" id="activate" value="{% blocktrans %}Activate private feed{% endblocktrans %}"/>
</div>
{% blocktrans %}The private feed for this text is not yet activated.{% endblocktrans %}
{% endif %}

{% endif %}

<h2>{% blocktrans %}Email notifications{% endblocktrans %}</h2>
    <div>
    {% if workspace_notify_check %}
        {% blocktrans %}You will receive text notifications because you subscribed to notifications at the workspace level{% endblocktrans %}
    {% else %}
		<input type="checkbox" id="text_notify_check" class="check" {% if text_notify_check %}checked="checked"{% endif %}/>&nbsp;
	    {% blocktrans %}Subscribe to all text notifications{% endblocktrans %}
    {% endif %}
	</div>
	<script type="text/javascript">                
	<!--
    $(function() {
        $(".check").click(function(){
            checked = $(this).attr('checked');
            id = $(this).attr('id') ;
            post_data = {'notif_id': id} ;
            post_data[id] = checked ; 
            $.post('.', post_data, function(data){});
        });
        
    }) ;
	--> 
	</script>

</form>
{% endif %}

</div>

{% endblock %}

