[IMP] board,google_spreadsheet,web,web_calendar: Favorites menu

Adapt the Favorites menu so that addons appending stuff in it are compliant with
the enterprise edition.

Mainly, creation of dashboard.less from of dashboard.sass so that we can use mixins
defined in the web addon.

Some changes as well in the dashboard view to make it compliant with the enterprise
edition.

Use correct naming convention: classnames with underscores, less mixins with hyphens.
This commit is contained in:
Aaron Bohy
2015-07-15 13:32:56 +02:00
parent 45373eb1fc
commit 27df65c878
14 changed files with 219 additions and 335 deletions
-148
View File
@@ -1,148 +0,0 @@
@charset "UTF-8";
.openerp .oe_dashboard_layout_1 .oe_dashboard_column.index_0 {
width: 100%;
}
.openerp .oe_dashboard_layout_1 .oe_dashboard_column.index_1, .openerp .oe_dashboard_layout_1 .oe_dashboard_column.index_2 {
display: none;
}
.openerp .oe_dashboard_layout_1-1 .oe_dashboard_column {
width: 50%;
}
.openerp .oe_dashboard_layout_1-1 .oe_dashboard_column.index_2 {
display: none;
}
.openerp .oe_dashboard_layout_1-1-1 .oe_dashboard_column {
width: 33%;
}
.openerp .oe_dashboard_layout_2-1 .oe_dashboard_column.index_0 {
width: 70%;
}
.openerp .oe_dashboard_layout_2-1 .oe_dashboard_column.index_1 {
width: 30%;
}
.openerp .oe_dashboard_layout_2-1 .oe_dashboard_column.index_2 {
display: none;
}
.openerp .oe_dashboard_layout_1-2 .oe_dashboard_column.index_0 {
width: 30%;
}
.openerp .oe_dashboard_layout_1-2 .oe_dashboard_column.index_1 {
width: 70%;
}
.openerp .oe_dashboard_layout_1-2 .oe_dashboard_column.index_2 {
display: none;
}
.openerp .oe_dashboard_layout_selector ul {
white-space: nowrap;
}
.openerp .oe_dashboard_layout_selector li {
margin: 0;
padding: 0;
list-style-type: none;
float: left;
}
.openerp .oe_dashboard_layout_selector li .oe_dashboard_selected_layout {
margin-left: -30px;
vertical-align: bottom;
margin-bottom: 10px;
}
.openerp .oe_dashboard_links {
text-align: right;
margin: 0 4px 6px 0;
}
.openerp .oe_dashboard {
width: 100%;
}
.openerp .oe_dashboard .oe_action {
margin: 0 8px 8px 0;
background-color: white;
border: 1px solid;
border-color: #e5e5e5 #dbdbdb #d2d2d2;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}
.oe_dashboard .oe_action input:focus{
outline: none;
border: 1px solid #21b799;
}
.openerp .oe_dashboard .oe_action .oe_header {
font-size: 16px;
vertical-align: middle;
margin: 0;
padding: 12px;
-moz-border-radius: 3px 3px 0 0;
-webkit-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
}
.openerp .oe_dashboard .oe_action .oe_header:hover {
cursor: move;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_icon {
float: right;
cursor: pointer;
color: #b3b3b3;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_icon:hover {
color: #666;
text-decoration: none;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_close:after {
content: "×";
margin-left: 4px;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_minimize:after {
content: "-";
margin-left: 4px;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_maximize:after {
content: "+";
margin-left: 4px;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_header_text {
visibility: hidden;
cursor: text;
}
.openerp .oe_dashboard .oe_action .oe_header span {
cursor: pointer;
}
.openerp .oe_dashboard .oe_action .oe_header_empty {
padding-top: 0;
padding-bottom: 2px;
}
.openerp .oe_dashboard .oe_action .oe_button_create {
margin-left: 4px;
padding: 0 4px 0 4px;
height: 16px !important;
}
.openerp .oe_dashboard .oe_action .oe_content {
padding: 0 12px 12px 12px;
}
.openerp .oe_dashboard .oe_action .oe_content .oe-view-manager {
display: block;
}
.openerp .oe_dashboard .oe_action .oe_content .oe-view-manager-content {
display: block;
position: static;
}
.openerp .oe_dashboard .oe_action .oe_content .oe-view-manager-view-kanban {
position: static;
}
.openerp .oe_dashboard .oe_action .oe_content .oe_list_content > thead {
border-bottom: 1px;
}
.openerp .oe_dashboard .oe_action .oe_content .oe_list_content > tbody tr:nth-child(odd) {
background: transparent;
}
.openerp .oe-search-options .add-to-dashboard button {
margin: 3px 25px;
display: none;
}
.openerp .oe-search-options .add-to-dashboard input {
width: calc(100% - 50px);
margin: 3px 25px;
display: none;
}
-128
View File
@@ -1,128 +0,0 @@
@charset "utf-8"
@mixin radius($radius: 5px)
-moz-border-radius: $radius
-webkit-border-radius: $radius
border-radius: $radius
@mixin box-shadow($bsval: 0px 1px 4px #777)
-moz-box-shadow: $bsval
-webkit-box-shadow: $bsval
box-shadow: $bsval
.openerp
.oe_dashboard_layout_1 .oe_dashboard_column
&.index_0
width: 100%
&.index_1, &.index_2
display: none
.oe_dashboard_layout_1-1 .oe_dashboard_column
width: 50%
&.index_2
display: none
.oe_dashboard_layout_1-1-1 .oe_dashboard_column
width: 33%
.oe_dashboard_layout_2-1 .oe_dashboard_column
&.index_0
width: 70%
&.index_1
width: 30%
&.index_2
display: none
.oe_dashboard_layout_1-2 .oe_dashboard_column
&.index_0
width: 30%
&.index_1
width: 70%
&.index_2
display: none
.oe_dashboard_layout_selector
ul
white-space: nowrap
li
margin: 0
padding: 0
list-style-type: none
float: left
.oe_dashboard_selected_layout
margin-left: -30px
vertical-align: bottom
margin-bottom: 10px
.oe_dashboard_links
text-align: right
margin: 0 4px 6px 0
.oe_dashboard
width: 100%
.oe_action
margin: 0 8px 8px 0
background-color: white
border: 1px solid
border-color: #e5e5e5 #dbdbdb #d2d2d2
@include radius(3px)
@include box-shadow(0 0 2px rgba(0,0,0,0.2))
.oe_header
font-size: 16px
vertical-align: middle
margin: 0
padding: 12px
@include radius(3px 3px 0 0)
//border-bottom: 1px dotted #dbdbdb
//@include radius(2px 2px 0 0)
//@include vertical-gradient(#FCFCFC, #DEDEDE)
&:hover
cursor: move
.oe_icon
float: right
cursor: pointer
color: #b3b3b3
&:hover
color: #666
text-decoration: none
.oe_close:after
content: "×"
margin-left: 4px
.oe_minimize:after
content: "-"
margin-left: 4px
.oe_maximize:after
content: "+"
margin-left: 4px
.oe_header_text
visibility: hidden
cursor: text
span
cursor: pointer
.oe_header_empty
padding-top: 0
padding-bottom: 2px
.oe_button_create
margin-left: 4px
padding: 0 4px 0 4px
height: 16px !important
.oe_content
padding: 0 12px 12px 12px
.oe-view-manager
display: block
.oe-view-manager-content
display: block
position: static
.oe-view-manager-view-kanban
position: static
.oe_list_content
> thead
border-bottom: 1px
> tbody
tr:nth-child(odd)
background: transparent
.oe-search-options
.add-to-dashboard
button
margin: 3px 25px
display: none
input
width: calc(100% - 50px)
margin: 3px 25px
display: none
+11 -11
View File
@@ -33,7 +33,7 @@ var DashBoard = form_common.FormWidget.extend({
start: function() {
var self = this;
this._super.apply(this, arguments);
this.$el.addClass('o-dashboard');
this.$el.addClass('o_dashboard');
this.$('.oe_dashboard_column').sortable({
connectWith: '.oe_dashboard_column',
@@ -341,14 +341,15 @@ FavoriteMenu.include({
if (am && am.get_inner_widget() instanceof ViewManager) {
this.view_manager = am.get_inner_widget();
this.add_to_dashboard_available = true;
this.$('.favorites-menu').append(QWeb.render('SearchView.addtodashboard'));
var $add_to_dashboard = this.$('.add-to-dashboard');
this.$add_dashboard_btn = $add_to_dashboard.eq(2).find('button');
this.$add_dashboard_input = $add_to_dashboard.eq(1).find('input');
this.$add_dashboard_link = $add_to_dashboard.first();
this.$('.o_favorites_menu').append(QWeb.render('SearchView.addtodashboard'));
this.$add_to_dashboard = this.$('.o_add_to_dashboard');
this.$add_dashboard_btn = this.$add_to_dashboard.eq(1).find('button');
this.$add_dashboard_input = this.$add_to_dashboard.eq(0).find('input');
this.$add_dashboard_link = this.$('.o_add_to_dashboard_link');
var title = this.searchview.get_title();
this.$add_dashboard_input.val(title);
this.$add_dashboard_link.click(function () {
event.preventDefault();
self.toggle_dashboard_menu();
});
this.$add_dashboard_btn.click(this.proxy('add_dashboard'));
@@ -356,11 +357,10 @@ FavoriteMenu.include({
},
toggle_dashboard_menu: function (is_open) {
this.$add_dashboard_link
.toggleClass('closed-menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('open-menu', is_open);
this.$add_dashboard_btn.toggle(is_open);
this.$add_dashboard_input.toggle(is_open);
if (this.$add_dashboard_link.hasClass('open-menu')) {
.toggleClass('o-closed-menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('o_open_menu', is_open);
this.$add_to_dashboard.toggle(is_open);
if (this.$add_dashboard_link.hasClass('o_open_menu')) {
this.$add_dashboard_input.focus();
}
},
+140
View File
@@ -0,0 +1,140 @@
.o_dashboard {
// Dashboard layout
.oe_dashboard_layout_1 .oe_dashboard_column {
&.index_0 {
width: 100%;
}
&.index_1, &.index_2 {
display: none;
}
}
.oe_dashboard_layout_1-1 .oe_dashboard_column {
width: 50%;
&.index_2 {
display: none;
}
}
.oe_dashboard_layout_1-1-1 .oe_dashboard_column {
width: 33%;
}
.oe_dashboard_layout_2-1 .oe_dashboard_column {
&.index_0 {
width: 70%;
}
&.index_1 {
width: 30%;
}
&.index_2 {
display: none;
}
}
.oe_dashboard_layout_1-2 .oe_dashboard_column {
&.index_0 {
width: 30%;
}
&.index_1 {
width: 70%;
}
&.index_2 {
display: none;
}
}
// Layout selector
.oe_dashboard_links {
text-align: right;
margin: 0 4px 6px 0;
}
// Dashboard content
.oe_dashboard {
width: 100%;
.oe_action {
margin: 0 8px 8px 0;
background-color: white;
border: 1px solid;
border-color: #e5e5e5 #dbdbdb #d2d2d2;
margin: 0 8px 8px 0;
.oe_header {
font-size: 16px;
vertical-align: middle;
margin: 0;
padding: 12px;
&:hover {
cursor: move;
}
.oe_icon {
float: right;
cursor: pointer;
color: #b3b3b3;
&:hover {
color: #666;
text-decoration: none;
}
}
.oe_close:after {
content: "×";
margin-left: 4px;
}
.oe_minimize:after {
content: "-";
margin-left: 4px;
}
.oe_maximize:after {
content: "+";
margin-left: 4px;
}
.oe_header_text {
width: auto;
visibility: hidden;
display: inline-block;
cursor: text;
}
span {
cursor: pointer;
}
}
.oe_header_empty {
padding-top: 0;
padding-bottom: 2px;
}
.oe_button_create {
margin-left: 4px;
padding: 0 4px 0 4px;
height: 16px !important;
}
.oe_content {
padding: 0 12px 12px 12px;
}
// Override border of many2manytags defined for form_views
.o_kanban_view .o_kanban_record .oe_kanban_list_many2many .o_form_field_many2manytags {
border: none;
}
}
}
}
// Layout selector modal
.oe_dashboard_layout_selector {
ul {
white-space: nowrap;
}
li {
margin: 0;
padding: 0;
list-style-type: none;
float: left;
}
.oe_dashboard_selected_layout {
margin-left: -30px;
vertical-align: bottom;
margin-bottom: 10px;
}
}
// Favorites menu in control panel
.o_add_to_dashboard {
display: none; // hidden by default
.o-search-options-dropdown-custom-li;
}
+9 -3
View File
@@ -60,8 +60,14 @@
</t>
<t t-name="SearchView.addtodashboard">
<li class="add-to-dashboard closed-menu"><a>Add to my Dashboard</a></li>
<li class="add-to-dashboard"><input class="form-control" type="text"/></li>
<li class="add-to-dashboard"><button type="button" class="btn btn-default">Add</button></li>
<li class="o_add_to_dashboard_link o_closed_menu">
<a href="#">Add to my Dashboard</a>
</li>
<li class="o_add_to_dashboard">
<input class="o_add_to_dashboard_input" type="text"/>
</li>
<li class="o_add_to_dashboard">
<button type="button" class="btn btn-primary btn-sm o_add_to_dashboard_button">Add</button>
</li>
</t>
</template>
+1 -1
View File
@@ -3,7 +3,7 @@
<data>
<template id="assets_backend" name="board assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/board/static/src/css/dashboard.css"/>
<link rel="stylesheet" href="/board/static/src/less/dashboard.less"/>
<script type="text/javascript" src="/board/static/src/js/dashboard.js"></script>
</xpath>
</template>
@@ -34,7 +34,7 @@ FavoriteMenu.include({
});
if (am && am.get_inner_widget() instanceof ViewManager) {
this.view_manager = am.get_inner_widget();
this.$('.favorites-menu').append(QWeb.render('SearchView.addtogooglespreadsheet'));
this.$('.o_favorites_menu').append(QWeb.render('SearchView.addtogooglespreadsheet'));
this.$('.add-to-spreadsheet').click(this.add_to_spreadsheet.bind(this));
}
},
+4 -11
View File
@@ -1289,13 +1289,6 @@
top: 3px;
content: "";
}
.openerp .oe-search-options .open-menu a:before {
font-family: FontAwesome;
position: absolute;
left: 9px;
top: 3px;
content: "";
}
.openerp .oe-search-options .oe-select-group {
margin: 3px 25px;
}
@@ -1506,16 +1499,16 @@
.openerp .oe_pivot .dropdown-menu .pivot-dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.openerp .o-dashboard .oe_pivot th {
.openerp .o_dashboard .oe_pivot th {
border-top: 1px solid #bfbfb6;
}
.openerp .o-dashboard .oe_pivot th, .openerp .o-dashboard .oe_pivot .oe-closed, .openerp .o-dashboard .oe_pivot .oe-opened {
.openerp .o_dashboard .oe_pivot th, .openerp .o_dashboard .oe_pivot .oe-closed, .openerp .o_dashboard .oe_pivot .oe-opened {
border-left: 1px solid #bfbfb6;
}
.openerp .o-dashboard .oe_graph svg {
.openerp .o_dashboard .oe_graph svg {
min-height: 250px;
}
.openerp .o-dashboard .oe_graph .nv-pieLabels {
.openerp .o_dashboard .oe_graph .nv-pieLabels {
display: none;
}
.openerp .oe_graph {
+1 -16
View File
@@ -1095,21 +1095,6 @@ $sheet-padding: 16px
.filters-menu
.divider
display: list-item
.closed-menu
a:before
font-family: FontAwesome
position: absolute
left: 12px
top: 3px
content: "\f0da"
.open-menu
a:before
font-family: FontAwesome
position: absolute
left: 9px
top: 3px
content: "\f0d7"
.oe-select-group
margin: 3px 25px
.oe-add-group
@@ -1283,7 +1268,7 @@ $sheet-padding: 16px
.pivot-dropdown-submenu:hover
> .dropdown-menu
display: block
.o-dashboard
.o_dashboard
.oe_pivot
th
border-top: 1px solid #bfbfb6
@@ -68,10 +68,10 @@ return Widget.extend({
},
toggle_save_menu: function (is_open) {
this.$save_search
.toggleClass('closed-menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('open-menu', is_open);
.toggleClass('o_closed_menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('o_open_menu', is_open);
this.$save_name.toggle(is_open);
if (this.$save_search.hasClass('open-menu')) {
if (this.$save_search.hasClass('o_open_menu')) {
this.$save_name.find('input').first().focus();
}
},
@@ -320,10 +320,10 @@ return Widget.extend({
},
toggle_custom_filter_menu: function (is_open) {
this.$add_filter
.toggleClass('closed-menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('open-menu', is_open);
.toggleClass('o_closed_menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('o_open_menu', is_open);
this.$add_filter_menu.toggle(is_open);
if (this.$add_filter.hasClass('closed-menu') && (!this.propositions.length)) {
if (this.$add_filter.hasClass('o_closed_menu') && (!this.propositions.length)) {
this.append_proposition();
}
this.$('.oe-filter-condition').toggle(is_open);
@@ -428,10 +428,10 @@ return Widget.extend({
},
toggle_add_menu: function (is_open) {
this.$add_group
.toggleClass('closed-menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('open-menu', is_open);
.toggleClass('o_closed_menu', !(_.isUndefined(is_open)) ? !is_open : undefined)
.toggleClass('o_open_menu', is_open);
this.$add_group_menu.toggle(is_open);
if (this.$add_group.hasClass('open-menu')) {
if (this.$add_group.hasClass('o_open_menu')) {
this.$group_selector.focus();
}
},
@@ -292,3 +292,39 @@
}
}
}
// Search options dropdowns
.o-search-options-dropdown-custom-li() {
margin: 3px 25px;
width: auto;
max-width: 250px;
}
// Open and closed carets in dropdowns
.o_closed_menu {
position: relative;
a:before {
.o-caret-right;
.o-position-absolute(@top: 50%, @left: 12px);
margin-top: (-@caret-width-base);
}
}
.o_open_menu {
position: relative;
a:before {
.o-caret-down;
.o-position-absolute(@top: 50%, @left: 9px);
margin-top: (-@caret-width-base);
}
}
// Favorites Menu -> Add to my dashboard
.o_favorites_menu {
.o_add_to_dashboard_input {
.form-control();
}
.o_add_to_dashboard_button {
.btn();
.btn-default();
}
}
+4 -4
View File
@@ -1638,7 +1638,7 @@
<span class="fa fa-filter"/> Filters <span class="caret"/>
</button>
<ul class="dropdown-menu filters-menu" role="menu">
<li class="oe-add-filter closed-menu"><a>Add Custom Filter</a></li>
<li class="oe-add-filter o_closed_menu"><a>Add Custom Filter</a></li>
<li class="oe-add-filter-menu"><button type="button" class="btn btn-default oe-apply-filter">Apply</button><a class="oe-add-condition"><span class="fa fa-plus-circle"/> Add a condition</a></li>
</ul>
</div>
@@ -1649,7 +1649,7 @@
</button>
<ul class="dropdown-menu group-by-menu" role="menu">
<li class="divider"/>
<li class="add-custom-group closed-menu"><a>Add custom group</a></li>
<li class="add-custom-group o_closed_menu"><a>Add custom group</a></li>
</ul>
</div>
@@ -1665,9 +1665,9 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-star"/> Favorites <span class="caret"/>
</button>
<ul class="dropdown-menu favorites-menu" role="menu">
<ul class="dropdown-menu o_favorites_menu" role="menu">
<li class="divider"/>
<li class="oe-save-search closed-menu"><a>Save current search</a></li>
<li class="oe-save-search o_closed_menu"><a>Save current search</a></li>
<li class="oe-save-name"><input type="text" class="form-control"></input></li>
<li class="oe-save-name">
<span><input type="checkbox"/>Use by default</span>
+2 -2
View File
@@ -1203,7 +1203,7 @@ odoo.define_section('search.serialization', ['web.search_inputs', 'web.SearchVie
"filters menu has been drawn");
assert.ok(view.$buttons.find('.group-by-menu').length,
"group by menu has been drawn");
assert.ok(view.$buttons.find('.favorites-menu').length,
assert.ok(view.$buttons.find('.o_favorites_menu').length,
"favorites menu has been drawn");
});
});
@@ -1235,7 +1235,7 @@ odoo.define_section('search.filters', ['web.search_inputs', 'web.SearchView', 'w
return view.appendTo($fix)
.done(function () {
var $filters = view.$buttons.find('.filters-menu li'),
$favorites = view.$buttons.find('.favorites-menu li'),
$favorites = view.$buttons.find('.o_favorites_menu li'),
$groupby = view.$buttons.find('.group-by-menu li');
// 3 filters, 1 separator, 1 button add filter,
// 1 filter condition menu, 1 apply button
@@ -137,7 +137,7 @@
}
}
.o-dashboard {
.o_dashboard {
.o_calendar_container .o_calendar_sidebar_container {
display: none;
}