Commit b5f2cfbe authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

Fix metadata button

parent 818a9305
......@@ -133,23 +133,16 @@ $(document).ready(function() {
$('#export-button').tooltipster('content', $("#export-tip").html());
$('#save-button').tooltipster('content', $("#save-tip").html());
$('#conll-button').tooltipster('content', $("#conll-tip").html());
});
// ==================================================================================
function fill_metadata(meta) {
if (meta === undefined || meta.length == 0) {
$('#md').hide();
$('#meta-collapse').hide();
} else {
html = ""
meta.forEach(item => {
html += '<p><b>' + item.key + ' = </b>' + item.value + '</p>\n';
});
$('#metadata').html(html);
$('#md').show();
$('#meta-collapse').show();
}
}
$('[data-toggle="collapse"]').click(function() {
$(this).toggleClass("active");
if ($(this).hasClass("active")) {
$(this).html('Metadata <span id="md-icon" class="glyphicon glyphicon-chevron-down"></span>');
} else {
$(this).html('Metadata <span id="md-icon" class="glyphicon glyphicon-chevron-right"></span>');
}
});
});
// ==================================================================================
function set_default() {
......@@ -632,7 +625,13 @@ function display_picture(event) {
}, "fast");
current_view = event.data.i;
fill_metadata(event.data.meta);
app.meta = event.data.meta;
if ("url" in app.meta) {
app.doc_url = app.meta.url;
delete app.meta.url;
} else {
app.doc_url = "";
}
$("#svg-link").attr("href", event.data.url);
......
......@@ -6,6 +6,9 @@ var app = new Vue({
clust1_whether: "",
clust2: "no", // 3 possible values: no, key or whether
doc_url: "",
meta: {},
},
});
......
......@@ -289,14 +289,14 @@
<div id="display-sentence" style="display: none;">
<div id="passage-text" class="passage">
<div id="meta-panel" class="panel panel-default" style="margin-bottom:4px;">
<a id="md" onclick="toggle_metadata_icon()" data-toggle="collapse" href="#meta-collapse" class="collapsed">
<button class="btn btn-primary btn-sm">Metadata
<span id="md-icon" class="glyphicon glyphicon-chevron-right"> </span>
</button>
</a>
<button v-show="Object.keys(meta).length > 0" class="btn btn-primary btn-sm" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Metadata <span id="md-icon" class="glyphicon glyphicon-chevron-right"></span>
</button>
<a v-if='doc_url != ""' class="btn btn-primary btn-sm tooltip-desc" :href="doc_url" target="_blank">Doc <span class="glyphicon glyphicon-link"></span></a>
<button type="button" id="conll-button" class="btn btn-primary btn-sm tooltip-desc" onclick="javascript:one_conll()">
CoNLL
<span href="" class="glyphicon glyphicon-export"></span>
......@@ -309,15 +309,14 @@
</a>
</div>
<div id="meta-collapse" class="panel-collapse collapse">
<div class="collapse" id="collapseExample">
<div id="metadata" class="panel-body">
</div>
<p v-for='(item, itemKey) in meta'>
<span><b>{{itemKey}}</b>: {{item}}</span>
</p>
</div>
<h4 id="sentence-txt"></h4>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment