Revision 4282f214 main/templates/collection/view-collection.html

b/main/templates/collection/view-collection.html
5 5

  
6 6
{% block meta %}
7 7
<style type="text/css" title="currentStyle">
8
                       @import "/world/static/js/datatables/media/css/demo_page.css";
9
                       @import "/world/static/js/datatables/media/css/demo_table.css";
10
                       @import "http://invisible.sat.qc.ca/wp-content/themes/invisible/css/datatable_custom.css";
8

  
9
    @import "/world/static/js/datatables/media/css/demo_page.css";
10
    @import "/world/static/js/datatables/media/css/demo_table.css";
11
    @import "http://invisible.sat.qc.ca/wp-content/themes/invisible/css/datatable_custom.css";
12

  
11 13
</style>
12 14

  
13 15
<script type="text/javascript" charset="utf-8">
14
    
15 16
    $(document).ready(function() {
17

  
18
        
19
        
16 20
        //on cache les section
17 21
        $(".section-profile").hide();
18 22
        
19 23
        
20 24
       //generate the table for the artworks
25

  
21 26
       $('#table_list').dataTable( {
22
         "aoColumnDefs": [
23
            { "sWidth": "10px", "aTargets": [0] }
24
        ],
27
     
25 28
        "sPaginationType": "full_numbers",
26 29
        "aoColumns": [
27 30
            { "bSortable": false },
......
30 33
            null,
31 34
            { "bSortable": false }
32 35
        ]} );
33
        //fixe la taille du tr lors du déplacement
36
        
34 37
        var fixHelper = function(e, ui) {
35 38
            ui.children().each(function() {
36 39
                $(this).width($(this).width());
37 40
            });
38 41
            return ui;
39 42
        };
40
        //Permet d'ordonner les artworks avec un drag and drop
41
        $( "#table_list tbody" ).sortable({
42

  
43
            helper: fixHelper,
44
            handle: '.btn-drag',
45
            update: function(event, ui) { 
46
                
47
                var positionArt = ui.item.index();
48
                var idArt = ui.item.attr('id').match(/[0-9 -()+]+$/);
49
                //requête d'update de la position de l'artwork
50
                $.post('/world/api/art/'+idArt+'/'+positionArt+'/',
51
                function(result){
52
                   
53
                }
54
            );
55

  
56

  
57
            }
58
        });
59
        
60
	$( "#table_list tbody" ).disableSelection();
61
        
62
        //Desactive la possibilité du drag/drop lors d'une recherche
63
        $("#table_list_filter input").focus(function() {
64

  
65
             $('.btn-drag').fadeOut();
66
         
67
        }).blur(function(){
68
            if($("#table_list_filter input").attr("value") == ""){
69
             $('.btn-drag').fadeIn();
70
            }
71
        });
72

  
73
        //Accordeon pour le contenu de la collection
74
        $('.link-accordeon').click(function() {
75
            if($(this).hasClass('toggle_open'))
76
                 $(this).removeClass("toggle_open");
77
            else $(this).addClass("toggle_open");
78 43
                
79
            $(this).next().slideToggle('slow');
44
		$( "#table_list tbody" ).sortable({
45
                    
46
                    helper: fixHelper,
47
                    handle: '.btn-drag',
48
                    update: function(event, ui) { 
49
                        
50
                        var positionArt = ui.item.index()+1;
51
                        var idArt = ui.item.attr('id').match(/[0-9 -()+]+$/);
52

  
53
                    $.post('/world/api/art/'+idArt+'/'+positionArt+'/',
54
                      function(result){
55
                        alert('id:'+idArt+' , position:'+positionArt);
56
                      }
57
                    );
58
                        
59
                        
60
                    }
61
                });
80 62
                
81
		return false;
82
	});
63
		$( "#table_list tbody" ).disableSelection();
83 64

  
65
	
84 66
    } );
85 67
    
86 68
    
87
    
88 69
</script>
89 70

  
71

  
90 72
<script type="text/javascript" src="/world/static/js/datatables/media/js/jquery.dataTables.min.js"></script>
91
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
92 73

  
93 74

  
94 75
{% endblock %}
......
97 78

  
98 79

  
99 80
<article id="article-profil" class="profile-view">
100
    
101 81
    <header id="header-profil">
102
        
103 82
        <h1>{% trans "My collections" %}</h1>
104 83
        <h2>{{ c.title }}</h2>
105
        
106

  
107
        <ul class="profile-list">
108
            <li class="element-list">
109
                <span class="element-name">{% trans "Status" %}</span>
110
                <span class="element-value">{{c.get_status_display}}</span>
111
            </li>
