src/cm/templates/site/text_history.html
author gibus
Tue, 11 Feb 2014 12:33:25 +0100
changeset 572 93383e54e042
parent 486 c9a646707d86
permissions -rw-r--r--
Font size for piwik optout iframe.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     1
{% extends "site/layout/base_text.html" %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     2
{% load com %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     3
{% load i18n %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     4
{% load local_perms %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     5
{% block main %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     6
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     7
{% get_local_text_perm request text can_edit_text as can_edit_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     8
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     9
<script type="text/javascript">
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    10
<!--
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    11
tb_conf['current_tab'] = 'history';
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    12
-->
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    13
</script>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    14
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    15
<div id="text_history" class="tab-meta">   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    16
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    17
<script type="text/javascript">
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    18
<!--
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    19
$(function() {
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    20
    $(".hidden-text-actions").css('visibility','hidden');   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    21
}) ;
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    22
$(function() {
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    23
	$("input[name=oldkey]").click(function () {
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    24
		hide_show($(this), 'newkey', true, true, -1);
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    25
		hide_show($(this), 'newkey', false, false, 0);
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    26
	});   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    27
	$("input[name=newkey]").click(function () {
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    28
		hide_show($(this), 'oldkey', false, true, 0);
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    29
		hide_show($(this), 'oldkey', true, false, +1);
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    30
	});   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    31
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    32
	$("input[name=newkey]")[0].click();
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    33
	$("input[name=oldkey]")[1].click();
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    34
}) ;
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    35
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    36
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    37
function hide_show(elem, name, hide, up, plus) {	
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    38
	var nb = elem.attr('id').split('-')[1];
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    39
	nb = parseInt(nb) + plus;
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    40
	
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    41
	if (hide)
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    42
		var vis = 'hidden';
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    43
	else
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    44
		var vis = 'visible';
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    45
		
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    46
	if (up)
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    47
		var fu = 'gt';
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    48
	else
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    49
		var fu = 'lt';
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    50
	$("input[name=" + name + "]:" + fu + "(" + nb + ")").css('visibility',vis);
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    51
};
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    52
-->
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    53
</script>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    54
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    55
<ul class="sub_list">
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    56
    <li class="active_sub">{% blocktrans %}Version list{% endblocktrans %}</li>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    57
    {% if last_last_version %}    
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    58
    <li> / </li>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    59
    <li><a href="{% url text-history-compare text.key last_last_version.key last_version.key %}">{% blocktrans %}Compare last two versions{% endblocktrans %}</a></li>
148
03106bfa4845 fix version compare order / i18n update (fr)
raph
parents: 145
diff changeset
    60
    <li> / </li>
03106bfa4845 fix version compare order / i18n update (fr)
raph
parents: 145
diff changeset
    61
    <li><a href="{% url text-history-version text.key text.last_text_version.key %}">{% blocktrans %}Most recent version{% endblocktrans %}</a></li>
486
c9a646707d86 Clean versions list/comparison/view and add original version.
gibus
parents: 439
diff changeset
    62
    <li> / </li>
c9a646707d86 Clean versions list/comparison/view and add original version.
gibus
parents: 439
diff changeset
    63
    <li><a href="{% url text-history-version text.key first_version.key %}">{% blocktrans %}Original version{% endblocktrans %}</a></li>
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    64
    {% endif %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    65
</ul>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    66
439
8994d24e4b2f Reverts to changeset 435, and just add {% csrf_token %} to template forgot_pw.html, since CSRF protection seems to be only here (surely because of django.contrib.auth.views).
gibus
parents: 438
diff changeset
    67
<form id="compare_form" action="." method="post">
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    68
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    69
<input name="compare" id="compare_button" type="submit" value="{% blocktrans %}Compare selected versions{% endblocktrans %}"/>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    70
62
381538cb3a8b refactor history template
raph
parents: 59
diff changeset
    71
<br />
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    72
{% include "site/macros/paginator.html" %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    73
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    74
<div style="clear:both;"></div>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    75
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    76
<table summary="text list" class="large_table">
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    77
    <thead>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    78
        <tr>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    79
            <th>{% blocktrans %}Version{% endblocktrans %}</th>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    80
            <th colspan="2" width="1%">{% blocktrans %}Selection{% endblocktrans %}</th>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    81
            <th>{% blocktrans %}Title{% endblocktrans %}</th>
177
6fcd0f9cc08b add note column in version list
raph
parents: 148
diff changeset
    82
            <th>{% blocktrans %}Note{% endblocktrans %}</th>
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    83
            <th>{% blocktrans %}Author{% endblocktrans %}</th>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    84
            <th>{% blocktrans %}Created{% endblocktrans %}</th>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    85
            <th>{% blocktrans %}# comments{% endblocktrans %}</th>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    86
        </tr>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    87
    </thead>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    88
    <tbody>
265
1d4299775ec9 fix history display when no pagination
raph
parents: 230
diff changeset
    89
    	{% with object_list|length as object_list_len %}
1d4299775ec9 fix history display when no pagination
raph
parents: 230
diff changeset
    90
    	
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    91
        {% for text_version in object_list %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    92
        
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    93
        {% get_local_text_perm request text can_edit_text as can_edit_text %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    94
        {% get_local_text_perm request text can_delete_text as can_delete_text %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    95
        {% get_local_text_perm request text can_manage_text as can_manage_text %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    96
        
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    97
        <tr class="text-{{ text_version.key }} {% cycle 'odd' 'even' %}">
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
    98
            {% if can_manage_workspace %}<td><input type="checkbox" class="text_check" name="check-{{ text_version.key }}"/></td>{% endif %}
265
1d4299775ec9 fix history display when no pagination
raph
parents: 230
diff changeset
    99
            <td>#{% if page_obj %}{{ forloop.counter0|add:page_obj.start_index|invneg:paginator.count|add:"1" }}{% else %}{{ forloop.counter0|invneg:object_list_len }}{% endif %}</td>
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   100
            <td><input id="oldkey-{{ forloop.counter0 }}" type="radio" name="oldkey" value="{{ text_version.key }}"/></td>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   101
            <td><input id="newkey-{{ forloop.counter0 }}" type="radio" name="newkey" value="{{ text_version.key }}"/></td>                        
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   102
            <td>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   103
                <a class="main_object_title" href="{% url text-history-version text.key text_version.key %}">{{ text_version.title }}</a>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   104
                
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   105
                
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   106
                <div class="hidden-text-actions text-actions-{{ text_version.key }}">
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   107
                    <a href="{% url text-history-version text.key text_version.key %}">{% blocktrans %}View{% endblocktrans %}</a> 
148
03106bfa4845 fix version compare order / i18n update (fr)
raph
parents: 145
diff changeset
   108
                    {% if text_version.get_previous_version %}| <a href="{% url text-history-compare text.key text_version.get_previous_version.key text_version.key %}">{% blocktrans %}Compare with previous version{% endblocktrans %}</a>{% endif %}
230
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   109
                    {% if can_edit_text %}
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   110
                    | <a id="text-revert-{{ text_version.key }}" href="#">{% blocktrans %}Revert to this version{% endblocktrans %}</a>
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   111
                    <script type="text/javascript">                
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   112
                    <!--
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   113
                    $(function() {
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   114
                        $("#text-revert-{{ text_version.key }}").click(function(){
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   115
                            var url = '{% url text-revert text.key text_version.key %}';
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   116
                            $.post(url, function(data){
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   117
                                  window.location = '{% url text-history text.key %}';
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   118
                                });                        
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   119
                        });                        
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   120
                    }) ;
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   121
                    --> 
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   122
                    </script>                                                            
fb1a2dfb473d refactor arg passing between frames
raph
parents: 177
diff changeset
   123
                    {% endif %}
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   124
                    {% comment %}{% if can_delete_text %}<a id="text-delete-{{ text_version.key }}" href="#">{% blocktrans %}Delete{% endblocktrans %}</a>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   125
                    <script type="text/javascript">                
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   126
                    <!--
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   127
                    $(function() {
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   128
                        $("#text-delete-{{ text_version.key }}").click(function(){
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   129
                            url = '{% url text-version-delete text.key text_version.key %}';
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   130
                            question = "{% blocktrans %}Are you sure you want to delete this version?{% endblocktrans %}";
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   131
                            if (confirm(question)) {
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   132
                                $.post(url, function(data){
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   133
                                      window.location = '{% url index %}';
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   134
                                    });                        
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   135
                            }
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   136
                        });
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   137
                        
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   138
                    }) ;
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   139
                    --> 
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   140
                    </script>                    
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   141
                    {% endif %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   142
                    {% endcomment %}
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   143
                </div>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   144
                <script type="text/javascript">                
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   145
                <!--
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   146
                $(function() {
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   147
                    $(".text-{{ text_version.key }}").mouseover(function(){
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   148
                        $(".text-actions-{{ text_version.key }}").css('visibility','visible');
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   149
                        $(".text-{{ text_version.key }}").addClass('hover');   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   150
                    });
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   151
                    $(".text-{{ text_version.key }}").mouseout(function(){
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   152
                        $(".text-actions-{{ text_version.key }}").css('visibility','hidden');   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   153
                        $(".text-{{ text_version.key }}").removeClass('hover');   
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   154
                    });
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   155
                }) ;
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   156
                --> 
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   157
                </script>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   158
            </td>
177
6fcd0f9cc08b add note column in version list
raph
parents: 148
diff changeset
   159
            <td>{{ text_version.note|default_if_none:"" }}</td>
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   160
            <td>{{ text_version.get_name }}</td>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   161
            <td>{{ text_version.created|local_date }}</td>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   162
            <td>{{ text_version|nb_comments:request }}</td>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   163
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   164
        </tr>
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   165
        {% endfor %}
265
1d4299775ec9 fix history display when no pagination
raph
parents: 230
diff changeset
   166
        
1d4299775ec9 fix history display when no pagination
raph
parents: 230
diff changeset
   167
        {% endwith %}
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   168
    </tbody>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   169
</table>
62
381538cb3a8b refactor history template
raph
parents: 59
diff changeset
   170
145
fb5b1e6ad179 refactor version explorer
raph
parents: 62
diff changeset
   171
</form>
62
381538cb3a8b refactor history template
raph
parents: 59
diff changeset
   172
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   173
</div>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   174
{% endblock %}