Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

select_subgroups.html 1.94 KB
Newer Older
Anze Vavpetic's avatar
Anze Vavpetic committed
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
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} interaction" width="700px" height="670px">
    <div style="width:620px; margin: 0 auto;">
        <form>
        Model: {{model_name}}<br/>
        Select one or more subgroups to output:
        <ol id="selected_subgroups{{widget.pk}}">
            {% for id, descr, fp, tp in subgroups %}
                <li class="ui-widget-content" id="{{id}}">{{ descr }} FP={{fp}}, TP={{tp}}</li>
            {% endfor %}
        </ol>
        <input type="hidden" name="selected_subgroup_ids" id="selected_subgroup_ids" value=""/>
        <input type="hidden" name="widget_id" value="{{widget.pk}}"/>
        </form>
        <style>
            #selected_subgroups{{widget.pk}} .ui-selecting { background: #FECA40; }
            #selected_subgroups{{widget.pk}} .ui-selected { background: #F39814; color: white; }
            #selected_subgroups{{widget.pk}} { list-style-type: none; margin: 0; padding: 0; width: 100%; }
            #selected_subgroups{{widget.pk}} li { margin: 3px; padding: 0.4em; font-size: 1.2em; }
        </style>
        <script type="text/javascript">
        $(function () {
            // Empty list on load
            $('#selected_subgroup_ids').val(JSON.stringify([]));
            $("#selected_subgroups{{widget.pk}}").selectable({filter : "li"}, {
                    stop: function() {
                        var selected = [];
                        $('.ui-selected', this).each(function(){
                            selected.push($(this).attr("id"));
                        });
                        $('#selected_subgroup_ids').val(JSON.stringify(selected));
                    }
                }
            );
            $('#selected_subgroups{{widget.pk}}').selectable().on('mousedown', '*', function(e){
              if (e.ctrlKey)
                e.metaKey = e.ctrlKey;
            });
        });
        </script>
    </div>
</div>