Skip to content

Commit

Permalink
[FIX] web,*: various nocontent helper fixes
Browse files Browse the repository at this point in the history
* account, board, hr_holidays, mail, sale, website_sale

Small fixes on nocontent onboarding screens.

Initial commit: a87d761

Details:

- list: centered;
- pivot/graph: centered + empty folder face;
- Dashboard app with nocontent helper;
- Discuss inbox/starred: centered without neutral/smiling faces;
    => no faces because it's too much with animated
       rainbow man when emptying the any of the boxes.
- hr_holidays: fixed onboarding screens;
- (technical) dropped obsolete 'o_view_nocontent_container' style;
- manual reconciliation 'nothing to reconcile': centered + inside form sheet;
    => renamed account's o_view_nocontent to o_view_noreconciliation,
       so that it doesn't use the style of views.less.
- kanban: nocontent helper above the columns (if any);
- texts "no order to upsell"/"abandonned cart" paragraph split in two.
  • Loading branch information
alexkuhn committed Feb 16, 2018
1 parent 4c186f3 commit aa8745f
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 85 deletions.
2 changes: 1 addition & 1 deletion addons/account/static/src/less/account_reconciliation.less
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
clear: both;
}

.o_view_nocontent {
.o_view_noreconciliation {
max-width: none;
padding: 0 10%;
color: @odoo-main-color-muted;
Expand Down
6 changes: 3 additions & 3 deletions addons/account/static/src/xml/account_reconciliation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<div class="pull-right text-muted">Tip: Hit CTRL-Enter to reconcile all the balanced items in the sheet.</div>
</div>
<div t-else="" class="o_view_nocontent">
<div t-else="" class="o_view_noreconciliation">
<p>Nothing to do!</p>
<p>This page displays all the bank transactions that are to be reconciled and provides with a neat interface to do so.</p>
</div>
Expand All @@ -41,8 +41,8 @@
<attribute name="class">o_manual_statement</attribute>
</t>
<t t-jquery="h1:last, .progress, .o_automatic_reconciliation" t-operation="replace"></t>
<t t-jquery=".o_view_nocontent p" t-operation="replace"></t>
<t t-jquery=".o_view_nocontent" t-operation="append">
<t t-jquery=".o_view_noreconciliation p" t-operation="replace"></t>
<t t-jquery=".o_view_noreconciliation" t-operation="append">
<p><b>Good Job!</b> There is nothing to reconcile.</p>
<p>All invoices and payments have been matched, your accounts' balances are clean.</p>
</t>
Expand Down
4 changes: 3 additions & 1 deletion addons/board/static/src/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ FormRenderer.include({
return element.tag === "action"? element: false;
});
});
this.$el.toggleClass('o_dashboard_nocontent', !hasAction);
if (!hasAction) {
return $(QWeb.render('DashBoard.NoContent'));
}

