openmedialibrary/static/js/annotationPanel.js

82 lines
2.3 KiB
JavaScript
Raw Normal View History

2019-01-23 20:44:59 +05:30
'use strict';
oml.ui.annotationPanel = function() {
2019-01-24 17:32:33 +05:30
var $bar = Ox.Bar({size: 16});
var $button = Ox.Button({
disabled: true,
style: 'symbol',
title: 'add',
2019-01-25 15:56:45 +05:30
tooltip: Ox._('Add Quote'),
2019-01-24 17:32:33 +05:30
type: 'image'
}).bindEvent({
click: function() {
oml.$ui.viewer.postMessage('addAnnotation', {})
}
2019-01-24 17:32:33 +05:30
}).appendTo($bar);
var $menuButton = Ox.MenuButton({
items: [
2019-01-25 15:56:45 +05:30
{id: 'showAnnotations', title: Ox._('Show Annotations'), disabled: true},
{group: 'sort', min: 1, max: 1, items: [
{id: 'all', title: Ox._('All Annotations'), checked: true},
{id: 'my', title: Ox._('My Annotations'), checked: false},
]},
{},
{id: 'sortAnnotations', title: Ox._('Sort Annotations'), disabled: true},
{group: 'sort', min: 1, max: 1, items: [
{id: 'position', title: Ox._('By Position'), checked: true},
2019-02-01 13:49:54 +05:30
{id: 'quote', title: Ox._('By Quote Text'), checked: false},
{id: 'note', title: Ox._('By Note Text'), checked: false},
2019-01-25 15:56:45 +05:30
{id: 'date', title: Ox._('By Date Added'), checked: false}
]},
2019-02-01 14:49:43 +05:30
{},
{id: 'exportAnnotations', title: Ox._('Export Annotations')},
2019-01-24 17:32:33 +05:30
],
style: 'square',
title: 'set',
type: 'image',
width: 16
}).css({
2019-01-25 15:56:45 +05:30
// borderColor: 'transparent',
2019-01-24 17:32:33 +05:30
float: 'right'
2019-02-01 14:49:43 +05:30
}).appendTo($bar)
.bindEvent({
click: function(data) {
var id = data.id;
if (id == 'exportAnnotations') {
oml.api.get({
id: oml.user.ui.item,
keys: []
}, function(result) {
oml.ui.exportAnnotationsDialog(result.data).open()
})
}
}
});
2019-01-24 17:32:33 +05:30
var ui = oml.user.ui;
var that = Ox.SplitPanel({
elements: [
{
element: $bar,
size: 16
},
{
element: oml.$ui.annotationFolder = oml.ui.annotationFolder()
}
],
orientation: 'vertical'
});
2019-01-23 20:44:59 +05:30
that.updateSelection = function(selection) {
$button.options({
disabled: !selection
})
}
2019-01-23 20:44:59 +05:30
return that;
2019-01-24 12:52:40 +05:30
2019-01-23 20:44:59 +05:30
};