[IMP]improve the widget for dropdown selection and priority
bzr revid: mba@tinyerp.com-20140508055735-ekt5gh7w119w2i2j
This commit is contained in:
parent
d3410a6924
commit
d9f8f11541
|
@ -3316,7 +3316,6 @@ body.oe_single_form .oe_single_form_container {
|
|||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.tooltip .tooltip-inner .oe_tooltip_help {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
@ -3392,7 +3391,7 @@ input[type="radio"], input[type="checkbox"] {
|
|||
padding-right: 0px;
|
||||
}
|
||||
.openerp .btn-group.state {
|
||||
padding-top: 3px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
.openerp .btn-group.state a {
|
||||
color: #333333;
|
||||
|
@ -3434,7 +3433,3 @@ input[type="radio"], input[type="checkbox"] {
|
|||
background-image: -moz-radial-gradient(#55dd55 0%, #44cc44 40%, #33bb33 100%);
|
||||
background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44cc44 40%, #33bb33 100%);
|
||||
}
|
||||
.openerp .oe_star_left {
|
||||
float: left;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
|
|
@ -2764,7 +2764,7 @@ input[type="radio"], input[type="checkbox"]
|
|||
padding-right: 0px
|
||||
font-size: 13px
|
||||
.btn-group.state
|
||||
padding-top: 3px
|
||||
padding-top: 8px
|
||||
.btn-group.state a
|
||||
color: #333333
|
||||
.btn-group.state a:hover
|
||||
|
@ -2801,9 +2801,5 @@ input[type="radio"], input[type="checkbox"]
|
|||
background-image: radial-gradient(#55dd55 0%, #44cc44 40%, #33bb33 100%)
|
||||
background-image: -moz-radial-gradient(#55dd55 0%, #44cc44 40%, #33bb33 100%)
|
||||
background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44cc44 40%, #33bb33 100%)
|
||||
|
||||
.oe_star_left
|
||||
float: left
|
||||
margin-right: 8px
|
||||
// au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css"
|
||||
// vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:
|
||||
|
|
|
@ -2370,9 +2370,26 @@ instance.web.form.DropdownSelection = instance.web.form.FieldChar.extend({
|
|||
this._super(field_manager, node);
|
||||
},
|
||||
prepare_dropdown_selection: function() {
|
||||
return [{ 'name': 'normal', 'state_name': ' In Progress', 'state_icon': 'status' },
|
||||
{ 'name': 'blocked', 'state_name': ' Blocked', 'state_icon': 'status error' },
|
||||
{ 'name': 'done', 'state_name': ' Ready', 'state_icon': 'status ok' }]
|
||||
var self = this;
|
||||
var data = [];
|
||||
var selection = self.field.selection || [];
|
||||
_.map(selection, function(res) {
|
||||
var state_class;
|
||||
if (res[0] == 'normal')
|
||||
state_class = 'status'
|
||||
else if(res[0] == 'done')
|
||||
state_class = 'status ok'
|
||||
else
|
||||
state_class = 'status error'
|
||||
value = {
|
||||
'name': res[0],
|
||||
'tooltip': res[1],
|
||||
'state_name': res[1],
|
||||
'state_class': state_class
|
||||
}
|
||||
data.push(value)
|
||||
});
|
||||
return data;
|
||||
},
|
||||
render_value: function() {
|
||||
var self = this;
|
||||
|
@ -2381,9 +2398,6 @@ instance.web.form.DropdownSelection = instance.web.form.FieldChar.extend({
|
|||
data['states'] = self.prepare_dropdown_selection();
|
||||
this.$el.html(QWeb.render("DropdownSelection", data));
|
||||
this.$el.find('.oe_legend').click(self.do_action.bind(self));
|
||||
this.$el.on('mouseenter mouseleave', function(e) {
|
||||
self.$el.find('.caret').toggleClass('hidden', e.type == 'mouseleave');
|
||||
});
|
||||
},
|
||||
do_action: function(e) {
|
||||
var self = this;
|
||||
|
@ -2420,9 +2434,9 @@ instance.web.form.Priority = instance.web.form.FieldChar.extend({
|
|||
'legend_name': res[1]
|
||||
}
|
||||
if (res[0] == '0') {
|
||||
value['legend']= '<img src="/web/static/src/img/icons/star-off.png"/>';
|
||||
value['legend']= '<span class="oe_e oe_star_off">7</span>';
|
||||
} else {
|
||||
value['legend']= '<img src="/web/static/src/img/icons/star-on.png"/>';
|
||||
value['legend']= '<span class="oe_e oe_star_on">7</span>';
|
||||
}
|
||||
data.push(value)
|
||||
});
|
||||
|
|
|
@ -1035,7 +1035,7 @@
|
|||
<t t-foreach="states" t-as="rec">
|
||||
<a>
|
||||
<a class="oe_legend dropdown-toggle" data-toggle="dropdown">
|
||||
<span t-att-class="rec.state_icon" t-if="widget.get('value') === rec.name" t-att-title="rec.state_name"></span>
|
||||
<span t-att-class="rec.state_class" t-if="widget.get('value') === rec.name" t-att-title="rec.tooltip" ></span>
|
||||
<span class="sr-only">Toggle Dropdown</span></a>
|
||||
</a>
|
||||
</t>
|
||||
|
@ -1043,7 +1043,7 @@
|
|||
<t t-foreach="states" t-as="rec">
|
||||
<t t-if="widget.get('value') !== rec.name">
|
||||
<li class="oe_legend" t-att-data-value="rec.name" ><a href="#">
|
||||
<span t-att-class="rec.state_icon"/> <t t-raw="rec.state_name" /></a>
|
||||
<span t-att-class="rec.state_class"/> <t t-raw="rec.state_name" /></a>
|
||||
</li>
|
||||
</t>
|
||||
</t>
|
||||
|
@ -1054,12 +1054,12 @@
|
|||
<ul style="list-style: none; padding-left: 2px;">
|
||||
<t t-foreach="legends" t-as="rec" >
|
||||
<t t-if="widget.get('value') gte rec.name and !rec_first">
|
||||
<li t-att-data-value="rec.name" class="oe_star_left oe_legend"><a href="#" t-att-title="rec.legend_name"><t t-raw="rec.legend"/></a></li>
|
||||
<li t-att-data-value="rec.name" class="pull-left oe_legend"><a href="#" t-att-title="rec.legend_name"><t t-raw="rec.legend"/></a></li>
|
||||
</t>
|
||||
</t>
|
||||
<t t-foreach="legends" t-as="rec" >
|
||||
<t t-if="widget.get('value') lt rec.name">
|
||||
<li t-att-data-value="rec.name" class="oe_star_left oe_legend"><a href="#" t-att-title="rec.legend_name"><t t-raw="legends[0].legend"/></a></li>
|
||||
<li t-att-data-value="rec.name" class="pull-left oe_legend"><a href="#" t-att-title="rec.legend_name"><t t-raw="legends[0].legend"/></a></li>
|
||||
</t>
|
||||
</t>
|
||||
</ul>
|
||||
|
|
|
@ -1274,9 +1274,9 @@ instance.web_kanban.Priority = instance.web_kanban.AbstractField.extend({
|
|||
'legend_name': res[1]
|
||||
}
|
||||
if (res[0] == '0') {
|
||||
value['legend'] = '<img src="/web/static/src/img/icons/star-off.png"/>';
|
||||
value['legend'] = '<span class="oe_e oe_star_off">7</span>';
|
||||
} else {
|
||||
value['legend'] = '<img src="/web/static/src/img/icons/star-on.png"/>';
|
||||
value['legend'] = '<span class="oe_e oe_star_on">7</span>';
|
||||
}
|
||||
data.push(value)
|
||||
});
|
||||
|
@ -1318,9 +1318,26 @@ instance.web_kanban.DropdownSelection = instance.web_kanban.AbstractField.extend
|
|||
this.parent = parent;
|
||||
},
|
||||
prepare_dropdown_selection: function() {
|
||||
return [{ 'name': 'normal', 'state_name': ' In Progress', 'state_icon': 'status' },
|
||||
{ 'name': 'blocked', 'state_name': ' Blocked', 'state_icon': 'status error' },
|
||||
{ 'name': 'done', 'state_name': ' Ready', 'state_icon': 'status ok' }]
|
||||
var self = this;
|
||||
var data = [];
|
||||
var selection = self.field.selection || [];
|
||||
_.map(selection, function(res) {
|
||||
var state_class;
|
||||
if (res[0] == 'normal')
|
||||
state_class = 'status'
|
||||
else if(res[0] == 'done')
|
||||
state_class = 'status ok'
|
||||
else
|
||||
state_class = 'status error'
|
||||
value = {
|
||||
'name': res[0],
|
||||
'tooltip': res[1],
|
||||
'state_name': res[1],
|
||||
'state_class': state_class
|
||||
}
|
||||
data.push(value)
|
||||
});
|
||||
return data;
|
||||
},
|
||||
renderElement: function() {
|
||||
var self = this;
|
||||
|
@ -1329,9 +1346,6 @@ instance.web_kanban.DropdownSelection = instance.web_kanban.AbstractField.extend
|
|||
data['states'] = self.prepare_dropdown_selection();
|
||||
this.$el = $(QWeb.render("DropdownSelection", data));
|
||||
this.$el.find('.oe_legend').click(self.do_action.bind(self));
|
||||
this.$el.on('mouseenter mouseleave', function(e) {
|
||||
self.$el.find('.caret').toggleClass('hidden', e.type == 'mouseleave');
|
||||
});
|
||||
},
|
||||
do_action: function(e) {
|
||||
var self = this;
|
||||
|
|
Loading…
Reference in New Issue