// We should start with three columns available
node = $.extend(true, {}, node);
Expand Down
7 changes: 0 additions & 7 deletions addons/board/static/src/less/dashboard.less
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
.o_dashboard {

// no content help
&.o_dashboard_nocontent {
.o-flex-display();
.o-align-content(center);
.o-justify-content(center);
}

// Dashboard layout
.oe_dashboard_layout_1 .oe_dashboard_column {
&.index_0 {
Expand Down
16 changes: 16 additions & 0 deletions addons/board/static/src/xml/board.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@
</ul>
</div>
</t>
<t t-name="DashBoard.NoContent">
<div class="o_view_nocontent">
<div class="o_nocontent_help">
<p class="o_view_nocontent_neutral_face">
Your personal dashboard is empty
</p><p>
To add your first report into this dashboard, go to any
menu, switch to list or graph view, and click <i>"Add to
Dashboard"</i> in the extended search options.
</p><p>
You can filter and group data before inserting into the
dashboard using the search options.
</p>
</div>
</div>
</t>
<t t-name="DashBoard.xml">
<form t-att-string="form_title">
<board t-att-style="style">
Expand Down
8 changes: 4 additions & 4 deletions addons/board/static/tests/dashboard_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ QUnit.test('dashboard basic rendering', function (assert) {

assert.ok(form.renderer.$el.hasClass('o_dashboard'),
"with a dashboard, the renderer should have the proper css class");
assert.strictEqual(form.$('.o_dashboard .o_view_nocontent').length, 0,
"should not have a no content helper");
assert.strictEqual(form.$('.o_dashboard .o_view_nocontent').length, 1,
"should have a no content helper");
assert.strictEqual(form.get('title'), "My Dashboard",
"should have the correct title");
form.destroy();
Expand All @@ -93,8 +93,8 @@ QUnit.test('display the no content helper', function (assert) {
},
});

assert.strictEqual(form.$('.o_dashboard .o_view_nocontent').length, 0,
"should not have a no content helper with action help");
assert.strictEqual(form.$('.o_dashboard .o_view_nocontent').length, 1,
"should have a no content helper with action help");
form.destroy();
});

Expand Down
12 changes: 0 additions & 12 deletions addons/board/views/board_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
<field name="view_mode">form</field>
<field name="usage">menu</field>
<field name="view_id" ref="board_my_dash_view"/>
<field name="help" type="html">
<p class="o_view_nocontent_neutral_face">
Your personal dashboard is empty
</p><p>
To add your first report into this dashboard, go to any
menu, switch to list or graph view, and click <i>'Add to
Dashboard'</i> in the extended search options.
</p><p>
You can filter and group data before inserting into the
dashboard using the search options.
</p>
</field>
</record>

<!--My Dashboard Menu-->
Expand Down
4 changes: 2 additions & 2 deletions addons/hr_holidays/report/hr_leave_reports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
]
}</field>
<field name="help" type="html">
<p class="o_view_nocontent_create">
Click here to create a new leave request.
<p class="o_view_nocontent_smiling_face">
Create a new leave request
</p>
</field>
<field name="domain">[('holiday_type','=','employee')]</field>
Expand Down
8 changes: 4 additions & 4 deletions addons/hr_holidays/views/hr_leave_allocation_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_create">
Click here to create a new leave allocation request.
<p class="o_view_nocontent_smiling_face">
Create a new leave allocation request
</p>
</field>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
Expand All @@ -164,8 +164,8 @@
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_department':1, 'search_default_approve':1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_create">
Click here to create a new leave allocation.
<p class="o_view_nocontent_smiling_face">
Create a new leave allocation
</p>
</field>
<field name="search_view_id" ref="view_hr_leave_allocation_filter"/>
Expand Down
26 changes: 11 additions & 15 deletions addons/mail/static/src/xml/thread.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,18 @@
</t>

