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

define(["acf2/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", checked: value});
	},

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