summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-05-09 08:58:25 +0200
committerGery Debongnie <ged@openerp.com>2014-05-09 08:58:25 +0200
commitf4860a9fd1a810fd5d256fcb75bb624fa110acef (patch)
tree54600561cae520171da9cac83cd8b0ad51559d23
parent8f55e4519fe26c677bc1ad1bc3b0ee72d03731a4 (diff)
parentb4aa0eb76f8497bf4479b8c27636c464be09e68d (diff)
[MERGE] merge from trunk
bzr revid: ged@openerp.com-20140509065825-s6awt9ql2ley1zpm
-rw-r--r--addons/web/static/src/css/base.css51
-rw-r--r--addons/web/static/src/css/base.sass31
-rw-r--r--addons/web/static/src/js/chrome.js4
-rw-r--r--addons/web/static/src/js/view_form.js102
-rw-r--r--addons/web/static/src/xml/base.xml33
-rw-r--r--addons/web_kanban/static/src/css/kanban.css38
-rw-r--r--addons/web_kanban/static/src/css/kanban.sass16
-rw-r--r--addons/web_kanban/static/src/js/kanban.js88
8 files changed, 306 insertions, 57 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 8534927def1..f02dc3c7fd7 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -1,4 +1,4 @@
-@charset "UTF-8";
+@charset "utf-8";
@font-face {
font-family: "mnmliconsRegular";
src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot");
@@ -426,7 +426,7 @@
text-shadow: 0 0 2px black;
vertical-align: top;
position: relative;
- top: -5px;
+ top: -8px;
}
.openerp .oe_webclient .oe_star_on:hover, .openerp .oe_webclient .oe_star_off:hover {
text-decoration: none;
@@ -449,6 +449,51 @@
border-style: inset;
border-width: 1px;
}
+.openerp .oe_kanban_status {
+ position: relative;
+ display: inline-block;
+ height: 12px;
+ width: 12px;
+ -moz-border-radius: 6px;
+ -webkit-border-radius: 6px;
+ border-radius: 6px;
+ background-position: center center;
+ background-image: -webkit-radial-gradient(circle, #eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
+ background-image: -moz-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
+ background-image: -ms-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
+ background-image: radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
+}
+.openerp .oe_kanban_status_green {
+ background: green;
+ background-position: center center;
+ background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%);
+ background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%);
+ background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%);
+ background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%);
+}
+.openerp .oe_kanban_status_red {
+ background: red;
+ background-position: center center;
+ background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%);
+ background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%);
+ background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%);
+ background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%);
+}
+.openerp .btn-group.kanban_state {
+ padding-top: 8px;
+ margin-right: 4px !important;
+}
+.openerp .btn-group.kanban_state .dropdown-menu {
+ min-width: 100%;
+ padding-right: 10px !important;
+}
+.openerp .btn-group.kanban_state .dropdown-menu li a, .openerp .btn-group.kanban_state .dropdown-menu li a:hover, .openerp .btn-group.kanban_state .dropdown-menu li a:focus {
+ padding-left: 5px;
+ padding-right: 0px;
+}
+.openerp .btn-group.kanban_state a {
+ color: #333333;
+}
.openerp .oe_tag {
border: 1px solid #afafb6;
font-size: 11px;
@@ -777,7 +822,7 @@
background-image: -moz-linear-gradient(top, #fc8787, maroon);
background-image: -ms-linear-gradient(top, #fc8787, maroon);
background-image: -o-linear-gradient(top, #fc8787, maroon);
- background-image: linear-gradient(to bottom, #fc8787, #800000);
+ background-image: linear-gradient(to bottom, #fc8787, maroon);
}
.openerp .navbar .oe_topbar_anonymous_login a {
display: block;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index f1a92f44288..c15c90abb7a 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -404,7 +404,7 @@ $sheet-padding: 16px
text-shadow: 0 0 2px black
vertical-align: top
position: relative
- top: -5px
+ top: -8px
.oe_star_on:hover, .oe_star_off:hover
text-decoration: none
.oe_star_on
@@ -424,7 +424,33 @@ $sheet-padding: 16px
border-style: inset
border-width: 1px
// }}}
-
+ // Kanban state (used in form and kanban) {{{
+ .oe_kanban_status
+ position: relative
+ display: inline-block
+ height: 12px
+ width: 12px
+ @include radius(6px)
+ @include radial-gradient((#eee 0%, #ccc 40%, #bbb 100%))
+ // +background-image(radial-gradient(45px 45px, #0ff 10px, #1e90ff 30px))
+ .oe_kanban_status_green
+ background: green
+ @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%))
+ .oe_kanban_status_red
+ background: red
+ @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%))
+ .btn-group.kanban_state
+ padding-top: 8px
+ margin-right: 4px !important
+ .dropdown-menu
+ min-width: 100%
+ padding-right: 10px !important
+ .dropdown-menu li a, .dropdown-menu li a:hover, .dropdown-menu li a:focus
+ padding-left: 5px
+ padding-right: 0px
+ a
+ color: #333333
+ // }}}
// Tags (for many2many tags, among others) {{{
.oe_tag
border: 1px solid $tag-border
@@ -2752,5 +2778,6 @@ input[type="radio"], input[type="checkbox"]
background-color: black
opacity: 0.6000000238418579
+
// au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css"
// vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 4f12a915a7c..2620e4ed40f 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -859,6 +859,10 @@ instance.web.Menu = instance.web.Widget.extend({
$clicked_menu.parent().addClass('active');
}
}
+ // add a tooltip to cropped menu items
+ this.$secondary_menus.find('.oe_secondary_submenu li a span').each(function() {
+ $(this).tooltip(this.scrollWidth > this.clientWidth ? {title: $(this).text().trim(), placement: 'auto right'} :'destroy');
+ });
},
/**
* Call open_menu with the first menu_item matching an action_id
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 2c68a23dbf9..4c4ba6f004c 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2365,6 +2365,106 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we
}
});
+instance.web.form.KanbanSelection = instance.web.form.FieldChar.extend({
+ init: function (field_manager, node) {
+ this._super(field_manager, node);
+ },
+ prepare_dropdown_selection: function() {
+ var self = this;
+ var data = [];
+ var selection = self.field.selection || [];
+ _.map(selection, function(res) {
+ var value = {
+ 'name': res[0],
+ 'tooltip': res[1],
+ 'state_name': res[1],
+ }
+ if (res[0] == 'normal') { value['state_class'] = 'oe_kanban_status'; }
+ else if (res[0] == 'done') { value['state_class'] = 'oe_kanban_status oe_kanban_status_green'; }
+ else { value['state_class'] = 'oe_kanban_status oe_kanban_status_red'; }
+ data.push(value);
+ });
+ return data;
+ },
+ render_value: function() {
+ var self = this;
+ this.record_id = self.view.datarecord.id;
+ this.states = self.prepare_dropdown_selection();;
+ this.$el.html(QWeb.render("KanbanSelection", {'widget': self}));
+ this.$el.find('.oe_legend').click(self.do_action.bind(self));
+ },
+ do_action: function(e) {
+ var self = this;
+ var li = $(e.target).closest( "li" );
+ if (li.length) {
+ var value = {};
+ value[self.name] = String(li.data('value'));
+ if (self.record_id) {
+ return self.view.dataset._model.call('write', [[self.record_id], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self));
+ } else {
+ return self.view.on_button_save().done(function(result) {
+ if (result) {
+ self.view.dataset._model.call('write', [[result], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self));
+ }
+ });
+ }
+ }
+ },
+ reload_record: function() {
+ this.view.reload();
+ },
+});
+
+instance.web.form.Priority = instance.web.form.FieldChar.extend({
+ init: function (field_manager, node) {
+ this._super(field_manager, node);
+ },
+ prepare_priority: function() {
+ var self = this;
+ var selection = this.field.selection || [];
+ var init_value = selection && selection[0][0] || 0;
+ var data = _.map(selection.slice(1), function(element, index) {
+ var value = {
+ 'value': element[0],
+ 'name': element[1],
+ 'click_value': element[0],
+ }
+ if (index == 0 && self.get('value') == element[0]) {
+ value['click_value'] = init_value;
+ }
+ return value;
+ });
+ return data;
+ },
+ render_value: function() {
+ var self = this;
+ this.record_id = self.view.datarecord.id;
+ this.priorities = self.prepare_priority();
+ this.$el.html(QWeb.render("Priority", {'widget': this}));
+ this.$el.find('.oe_legend').click(self.do_action.bind(self));
+ },
+ do_action: function(e) {
+ var self = this;
+ var li = $(e.target).closest( "li" );
+ if (li.length) {
+ var value = {};
+ value[self.name] = String(li.data('value'));
+ if (self.record_id) {
+ return self.view.dataset._model.call('write', [[self.record_id], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self));
+ } else {
+ return self.view.on_button_save().done(function(result) {
+ if (result) {
+ self.view.dataset._model.call('write', [[result], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self));
+ }
+ });
+ }
+ }
+ },
+ reload_record: function() {
+ this.view.reload();
+ },
+});
+
instance.web.form.FieldID = instance.web.form.FieldChar.extend({
process_modifiers: function () {
this._super();
@@ -6115,6 +6215,8 @@ instance.web.form.widgets = new instance.web.Registry({
'monetary': 'instance.web.form.FieldMonetary',
'many2many_checkboxes': 'instance.web.form.FieldMany2ManyCheckBoxes',
'x2many_counter': 'instance.web.form.X2ManyCounter',
+ 'priority':'instance.web.form.Priority',
+ 'kanban_state_selection':'instance.web.form.KanbanSelection',
'statinfo': 'instance.web.form.StatInfo',
});
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 75d4bdbb1c6..f801e6c7c71 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1029,6 +1029,39 @@
</t>
</span>
</t>
+<t t-name="KanbanSelection">
+ <div class="btn-group kanban_state">
+ <t t-foreach="widget.states" t-as="rec">
+ <a t-if="widget.get('value') === rec.name">
+ <a class="oe_legend dropdown-toggle" data-toggle="dropdown">
+ <span t-att-class="rec.state_class" t-if="widget.get('value') === rec.name" t-att-title="rec.tooltip"/>
+ <span class="sr-only">Toggle Dropdown</span>
+ </a>
+ </a>
+ </t>
+ <ul class="dropdown-menu state" role="menu">
+ <t t-foreach="widget.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_class" t-att-title="rec.tooltip"/>
+ <t t-raw="rec.state_name" /></a>
+ </li>
+ </t>
+ </t>
+ </ul>
+ </div>
+</t>
+<t t-name="Priority">
+ <ul style="list-style: none; padding-left: 2px; display: inline-block;">
+ <t t-foreach="widget.priorities" t-as="rec" >
+ <li t-att-data-value="rec.click_value" class="oe_legend" style="display: inline-block;">
+ <a href="#" t-att-title="rec.name">
+ <span t-att-class="widget.get('value') gte rec.value and 'oe_e oe_star_on' or 'oe_e oe_star_off'">7</span>
+ </a>
+ </li>
+ </t>
+ </ul>
+</t>
<t t-name="FieldEmail">
<span class="oe_form_field oe_form_field_email" t-att-style="widget.node.attrs.style">
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri" target="_blank"/>
diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css
index db43cc00586..5ef666a970e 100644
--- a/addons/web_kanban/static/src/css/kanban.css
+++ b/addons/web_kanban/static/src/css/kanban.css
@@ -9,8 +9,6 @@
.openerp .oe_kanban_view .oe_view_nocontent {
position: relative;
max-width: none;
- z-index: 1;
- width: 100%;
height: 100%;
}
.openerp .oe_kanban_view .oe_view_nocontent .oe_view_nocontent_content {
@@ -77,7 +75,7 @@
text-shadow: 0 0 2px black;
vertical-align: top;
position: relative;
- top: -5px;
+ top: -8px;
}
.openerp .oe_kanban_view .oe_kanban_content .oe_star_on:hover, .openerp .oe_kanban_view .oe_kanban_content .oe_star_off:hover {
text-decoration: none;
@@ -165,9 +163,6 @@
.openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_column_cards {
height: 100%;
}
-.openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_column_cards {
- height: 100%;
-}
.openerp .oe_kanban_view .oe_kanban_aggregates {
padding: 0;
margin: 0px;
@@ -522,37 +517,6 @@
position: relative;
top: 2px;
}
-.openerp .oe_kanban_view .oe_kanban_status {
- position: relative;
- top: 4px;
- display: inline-block;
- height: 12px;
- width: 12px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
- border-radius: 6px;
- background-position: center center;
- background-image: -webkit-radial-gradient(circle, #eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
- background-image: -moz-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
- background-image: -ms-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
- background-image: radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
-}
-.openerp .oe_kanban_view .oe_kanban_status_green {
- background: green;
- background-position: center center;
- background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%);
- background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%);
- background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%);
- background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%);
-}
-.openerp .oe_kanban_view .oe_kanban_status_red {
- background: red;
- background-position: center center;
- background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%);
- background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%);
- background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%);
- background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%);
-}
.openerp .oe_kanban_view .oe_kanban_text_red {
color: #a61300;
font-weight: bold;
diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass
index 77533c1182e..9fe3737a410 100644
--- a/addons/web_kanban/static/src/css/kanban.sass
+++ b/addons/web_kanban/static/src/css/kanban.sass
@@ -105,7 +105,7 @@
text-shadow: 0 0 2px black
vertical-align: top
position: relative
- top: -5px
+ top: -8px
&:hover
text-decoration: none
.oe_star_on
@@ -454,20 +454,6 @@
position: relative
top: 2px
- .oe_kanban_status
- position: relative
- top: 4px
- display: inline-block
- height: 12px
- width: 12px
- @include radius(6px)
- @include radial-gradient((#eee 0%, #ccc 40%, #bbb 100%))
- .oe_kanban_status_green
- background: green
- @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%))
- .oe_kanban_status_red
- background: red
- @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%))
.oe_kanban_text_red
color: #A61300
font-weight: bold
diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index cbc8bfd8fbb..2ea29674d8e 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -1259,7 +1259,95 @@ instance.web_kanban.AbstractField = instance.web.Widget.extend(instance.web_kanb
},
});
+instance.web_kanban.Priority = instance.web_kanban.AbstractField.extend({
+ init: function(parent, field, $node) {
+ this._super.apply(this, arguments);
+ this.name = $node.attr('name')
+ this.parent = parent;
+ },
+ prepare_priority: function() {
+ var self = this;
+ var selection = this.field.selection || [];
+ var init_value = selection && selection[0][0] || 0;
+ var data = _.map(selection.slice(1), function(element, index) {
+ var value = {
+ 'value': element[0],
+ 'name': element[1],
+ 'click_value': element[0],
+ }
+ if (index == 0 && self.get('value') == element[0]) {
+ value['click_value'] = init_value;
+ }
+ return value;
+ });
+ return data;
+ },
+ renderElement: function() {
+ var self = this;
+ this.record_id = self.parent.id;
+ this.priorities = self.prepare_priority();
+ this.$el = $(QWeb.render("Priority", {'widget': this}));
+ this.$el.find('.oe_legend').click(self.do_action.bind(self));
+ },
+ do_action: function(e) {
+ var self = this;
+ var li = $(e.target).closest( "li" );
+ if (li.length) {
+ var value = {};
+ value[self.name] = String(li.data('value'));
+ return self.parent.view.dataset._model.call('write', [[self.record_id], value, self.parent.view.dataset.get_context()]).done(self.reload_record.bind(self.parent));
+ }
+ },
+ reload_record: function() {
+ this.do_reload();
+ },
+});
+
+instance.web_kanban.KanbanSelection = instance.web_kanban.AbstractField.extend({
+ init: function(parent, field, $node) {
+ this._super.apply(this, arguments);
+ this.name = $node.attr('name')
+ this.parent = parent;
+ },
+ prepare_dropdown_selection: function() {
+ var data = [];
+ _.map(this.field.selection || [], function(res) {
+ var value = {
+ 'name': res[0],
+ 'tooltip': res[1],
+ 'state_name': res[1],
+ }
+ if (res[0] == 'normal') { value['state_class'] = 'oe_kanban_status'; }
+ else if (res[0] == 'done') { value['state_class'] = 'oe_kanban_status oe_kanban_status_green'; }
+ else { value['state_class'] = 'oe_kanban_status oe_kanban_status_red'; }
+ data.push(value);
+ });
+ return data;
+ },
+ renderElement: function() {
+ var self = this;
+ this.record_id = self.parent.id;
+ this.states = self.prepare_dropdown_selection();;
+ this.$el = $(QWeb.render("KanbanSelection", {'widget': self}));
+ this.$el.find('.oe_legend').click(self.do_action.bind(self));
+ },
+ do_action: function(e) {
+ var self = this;
+ var li = $(e.target).closest( "li" );
+ if (li.length) {
+ var value = {};
+ value[self.name] = String(li.data('value'));
+ return self.parent.view.dataset._model.call('write', [[self.record_id], value, self.parent.view.dataset.get_context()]).done(self.reload_record.bind(self.parent));
+ }
+ },
+ reload_record: function() {
+ this.do_reload();
+ },
+});
+
instance.web_kanban.fields_registry = new instance.web.Registry({});
+instance.web_kanban.fields_registry.add('priority','instance.web_kanban.Priority');
+instance.web_kanban.fields_registry.add('kanban_state_selection','instance.web_kanban.KanbanSelection');
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: