Gitlab CSE Unil

annotation.html 5.17 KB
Newer Older
Julien Furrer's avatar
Julien Furrer committed
1
2
3
4
5
6
7
{% extends "adim_app/base_annotation.html" %}
{% load static i18n %}

{%  block navbar_content %}
    <ul class="nav navbar-nav">
        <li><a href="#" class="adim-image-name">
            <span class="text">{{ anobj.name }}</span>
8
{#            &nbsp;<span class="glyphicon glyphicon-pencil" style="font-size: 12px;"></span>#}
Julien Furrer's avatar
Julien Furrer committed
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
        </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 }}",
42
43
    staticUrl: "{% static "" %}",
    baseUrl: "{% url "adim.app:annotate-new" %}",
44
    userEngine: { remoteUrl: "{% url "adim.app:suggest-users" %}?q=%QUERY" },
45

Julien Furrer's avatar
Julien Furrer committed
46
47
    api: {
        baseUrl: "{% url "api-root" %}",
48
        annotables: "{% if anobj.owner == user %}{% url "anobj-list" %}{% else %}{% url "shared-anobj-list" %}{% endif %}",
Julien Furrer's avatar
Julien Furrer committed
49
50
51
52
53
        annotations: "{% url "annotation-list" %}"
    },

    annotable: {
        id: {{ anobj.id }},
54
        uuid: '{{ anobj.uuid }}',
Julien Furrer's avatar
Julien Furrer committed
55
56
        title: '{{ anobj.name|escapejs }}',
        slug: '{{ anobj.name|slugify }}',
57
        image: '{{ anobj.image_url|default:"image/" }}',
58
59
        thumbnail: 'thumb/'
{#        image: '{% url "adim.app:ao_image" anobj_uuid=anobj.uuid %}'#}
Julien Furrer's avatar
Julien Furrer committed
60
61
62
63
64
65
66
67
    },
    users: {},

    user: {
        id: {{ user.id }},
        username: "{{ user.username }}",
        fullName: "{{ user.get_full_name }}",
        full_name: "{{ user.get_full_name }}",
68
        token: "{{ user.auth_token }}",
69
70
71
        {% if membership %}
        membership: { publish_mode: {{ membership.publish_mode }} },
        {% endif %}
72
        guest: {% if anobj.owner.id != user.id %}true{% else %}false{% endif %}
Julien Furrer's avatar
Julien Furrer committed
73
74
75
    },

    ui: {
76
        show_side_col: true,
77
78
        initial_tool: 'select',
        show_users_results: {{ display_shared_annotations|yesno:"true,false" }}
Julien Furrer's avatar
Julien Furrer committed
79
80
    },

Julien Furrer's avatar
Julien Furrer committed
81
82
    thumbnailSize: parseInt("{{ THUMB_SIZE.0 }}", 10),
    uploadMaxFileSize: parseInt('{{ UPLOAD_MAX_FILESIZE }}',10) * Math.pow(2, 20)
Julien Furrer's avatar
Julien Furrer committed
83
};
84
85
console.time("complete app");
console.time("main app loading");
Julien Furrer's avatar
Julien Furrer committed
86
87
88
89
90
</script>
{% endblock %}

{% block content_js %}
    {{ block.super }}
91
    <script type="application/javascript" src="{% static "js/libs/require.min.js" %}" data-main="{% static "js/su_app" %}{{ JS_MIN }}"></script>
Julien Furrer's avatar
Julien Furrer committed
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
{% 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 }}
133
{#    <img src='{{ anobj.image_url|default:"./image/" }}' crossorigin="anonymous" id="adim-src-image" style="display:none;">#}
Julien Furrer's avatar
Julien Furrer committed
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

    <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 %}