Gitlab CSE Unil

annotation.html 5.53 KB
Newer Older
Julien Furrer's avatar
Julien Furrer committed
1
{% extends "adim/base_annotation.html" %}
Julien Furrer's avatar
Julien Furrer committed
2
3
{% load static i18n %}

Julien Furrer's avatar
Julien Furrer committed
4
5
6
7
{% block page_title %}
    {{ block.super }} - {{ anobj.name|truncatechars:"32" }}
{% endblock %}

Julien Furrer's avatar
Julien Furrer committed
8
9
{%  block navbar_content %}
    <ul class="nav navbar-nav">
10
        <li><a href="#" class="adim-image-name {{ is_owner|yesno:",read-only" }}">
Julien Furrer's avatar
Julien Furrer committed
11
12
13
14
15
16
17
18
            <span class="text">{{ anobj.name }}</span>
        </a></li>
    </ul>
    {{ block.super }}
{%  endblock navbar_content %}

{% block navbar_right_content %}
    <li>
Julien Furrer's avatar
Julien Furrer committed
19
20
21
22
23
24
25
26
27
28
        <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">
            {% block navbar_export_options %}
                <li><a id="btn-export-image-png" href="#">PNG</a></li>
                <li><a id="btn-export-image-svg" href="#">SVG</a></li>
            {% endblock navbar_export_options %}
        </ul>
Julien Furrer's avatar
Julien Furrer committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    </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 }}",
47
48
    staticUrl: "{% static "" %}",
    baseUrl: "{% url "adim.app:annotate-new" %}",
49
    userEngine: { remoteUrl: "{% url "adim.app:suggest-users" %}?q=%QUERY" },
50

Julien Furrer's avatar
Julien Furrer committed
51
52
    api: {
        baseUrl: "{% url "api-root" %}",
53
        annotables: "{% if is_owner %}{% url "anobjs-list" %}{% else %}{% url "shared-anobjs-list" %}{% endif %}",
Julien Furrer's avatar
Julien Furrer committed
54
        annotations: "{% url "annotations-list" %}"
Julien Furrer's avatar
Julien Furrer committed
55
56
57
58
    },

    annotable: {
        id: {{ anobj.id }},
59
        uuid: '{{ anobj.uuid }}',
Julien Furrer's avatar
Julien Furrer committed
60
61
        title: '{{ anobj.name|escapejs }}',
        slug: '{{ anobj.name|slugify }}',
62
        locked: {{ anobj.locked|yesno:"true,false" }},
63
        ttpShared: {% if anobj.sharing_mode > 15 %}true{% else %}false{% endif %},
64
        env: '{{ anobj.env }}',
65
        image: '{{ anobj.image_url|default:"image/" }}',
66
67
        thumbnail: 'thumb/'
{#        image: '{% url "adim.app:ao_image" anobj_uuid=anobj.uuid %}'#}
Julien Furrer's avatar
Julien Furrer committed
68
69
70
71
72
73
74
75
    },
    users: {},

    user: {
        id: {{ user.id }},
        username: "{{ user.username }}",
        fullName: "{{ user.get_full_name }}",
        full_name: "{{ user.get_full_name }}",
76
        token: "{{ user.auth_token }}"
77
        {% if membership %}
78
        ,membership: { publish_mode: {{ membership.publish_mode }} }
79
        {% endif %}
80
        ,guest: {{ is_owner|yesno:"false,true" }}
81
        ,shibboleth: true
Julien Furrer's avatar
Julien Furrer committed
82
83
84
    },

    ui: {
85
        show_side_col: true,
86
87
        initial_tool: 'select',
        show_users_results: {{ display_shared_annotations|yesno:"true,false" }}
Julien Furrer's avatar
Julien Furrer committed
88
89
    },

90
91
    aai: {slo: {{ AAI_CFG.SLO|yesno:"true,false" }} },

Julien Furrer's avatar
Julien Furrer committed
92
93
    thumbnailSize: parseInt("{{ THUMB_SIZE.0 }}", 10),
    uploadMaxFileSize: parseInt('{{ UPLOAD_MAX_FILESIZE }}',10) * Math.pow(2, 20)
Julien Furrer's avatar
Julien Furrer committed
94
};
95
96
console.time("complete app");
console.time("main app loading");
Julien Furrer's avatar
Julien Furrer committed
97
98
99
100
101
</script>
{% endblock %}

{% block content_js %}
    {{ block.super }}
102
    <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
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
{% 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 %}

142
{% block main_container %}
Julien Furrer's avatar
Julien Furrer committed
143
    {{ block.super }}
144
{#    <img src='{{ anobj.image_url|default:"./image/" }}' crossorigin="anonymous" id="adim-src-image" style="display:none;">#}
Julien Furrer's avatar
Julien Furrer committed
145
146
147
148
149
150
151
152
153
154
155
156
157
158

    <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>
159
{% endblock main_container %}
Julien Furrer's avatar
Julien Furrer committed
160