Blame view

dictionary/templates/change_ctrl.html 2.03 KB
Bartłomiej Nitoń authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<script type="text/javascript">

  window.selected_ctrl_row_id = -1;
  ax_change_id = -1;
 
  function selectTr(id)
  {  	  
  	if(selected_ctrl_row_id != -1)
  	{
  	  var recent_row = document.getElementById(selected_ctrl_row_id);
  	  var recent_descendants = getDescendantsNodes(recent_row);
  	  for(var i = 0; i<recent_descendants.length; i++)
  	    $(recent_descendants[i]).css("background-color", "");
  	}
  	
  	if(selected_ctrl_row_id == id)
  	  selected_ctrl_row_id = -1;
  	else
  	{
  	  selected_ctrl_row_id = id;
  	  var row = document.getElementById(id);
  	  var descendants = getDescendantsNodes(row);
  	  for(var i = 0; i<descendants.length; i++)
  	    $(descendants[i]).css("background-color", "LightSteelBlue");
  	  change_id = id.replace('change_', '');
  	  
  	  $.get(ajax_get_ctrl_preview, {id: change_id}, function(resp) {
        draw_filtered_frames(resp['serialized_frames'], 'change-ctrl-preview', 'ctrl-frame-table', '', new Array(), 'InactiveFrameTable', window.lemma_entry);
      }); 	  
  	}
  }
Bartłomiej Nitoń authored
33
  $(".change-ctrl-container tr.ChangeControlTableRow").click(function(){
Bartłomiej Nitoń authored
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    selectTr(this.id)});
    
  $("button#restore").click(function(){
    restore_lemma();
  });

</script>

<div class="change-ctrl-container">

  <table class='ChangeControlTable' id='change-ctrl-table'>
	<tr> 
	  <td class='ColumnHeader'>Czas modyfikacji:</td> 
	  <td class='ColumnHeader'>Właściciel:</td>
	  <td class='ColumnHeader'>Osoba dokonująca zmiany:</td>
	</tr>
	{% for version in old_versions %}
	  <tr class='ChangeControlTableRow' id="change_{{version.id}}"> 
		<td>{{version.time}}</td> 
		<td>{{version.act_owner.username}}</td>
		<td>{{version.user.username}}</td>
	  </tr>
	{% endfor %}
  </table>	
</div>

{% if can_modify and perms.dictionary.change_lemma_version %}
<div id="change-ctrl-buttons">
  <button type="button" id="restore" style="width:120px">Przywróć</button>
</div>
{% endif %}
</br>
</br>
<strong>Podgląd:</strong>
<div id="change-ctrl-preview">
</div>