diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-03-02 23:40:18 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-03-02 23:40:18 +0100 |
| commit | de11e467514971fa5cedfeb029626c24de6500a6 (patch) | |
| tree | 4a011583b450d29f379c9a82ac5f230b95fdc60f /addons | |
| parent | ee7d866def4ec63328e5ffce7659722a841648e9 (diff) | |
[IMP] view_form: radio button css
bzr revid: chm@openerp.com-20130302224018-olnclhjzug3edrmx
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web/static/src/css/base.css | 12 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 11 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 23 |
3 files changed, 26 insertions, 20 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 018f9f7bbe4..00246de578c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2283,6 +2283,18 @@ display: inline-block; min-width: 70px; } +.openerp .oe_form_field_radio .oe_radio_input { + cursor: pointer; + display: inline-block; + width: 20px; + background: transparent url(/web/static/src/img/icons/star-off.png) no-repeat 0px 0px; +} +.openerp .oe_form_field_radio .oe_radio_input_on { + background: transparent url(/web/static/src/img/icons/star-on.png) no-repeat 0px 0px; +} +.openerp .oe_form_field_radio .oe_radio_label { + cursor: help; +} .openerp .oe_form_field_progressbar.ui-progressbar { height: 22px; font-size: 10px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 0a73728678d..b922b76cdcd 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -476,7 +476,16 @@ $sheet-padding: 16px .oe_tag_dark background: $tag-bg-dark color: #eee - + .oe_form_field_radio + .oe_radio_input + cursor: pointer + display: inline-block + width: 20px + background: transparent url(/web/static/src/img/icons/gtk-no.png) no-repeat 0px 0px + .oe_radio_input_on + background: transparent url(/web/static/src/img/icons/gtk-yes.png) no-repeat 0px 0px + .oe_radio_label + cursor: help .oe_tags &.oe_inline min-width: 250px diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index d4cb08ef331..4605d362dc7 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2776,21 +2776,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan }); } }); -/* -<select t-if="!widget.get('effective_readonly')" - t-att-name="widget.name" - t-att-tabindex="widget.node.attrs.tabindex" - t-att-autofocus="widget.node.attrs.autofocus" - t-att-id="widget.id_for_label"> - <t t-foreach="widget.values" t-as="option"> - <option> - <t t-esc="widget.node.attrs.placeholder" t-if="option[0] === false and widget.node.attrs.placeholder"/> - <t t-esc="option[1]" t-if="option[0] !== false"/> - </option> - </t> - </select> -*/ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { template: 'FieldRadio', @@ -2807,7 +2793,7 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w if (this.horizontal) { var width = Math.floor(100 / self.field.selection.length); if (!this.noradiolabel) { - var $tr = $('<tr/>'); + var $tr = $('<tr class="oe_radio_header"/>'); _.each(this.field.selection, function (value) { $tr.append('<th width="' + width + '%">' + value[1] + "</th>"); }); @@ -2820,7 +2806,7 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w this.$table.append($column); } } - this.$el.on('click', '.oe_radio_button,.oe_radio_label', function (event) { + this.$el.on('click', '.oe_radio_input,.oe_radio_label', function (event) { if (!self.get("effective_readonly")) { var value = $(event.target).attr('data'); if (!self.field.required && value == self.get_value()) { @@ -2832,19 +2818,18 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w }, render_value_input: function (value) { var check = value[0] == this.get_value(); - return '<span class="oe_radio_button ' + (check ? 'oe_radio_button_on' : '') + '" data="' + value[0] + '">' + check + '</span>'; + return '<span class="oe_radio_input ' + (check ? 'oe_radio_input_on' : '') + '" data="' + value[0] + '"> </span>'; }, render_value: function () { var self = this; + this.$table.find("tr:not(.oe_radio_header)").remove(); if (this.horizontal) { - this.$table.find(!this.noradiolabel ? "tr:not(:first)": "tr").remove(); var $tr = $('<tr/>'); _.each(this.field.selection, function (value) { $tr.append('<td>' + self.render_value_input(value) + '</td>'); }); this.$table.append($tr); } else { - this.$table.find("tr").remove(); _.each(this.field.selection, function (value) { self.$table.append('<tr><td>' + self.render_value_input(value) + '</td>' + (!self.noradiolabel ? '<th class="oe_radio_label" data="' + value[0] + '">' + value[1] + '</th>' : '') +'</tr>'); }); |