112
            <li class="element-list">
113
                <img class="thumb-element" src="{{root}}th/{{c.thumbnail}}" alt="thumbnail"/>
114
                <span class="element-value">
115
                    <a target="_blank" href="/world/{{ request.LANGUAGE_CODE }}/collection/{{ c.id }}/">{%trans "Preview"%}</a><br/>
116
                    {{c.created|date:'d.m.Y'}}<br/>
117
                </span>
118
            </li>
119
        </ul>
120
            
121
        
122
   </header>
84
    </header>
123 85

  
124
    
125
<h3 class="link-accordeon"><a href="#">Informations de base</a></h3>
126 86

  
127
    
128
<section class="section-profile">
129
  
130 87
    <ul class="profile-list">
131

  
132
     
88
        <li class="element-list">
89
            <span class="element-name">{% trans "Status" %}</span>
90
            <span class="element-value">{{c.get_status_display}}</span>
91
        </li>
92
        <li class="element-list">
93
            <img class="thumb-element" src="{{root}}th/{{c.thumbnail}}" alt="thumbnail"/>
94
            <span class="element-value">
95
                    <a target="_blank" href="/world/{{ request.LANGUAGE_CODE }}/collection/{{ c.id }}/">{%trans "Preview"%}</a><br/>
96
                    {{c.created|date:'d.m.Y'}}<br/>
97
            </span>
98
        </li>
99
        <li><hr/></li>
133 100
        <li class="element-list">
134 101
            <span class="element-name">{% trans "Title" %}</span>
135 102
            <span class="element-value">{{c.title}}</span>
......
159 126
            <span class="element-value">{{c.year}}</span>
160 127
        </li>
161 128
        <li><hr/></li>
162
    
129
    </ul>
163 130
    <div class="btn-profile"><a href="../../update-collection/{{c.id}}/" >{% trans "Update this collection" %}</a></div>
164 131
    <div class="btn-profile"><a href="../update-collection/{{c.id}}/">{% trans "Delete this collection" %}</a></div>
165
    
166
    </ul>
167
   
168 132
</section>
169
    
170
    
171
<h3  class="link-accordeon" ><a href="#">Oeuvres de la collection</a></h3>
172 133

  
173 134
<section class="section-profile">
174

  
135
    <h3 class="title-sublist">artworks from the collection</h3>
175 136
    <div class="btn-profile btn-profile-add"><a href="../../upload-artwork/">add an artwork</a></div>
176 137
    <span id="msgRemove" style="display:none;">{% trans "Are you sure you want to remove this artwork from the collection?" %}</span>
177 138
     
......
187 148
                
188 149
            </tr>
189 150
        </thead>
190
        <tbody>
191
            
192
        {% for a in artworks %}
193
        <tr id="idArt-{{a.id}}" class="positionArt-{{a.sequence}}">
151
        <tbody>        
152
        {% for co in col %}
153
        <tr id="idArt-{{co.art.id}}" class="positionArt-{{co.sequence}}">
194 154

  
195 155
            <td><div class="btn-drag"></div></td>
196
        <td><a href="/world/profile/view-artwork/{{a.id}}/"><img src="{{root}}th/{{a.thumbnail}}" title="{{a.title}}" /></a></td>
197
        <td><a href="/world/profile/view-artwork/{{a.id}}/">{{a.title}}</a></td>
156
        <td><a href="/world/profile/view-artwork/{{co.art.id}}/"><img src="{{root}}th/{{co.art.thumbnail}}" title="{{co.art.title}}" /></a></td>
157
        <td><a href="/world/profile/view-artwork/{{co.art.id}}/">{{co.art.title}}</a></td>
198 158
        <td></td>
199 159
        <td>
200
            <a  titlet="{% trans 'Delete' %}" class="btn-table btn-delete" href="#" onclick="removeFromCollection({{c.id}}, {{a.id}});"></a>   
160

  
161
            <a  title="{% trans 'Delete' %}" class="btn-table btn-delete" href="#" onclick="removeFromCollection({{c.id}}, {{a.id}});"></a>   
201 162
            <a title="{% trans 'update' %}" class="btn-table btn-edit" href="../../update-artwork/{{a.id}}/"></a>
202 163
            <a title="{% trans 'View' %}" class="btn-table btn-view" href="../../view-artwork/{{a.id}}/"></a>
203
        
164

  
204 165
          
205 166
        </td>
206 167
        </tr>
......
208 169
        {% endfor %}
209 170
        </tbody>
210 171
    </table>
211

  
172
    
173
    
212 174
    
213 175
</section>
214 176
</article>

Also available in: Unified diff