aboutsummaryrefslogtreecommitdiffstats
path: root/jm2l/templates/Staff/list.mako
blob: fbee9e556b35a8dcb287934adf88b4839596e2e8 (plain)
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
33
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# -*- coding: utf-8 -*- 
<%inherit file="jm2l:templates/layout.mako"/>
<%
from slugify import slugify
%>
<a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/poles">
    <i class="icon-plus-sign icon-white"></i> Ajouter un Pôle d'activité
</a>
<h3>Liste des tâches JM2L Staff</h3>

<div class="tabbable" id="main_tab">
    <ul class="nav nav-tabs" style="margin-bottom: 5px;">
        % for Num, Entity in enumerate(sorted(tasks.keys(), key=lambda x:x.name)):
        <li class="${["","active"][Num==0]}">
            <a href="#${slugify(Entity.name)}" id="Map_Pole_${slugify(Entity.name)}" data-toggle="tab">${Entity.name}</a>
        </li>
        % endfor
    </ul>

    <div class="tab-content" style="padding:0 10px">

% for Num, Entity in enumerate(sorted(tasks.keys(), key=lambda x:x.name)):
        <div class="tab-pane fade ${["","active "][Num==0]} in" id="${slugify(Entity.name)}">
            <a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/poles/${Entity.uid}">
                <i class="icon-pencil icon-white"></i> Editer le pôle
            </a>
            <h4>${Entity.name}</h4>
            % if Entity.description:
            <div>${Entity.description | n}</div>
            % endif
<table class="table table-striped table-bordered table-hover">
  <thead>
    <tr>
        <th colspan="2" style="text-align:center;">
            <a style="float:right;" class="btn btn-mini btn-info" role="button" href="${request.route_path('handle_task', sep="", task_id="", _query={"pole_id":Entity.uid})}">
                <i class="icon-plus-sign icon-white"></i> Ajouter une tâche
            </a>
            Liste des tâches
        </th>
    </tr>
  </thead>
  <tbody>
    % if len(tasks[Entity])==0:
        <tr> 
            <td colspan="2" style="text-align:center;">
                <i>Il n'y a pas de tâches dans ce pôle</i>
            </td>
        </tr>
    % endif
    % for task in tasks[Entity]:
        <tr> 
            <td>
                % if task.closed:
                    <span class="name" style="text-decoration: line-through;">${task.name}</span>
                % else:
                    <a href="/Staff/tasks/${task.uid}">
                        <span class="name">${task.name}</span>
                    </a>
                    <span style="float:right;">${task.due_date.strftime("%d %b").decode("utf-8")}</span>
                % endif
            </td>
            <td style="position: relative;width:70px;">
                <div class="actions">
                % if task.closed:
                [ <a href="/Staff/open/${task.uid}">ré-ouvrir</a> ]
                % else:
                [ <a href="/Staff/close/${task.uid}">c'est fait</a> ]
                % endif
                </div>
            </td>
        </tr>
        % if task.description and not task.closed:
        <tr>
            <td colspan="2"><div>${task.description | n}</div></td>
        </tr>
        % endif
    % endfor
  </tbody>
</table>
        </div>
% endfor
    </div>
</div>

<%def name="jsAddOn()">
<script>
    $('a[data-toggle="tab"]')
        .on('shown', function(e) {
            //stateObj = { tab: $(e.target).attr('href').substr(1) };
            //history.replaceState(stateObj, "", "/Staff" + $(e.target).attr('href') );
            location.hash = $(e.target).attr('href');
        }); 
    
    if (location.hash !== '') {
        $('a[href="' + location.hash + '"]').tab('show');
    }
</script>
</%def>