-
Notifications
You must be signed in to change notification settings - Fork 1
/
Session.js
58 lines (55 loc) · 1.76 KB
/
Session.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
function Session(session) {
this.id = session.id;
this.title = session.title;
this.authors = session.authors;
this.session_type = session.session_type;
this.tags = session.tags || [];
this.details = session.details || "regular";
this.audience_limit = session.audience_limit || undefined;
this.track = session.track;
this.audience_level = session.audience_level;
this.slides = session.slides || undefined;
this.summary = session.summary;
this.authorsDisplayName = function(){
return this.authors[0].name + (this.authors.length == 2 ? " e " + this.authors[1].name : "")
};
this.type = function () {
return this.session_type;
};
this.informationFor = function (cell) {
var div = $("<div>").addClass("sessionInfo")
.appendTo(cell);
var level = $("<div>").addClass("level")
.text(this.audience_level)
.appendTo(cell);
var title = $("<a>").attr("href", "#" + this.id)
.attr("target", "_parent")
.attr("data-id", this.id)
.text(this.title)
.appendTo(div);
var author = $("<span>").addClass("authors")
.text(this.authorsDisplayName())
.appendTo(div);
if (this.audience_limit !== undefined) {
var limit = $("<span>").addClass("limit")
.text("Limite: " + this.audience_limit + " participantes");
limit.appendTo(div);
}
var track = $("<div>").addClass("track")
.text(this.track)
.appendTo(cell);
if (false) { //not yet
var material = $("<a>").addClass("slides")
.attr("href", this.slides)
.attr("target", "_blank")
.text("SLIDES")
.appendTo(cell);
}
var classes = this.details + " ";
for (var i = this.tags.length - 1; i >= 0; i--) {
var tag = this.tags[i].replace(/ /g, "-");
classes += tag + " ";
}
cell.addClass(classes);
};
}