SHARE
TWEET

Untitled

a guest Aug 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% extends "admin/work/work_menu.html" %}
  2.  
  3. {% block task %}
  4.  
  5.     {% macro increment(dct, key, inc=1)%}
  6.         {% if dct.update({key: dct[key] + inc}) %} {% endif %}
  7.     {% endmacro %}
  8.  
  9.     {% macro decrement(dct, key, dec=1)%}
  10.         {% if dct.update({key: dct[key] - dec}) %} {% endif %}
  11.     {% endmacro %}
  12.  
  13.     {% macro clear(dct, key, default=0)%}
  14.         {% if dct.update({key: default}) %} {% endif %}
  15.     {% endmacro %}
  16.  
  17.     {% set counter = {
  18.         'task_done': 0,
  19.         'task_open': 0
  20.         } %}
  21.  
  22.     <div class="panel-group" id="accordion">
  23.         {% for work in wpackages %}
  24.             {% clear(counter, 'task_done') %}
  25.             {% clear(counter, 'task_open') %}
  26.             {% for workt in wpackaget %}
  27.                 {% if workt.workp_id == work.id %}
  28.                     {% for task in tasks %}
  29.                         {% if task.id == workt.task_id  %}
  30.                                 {% increment(counter, 'task_open') %}
  31.                             {% if task.done %}
  32.                                 {% increment(counter, 'task_done') %}
  33.                             {% endif %}
  34.                         {% endif %}
  35.                     {% endfor %}
  36.                 {% endif %}
  37.             {% endfor %}
  38.  
  39.         <div class="panel panel-default">
  40.             <div class="panel-heading">
  41.                 <h4 class="panel-title">
  42.                     <a data-toggle="collapse" data-parent="#accordion" href="#work{{work.id}}" class="collapsed">
  43.                         <i class="fa fa-chevron-up pull-right"></i>
  44.                         {{ work.name }} ({{ counter.task_done }} / {{ coutner.task_count }})
  45.                     </a>
  46.                 </h4>
  47.             </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top