Gitlab CSE Unil

annotation.html 14.7 KB
Newer Older
Julien Furrer's avatar
Julien Furrer 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
42
43
44
45
46
47
48
49
50
51
52
53
{% extends "adim_app/base_annotation.html" %}
{% load static i18n %}

{% block page_head %}{% endblock %}

{%  block navbar_content %}
    <ul class="nav navbar-nav">
        <li><a href="#" class="adim-image-name">
            <span class="text">{{ anobj.name }}</span>
            &nbsp;<span class="glyphicon glyphicon-pencil" style="font-size: 12px;"></span>
        </a></li>
    </ul>
    {{ block.super }}
{%  endblock navbar_content %}

{% block navbar_right_content %}
    <li>
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
          <span class="glyphicon glyphicon-download-alt"></span>
          Exporter <span class="caret"></span>
      </a>
      <ul class="dropdown-menu" role="menu">
        <li><a id="btn-export-image-png" href="#">PNG</a></li>
        <li><a id="btn-export-image-svg" href="#">SVG</a></li>
      </ul>
    </li>
    {{ block.super }}
{% endblock %}


{% block overlay %}
<div id="page-loader">
    <div class="text-muted lead">Chargement...</div>
</div>
{% endblock %}


{% block inline_script %}
    {{ block.super }}
