Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // one
  2. {% if item.active == item.STATUS_OFF %}
  3.     {% url 'change_item_state' item.id 'activate' as activate_url %}
  4.     off <a href="javascript:update_status({{ item.id }}, '{{ activate_url }}')">[on]</a>
  5. {% endif %}
  6.  
  7.  
  8. // two
  9. {% if item.active == item.STATUS_ON %}
  10.     {% url 'change_item_state' item.id 'deactivate' as deactivate_url %}
  11.     on <a href="javascript:update_status({{ item.id }}, '{{ deactivate_url }}')">[off]</a>
  12. {% endif %}
  13.  
  14.  
  15. // three
  16. {% url 'change_item_state' item.id 'hide' as hide_url %}
  17. <a href="javascript: update_status({{ item.id }}, '{{ hide_url }}', true)" title="Can't be undone.">[hide]</a>
  18.  
  19.  
  20.  
  21.  
  22.  
  23. function update_status(item_id, url_val, hide_item) {
  24.     if (true && !confirm('Do you really want to hide this item?')) return ;
  25.     $.get(url_val, function(data) {
  26.         if (data.html_text != '') {
  27.             $('#status_' + item_id).html(data.html_text);
  28.         }
  29.         if (data.group_text != null) {
  30.             $('#group_' + item_id).html(data.group_text);
  31.         }
  32.  
  33.     }, 'json');
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement