summaryrefslogtreecommitdiffstats
path: root/web/widget/checkbox.js
blob: 7be08db66868a1750927eef594f12b537e4acebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 2012-2014 Kaarle Ritvanen
 * See LICENSE file for license details
 */

define(["aconf/widget/field", "jquery"], function(Base, $) {
    return Base.extend({
	staticRender: function(value, meta) {
	    return $("<td>").text(value ? "Yes" : "No");
	},

	statusEl: function() { return this.el.parent(); },

	render: function(value, meta) {
	    this.field.attr("type", "checkbox");
	    if (value) this.field.attr("checked", "true");
	},

	get: function() { return this.field.is(":checked"); }
    });
});