<script>
window.ADIM_CONFIG = {
    mode: "edit",
    csrfToken: "{{ csrf_token }}",
    api: {
        baseUrl: "{% url "api-root" %}",
        annotables: "{% url "anobj-list" %}",
        annotations: "{% url "annotation-list" %}"
    },

    annotable: {
        id: {{ anobj.id }},
        title: '{{ anobj.name|escapejs }}',
        slug: '{{ anobj.name|slugify }}',
54
55
56
        image: 'image/',
        thumbnail: 'thumb/'
{#        image: '{% url "adim.app:ao_image" anobj_uuid=anobj.uuid %}'#}
Julien Furrer's avatar
Julien Furrer committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
    },

    users: {},

    user: {
        id: {{ user.id }},
        username: "{{ user.username }}",
        fullName: "{{ user.get_full_name }}",
        full_name: "{{ user.get_full_name }}",
        token: "{{ user.auth_token }}"
    },

    ui: {
        show_side_col: false,
        initial_tool: 'select'
    },

    uploadMaxFileSize: {{ UPLOAD_MAX_FILESIZE }} * Math.pow(2, 20)
};
</script>
{% endblock %}

{% block content_js %}
    {{ block.super }}
81
    <script src="{% static "js/libs/require.min.js" %}" data-main="{% static "js/su_app" %}{{ JS_MIN }}"></script>
Julien Furrer's avatar
Julien Furrer committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
{% endblock %}


{#==========================================#}
{#   MODALS                                 #}
{#==========================================#}
{% block modals %}
    {{ block.super }}
    <div class="modal" id="adim-name-modal">
        <div class="modal-dialog">
            <form class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">Changer le nom de l'image</h4>
                </div>
                <div class="modal-body">
                    <p>Entrer un nouveau nom pour l'image</p>
                    <input type="text" class="form-control" name="imageName" placeholder="Nom de l'image"/>

                    <div class="errors hide">
                        <p>&nbsp;</p>
                        <div class="alert alert-danger">
                            <strong>Erreur</strong> une erreur est survenue lors de l'enregistrement: <br/>
                            <code class="error-text"></code>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                    <button type="submit" class="btn btn-primary">Enregistrer</button>
                </div>
            </form>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div><!-- /.modal -->
{% endblock modals %}

{%  block main_container %}
    {{ block.super }}
{% comment %}<div class="container-fluid" id="main">

    {% if mode != 'review' %}
    <div class="row tool-top-row">
        <div class="col-xs-12">

        </div>
    </div>
    {% endif %}

    <div class="row">
        <div class="col-sm-1" id="tools-col">
            <div class="btn-toolbar" role="toolbar" id="draw-tool-tb">
                <div class="btn-group-vertical">
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="select" id="tool-select" data-tool-name="select">
                        <span class="icon-cursor"></span><span class="tool-text"> Select</span>
                    </label>
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="pan" id="tool-pan" data-tool-name="pan">
                        <span class="icon-handdrag"></span><span class="tool-text"> Pan</span>
                    </label>

                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="drawing" id="tool-drawing" data-tool-name="drawing">
                        <span class="icon-pencil"></span><span class="tool-text"> Dessin</span>
                    </label>
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="lines" id="tool-lines" data-tool-name="lines">
                        <span class="icon-line"></span><span class="tool-text"> Lignes</span>
                    </label>
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="ellipse" id="tool-ellipse" data-tool-name="ellipse">
                        <span class="icon icon-elipse"></span><span class="tool-text"> Cercle</span>
                    </label>
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="rectangle" id="tool-rectangle" data-tool-name="rectangle">
                        <span class="icon icon-rectangle"></span><span class="tool-text"> Rectangle</span>
                    </label>
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="arrow" id="tool-arrow" data-tool-name="arrow">
                        <span class="icon icon-arrow-right"></span><span class="tool-text"> Flèche</span>
                    </label>
                    <label class="btn btn-lg-off btn-primary">
                        <input type="radio" name="toolType" value="text" id="tool-text" data-tool-name="text">
                        <span class="icon-font"></span><span class="tool-text"> Texte</span>
                    </label>
                </div>
            </div>
            <span class="tool-sep">&nbsp;</span>
            <div class="btn-toolbar" role="toolbar" id="param-tool-tb">
                <div class="btn-group-vertical">
                    <!--button type="button" class="btn btn-default" id="tool-fill-color" title="Contours ou remplissage" style="color: #444"
                            data-toggle="button" data-attr-name="fill" autocomplete="off">
                        <span class="tool-fill-on icon-pattern hide"></span>
                        <span class="tool-fill-off icon-roundrectangle"></span>
                        <span class="tool-text">Plein</span>
                    </button-->

                    <!--div class="btn-group dropright" id="tool-colorselect">
                        <button type="button" class="btn btn-default tinter dropdown-toggle" autocomplete="off"
                                data-toggle="dropdown" data-attr-name="color">
                            <span class="icon-palette-painting"></span><span class="tool-text"> Couleur</span>
                        </button>
                        <ul class="dropdown-menu color-menu">
                            <li role="presentation"><a href="#" class="c1" role="menuitem" tabindex="-1">&nbsp;</a></li>
                            <li role="presentation"><a href="#" class="c2" role="menuitem" tabindex="-1">&nbsp;</a></li>
                            <li role="presentation"><a href="#" class="c3" role="menuitem" tabindex="-1">&nbsp;</a></li>
                            <li role="presentation"><a href="#" class="c4" role="menuitem" tabindex="-1">&nbsp;</a></li>
                            <li role="presentation"><a href="#" class="c5" role="menuitem" tabindex="-1">&nbsp;</a></li>
                            <li role="presentation"><a href="#" class="c6" role="menuitem" tabindex="-1">&nbsp;</a></li>

                            <li role="presentation">
                                <a href="#" class="cx picker" role="menuitem" tabindex="-1" data-colorpicker-guid="3" data-color="rgba(128, 23, 212,0.66)" data-color-format="rgba" style="background-color: rgba(128, 23, 212,0.66)">
                                    <div class="color-overlay" style="background-color: rgba(128, 23, 212,0.66)" >&nbsp;</div>
                                </a>
                            </li>
                        </ul>
                    </div-->

                    <button class="btn btn-default" id="attr-orderup" type="button" style="color: #444" autocomplete="off"
                            title="Mettre au premier plan. shift-click: avancer de un niveau">
                        <span class="icon-layerorderup"></span>
                    </button>

                    <button class="btn btn-default" id="attr-orderdown" type="button" style="color: #444" autocomplete="off"
                            title="Mettre à l'arrière-plan. shift-click: reculer d'un niveau">
                        <span class="icon-layerorderdown"></span>
                    </button>

                    <button class="btn btn-default" id="attr-font" type="button" style="color: #444" autocomplete="off">
                        <span class="icon-fontcase"></span>
                    </button>

                    <div class="sldr" id="attr-size-slider">
                        <div class="small tool-title" title="Epaisseur du trait">Taille</div>
                        <input type="text" class="slider" value="7" autocomplete="off"
                               data-attr-name="size">
                    </div>

                </div>

            </div>

        </div>

        <div class="col-sm-9" id="canvas-col">
            <div class="canvas-container well">
                <canvas id="my-canvas" width="480" height="360"></canvas>
            </div>

            <div id="canvas-bbar">
                <div id="attr-zoom" class="toolbar-control">
                    <label>Zoom: &nbsp;</label>
                    <div class="input-group">
                        <input type="number" size="3" class="form-control" name="zoomLevel">
                        <span class="input-group-addon" style="border-left:none">%</span>
                        {# <span class="input-group-addon btn" title="Zoom pour afficher toute l'image" id="but-zoom-fit"><span class="glyphicon glyphicon-resize-small"></span></span> #}
                    </div>
                    <div class="sldr">
                        <input type="text" class="slider" value="100" data-attr-name="zoom" autocomplete="off"
                               data-slider-min="10" data-slider-max="800" data-slider-value="100">
                    </div>
                </div>
                <div class="tb-sep"></div>
                <div id="img-opacity" class="toolbar-control">
                    <label title="Opacité de l'image">Image:  &nbsp</label>
                    <div class="sldr" id="attr-imgopacity-slider" >
                        <input type="text" class="slider" value="100" autocomplete="off"
                               data-attr-name="imgopacity" data-slider-min="0" data-slider-max="100" />
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-2" id="side-col">
            <div class="row"><div class="container">
                {% if mode == 'edit' %}
                <div class="row"><div class="col-xs-10 col-xs-offset-2">
                    <div class="btn-group">
                        <button class="btn btn-sm btn-primary" id="save-but" type="button">
                            <span class="glyphicon glyphicon-save"></span>
                            Enregistrer
                        </button>

                        <button class="btn btn-sm btn-primary" type="button" id="autosave-but" title="Enregistrement automatique">
                            <span class="glyphicon glyphicon glyphicon-repeat"></span>
                        </button>
                    </div>
                </div></div>
                <div class="row">&nbsp;</div>
                {%  endif %}
                <div class="row">
                <div class="col-xs-12 panel-group" id="side-col-panel-group">

                    <div class="panel panel-dark" id="annotation-property-panel">
                        <header class="panel-heading">
                            <h1 class="panel-title">
                                <a data-toggle="collapse" href="#collapseProperties">
                                    Propriétés <span class="pull-right icon-circleup"></span>
                                </a>
                            </h1>
                        </header>
                        <div id="collapseProperties" class="panel-collapse collapse in">
                            <div class="panel-body" id="annotation-property-container">
                                <div class="property-group fill-prop">
                                    <label class="control-label"><small>Remplissage: &nbsp;</small>
                                    <input id="fill-check" name="fill" type="checkbox" />
                                    </label>
                                </div>

                                <div class="property-group comment-prop">
                                    <label class="control-label"><small>Commentaire:</small></label>
                                    <textarea class="form-control" id="prop-annot-comment" name="comment"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div></div></div>
        </div>
    </div>
</div>{% endcomment %}

    <div class="modal" id="dlg-export-svg-info" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <div class="modal-header">
                    <h4>Exportation en cours...</h4>
                </div>
                <div class="modal-body">
                    <p>La génération du svg peut prendre un peu de temps, soyez patient.</p>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>

{%  endblock main_container %}