Newer
Older
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
$(function() {
var template = $('#handlebars_resource_index').html();
Resource.handlebars_resource_index_script = Handlebars.compile(template);
$( "#languages" ).on('iconselectmenuchange', function() {
var option = this.value;
switch(option) {
case 'lang-pl':
Resource.handlebars_resource_index_script = Handlebars.compile(template);
break;
case 'lang-en':
Resource.handlebars_resource_index_script = Handlebars.compile(template);
break;
}
});
});
Resource.showModal = function(title, body) {
$('#info_modal_title').html("" + title);
$('#info_modal_body').html("" + body);
return true;
}
Resource.prototype.showInfo = function() {
if (document.body.className == 'pl') {
Resource.showModal(this.infoData.description.pl.fullName, this.infoData.description.pl.description);
} else {
console.log(this.infoData.description.en);
Resource.showModal(this.infoData.description.en.fullName, this.infoData.description.en.description);
}
}
Resource.prototype.showIndexElement = function () {
var _html;
this.infoData.description.pl.idn = this.id;
this.infoData.description.pl.url = this.infoData.url;
this.infoData.description.pl.imgSrc = this.id + ".png";
this.infoData.description.en.idn = this.id;
this.infoData.description.en.url = this.infoData.url;
this.infoData.description.en.imgSrc = this.id + ".png";
_html = Resource.handlebars_resource_index_script(this.infoData.description);
// var _html = Resource.handlebars_resource_index_script(this.infoData.description.pl);
/*console.log("THIS INFODATA DESCRIPTION PL:::");
console.log(this.infoData.description.pl);
_html += "<div>Test</div>";*/
el = this.tag.append(_html);
el = el.children("div#lexpresource_" + this.id);
$("[rel=tooltip]").tooltip({html:true});
var _this = this,
counter = 0;
el.click(function (event) {
var arrow = $(this).find('.arrow');
var specificClass = 'arrow';
var checkIfTargetHasSpecificClass = event.target.className.indexOf(specificClass) > -1;
if(event.target.nodeName != "SPAN" || checkIfTargetHasSpecificClass) {
if(_this.element.state == "hidden" || _this.element.state == "empty") {
$(arrow[0]).removeClass("glyphicon-chevron-down");
$(arrow[0]).addClass("glyphicon-chevron-up");
} else {
$(arrow[0]).removeClass("glyphicon-chevron-up");
$(arrow[0]).addClass("glyphicon-chevron-down");
}
_this.element.toggle();
}
});
}
function Resource(id, infoData, tag, lexp) {
this.tag = tag;
this.id = id;
this.infoData = infoData;
this.lexp = lexp;
this.showIndexElement();
this.element = new Element($("#lexpelement_" + this.id), this.id, this.infoData, this.lexp);
}