-
Notifications
You must be signed in to change notification settings - Fork 0
/
EasyBookmarks.js
93 lines (83 loc) · 2.41 KB
/
EasyBookmarks.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
define( [
'qlik',
'text!./template.ng.html',
'text!./dialog-template.ng.html',
'text!./delete-template.ng.html',
'ng!$q'
],
function ( qlik, template, dialogTemplate, deleteTemplate, $q) {
'use strict';
return {
support: {
export: false,
exportData: false,
snapshot: false
},
template: template,
controller: ['$scope', 'luiDialog', function ( $scope, luiDialog ) {
var app = qlik.currApp();
var myBasicRow = {
"qInfo": {
"qId": "0",
"qType": "bookmark"
},
"qMeta": {
"title": "- Select a bookmark -",
"description": "- Select a bookmark -",
"published": true
},
"qData": {
"title": "- Select a bookmark -"
}
}
$scope.selectedBookmark = "0";
app.getList( 'BookmarkList', function ( items ) {
$scope.bookmarks = items.qBookmarkList.qItems;
$scope.bookmarks.push(myBasicRow);
})
$scope.alertValue = function(){
var aplyBookmark = $('#repeatSelect').find('option:selected')[0].value;
app.bookmark.apply(aplyBookmark);
}
$scope.defaultSelect = function (){
$('#repeatSelect option[value="0"]').prop("selected", true);
}
$scope.verifyOwner = function(){
var vPub = $('#repeatSelect').find('option:selected').attr("name");
if(!vPub || vPub == 'false'){
$('#delId').prop('disabled', false);
}else{
$('#delId').prop('disabled', true);
}
}
$scope.openDialog = function() {
luiDialog.show({
template: dialogTemplate,
input: {
name : $scope.name,
description : $scope.description
},
controller: ['$scope', function( $scope ) {
$scope.text = 'Plase, confirm you want to delete the bookmark';
$scope.create = function(){
name = $('#name').val();
app.bookmark.create(name,$('#description').val());
}
}]
});
};
$scope.deleteDialog = function() {
var aplyBookmark = $('#repeatSelect').find('option:selected')[0].value;
luiDialog.show({
template: deleteTemplate,
controller: ['$scope', function( $scope ) {
$scope.text = 'Plase, confirm you want to delete the bookmark';
$scope.delete = function(){
app.bookmark.remove(aplyBookmark);
}
}]
});
};
}]
};
});