summaryrefslogtreecommitdiffstats
path: root/web/js/labitrack.d/45-view.js
blob: c94bc9e6a682380d242a3bcb46be20e062c6e27c (plain) (blame)
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
(function(){
	var view = λ.routableview.extend({
		render: function (id) {
			var o = λ.o.get(id, {
				success: function(){
					λ.setcontent('view', {'id': id});
					var canvas = $('#label')[0];
					var label = new λ.label();
					label.set_canvas(canvas);
					label.set_data(o.toJSON());
					$('.bnt_print').die().click(function(){
						label.print();
						return false;
					});
				},
				error: function(ev){
					λ.setcontent('notfound', {
						action: 'View',
						id: id,
						status: ev.status
					});
				}
			});
		}
	});

	view.route('view/:id', 'view');
}());