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
|
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import Workspace from 'components/workspace/main';
import './templates';
export default Marionette.ItemView.extend({
className: 'source-viewer-header-more-actions',
template: Templates['source-viewer-more-actions'],
events: {
'click .js-measures': 'showMeasures',
'click .js-new-window': 'openNewWindow',
'click .js-workspace': 'openInWorkspace',
'click .js-raw-source': 'showRawSource'
},
onRender: function () {
var that = this;
$('body').on('click.component-viewer-more-actions', function () {
$('body').off('click.component-viewer-more-actions');
that.destroy();
});
},
showMeasures: function () {
this.options.parent.showMeasures();
},
openNewWindow: function () {
this.options.parent.getPermalink();
},
openInWorkspace: function () {
var uuid = this.options.parent.model.id;
var RealWorkspace = Workspace.openComponent ? Workspace : require('components/workspace/main');
RealWorkspace.openComponent({ uuid: uuid });
},
showRawSource: function () {
this.options.parent.showRawSources();
},
serializeData: function () {
var options = this.options.parent.options.viewer.options;
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
options: options
});
}
});
|