summaryrefslogtreecommitdiffstats
path: root/web/js/labitrack.d/45-view.js
blob: 27e519b3928364f41092e3fff20c0d2c90f55b7b (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());
					$('.btn_print').click(function(){
						label.print();
						return false;
					});
				},
				error: function(ev){
					λ.setcontent('notfound', {
						action: 'View',
						id: id,
						status: ev.status
					});
				}
			});
		}
	});

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