<!-- When a channel is empty-->
<div t-name="mail.EmptyChannel" class="o_mail_no_content o_view_nocontent_container">
<div t-name="mail.EmptyChannel" class="o_mail_no_content">
<div class="o_view_nocontent">
<t t-if="options.channel_id==='channel_inbox'">
<p class="o_view_nocontent_smiling_face">
Congratulations, your inbox is empty
</p><p>
New messages appear here.
</p>
</t>
<t t-if="options.channel_id==='channel_starred'">
<p class="o_view_nocontent_neutral_face">
No starred message
</p><p>
You can mark any message as 'starred', and it shows up in this channel.
</p>
</t>
<div class="o_nocontent_help">
<t t-if="options.channel_id==='channel_inbox'">
<p>Congratulations, your inbox is empty</p>
<p>New messages appear here.</p>
</t>
<t t-if="options.channel_id==='channel_starred'">
<p>No starred message</p>
<p>You can mark any message as 'starred', and it shows up in this channel.</p>
</t>
</div>
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions addons/sale/views/sale_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@
</p><p>
These are orders with products invoiced based on ordered quantities,
in the case you have delivered more than what was ordered.
</p><p>
A typical example is the pre-paid hours of service,
where you want to sell extra hours to the customer
because the initial hours have already been used.
Expand Down
1 change: 0 additions & 1 deletion addons/web/static/src/js/views/graph/graph_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ return AbstractRenderer.extend({
* @returns {Deferred} The _super deferred is actually resolved immediately
*/
_render: function () {
this.$el.toggleClass('o_view_nocontent_container', !this.state.data.length);
if (this.to_remove) {
nv.utils.offWindowResize(this.to_remove);
}
Expand Down
10 changes: 0 additions & 10 deletions addons/web/static/src/js/views/kanban/kanban_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,6 @@ var KanbanRenderer = BasicRenderer.extend({
}
}
},
/**
* @private
* @override
* adds a specific class to the kanban helper so that it can be targetted by specific css
*/
_renderNoContentHelper: function() {
var $el = this._super.apply(this, arguments);
$el.toggleClass('o_kanban_view_nocontent',true)
return $el;
},
/**
* Renders an ungrouped kanban view in a fragment.
*
Expand Down
1 change: 0 additions & 1 deletion addons/web/static/src/js/views/list/list_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ var ListRenderer = BasicRenderer.extend({
this.pagers = [];

var displayNoContentHelper = !this._hasContent() && !!this.noContentHelp;
this.$el.toggleClass('o_view_nocontent_container', displayNoContentHelper);
// display the no content helper if there is no data to display
if (displayNoContentHelper) {
this.$el.html(this._renderNoContentHelper());
Expand Down
15 changes: 4 additions & 11 deletions addons/web/static/src/less/views.less
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,11 @@
}

// No content helper
.o_view_nocontent_container {
.o-flex-display();
height: 100%;
padding: 0;
}

.o_view_nocontent {
&.o_kanban_view_nocontent {
.o-position-absolute(20%, 0, 0, 0);
pointer-events: none;
}

.o-position-absolute(20%, 0, 0, 0);
pointer-events: none;
z-index: 1;

.o_nocontent_help {
pointer-events: auto;
max-width: 650px;
Expand Down
22 changes: 13 additions & 9 deletions addons/web/static/src/xml/base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,10 @@
</div>
</t>
<div t-name="GraphView.error" class="o_view_nocontent" >
<p class="o_view_nocontent_empty_folder"><t t-esc="title"/></p>
<p><t t-esc="description"/></p>
<div class="o_nocontent_help">
<p class="o_view_nocontent_empty_folder"><t t-esc="title"/></p>
<p><t t-esc="description"/></p>
</div>
</div>

<div t-name="PivotView" class="o_pivot">
Expand Down Expand Up @@ -539,14 +541,16 @@
</t>
</ul>
</t>
<div t-name="PivotView.nodata" class="o_view_nocontent_container" >
<div t-name="PivotView.nodata">
<div class="o_view_nocontent">
<p class="o_view_nocontent_empty_folder">
No data to display
</p><p>
Try to add some records, or make sure
that there is at least one measure and no active filter in the search bar.
</p>
<div class="o_nocontent_help">
<p class="o_view_nocontent_empty_folder">
No data to display
</p><p>
Try to add some records, or make sure
that there is at least one measure and no active filter in the search bar.
</p>
</div>
</div>
</div>

Expand Down
5 changes: 1 addition & 4 deletions addons/web/static/tests/views/kanban_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ QUnit.module('Views', {
});

QUnit.test('no content helper when no data', function (assert) {
assert.expect(4);
assert.expect(3);

var records = this.data.partner.records;

Expand Down Expand Up @@ -2139,9 +2139,6 @@ QUnit.module('Views', {
this.data.partner.records = records;
kanban.reload();

assert.notOk(kanban.$el.hasClass('o_view_nocontent_container'),
"$el should have removed no content class");

assert.strictEqual(kanban.$('.o_view_nocontent').length, 0,
"should not display the no content helper");
kanban.destroy();
Expand Down
2 changes: 2 additions & 0 deletions addons/website_sale/views/sale_order_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
</p><p>
You'll find here all the carts abandoned by your visitors, if they completed their address.
You should send them a recovery email!
</p><p>
The time to mark a cart as abandoned can be changed in the settings.
</p>
</field>
Expand Down Expand Up @@ -142,6 +143,7 @@
</p><p>
You'll find here all the carts abandoned by your visitors, if they completed their address.
You should send them a recovery email!
</p><p>
The time to mark a cart as abandoned can be changed in the settings.
</p>
</field>
Expand Down

0 comments on commit aa8745f

Please sign in to comment.