[IMP] website: Remove the suggested app on the website dashboard

This commit is contained in:
Dhawal Limbuwala
2017-12-05 13:13:21 +01:00
committed by Yannick Tivisse
parent 0b19e1737e
commit 109857949d
4 changed files with 2 additions and 95 deletions
-8
View File
@@ -11,13 +11,6 @@ class WebsiteBackend(http.Controller):
def fetch_dashboard_data(self, date_from, date_to):
has_group_system = request.env.user.has_group('base.group_system')
has_group_designer = request.env.user.has_group('website.group_website_designer')
if has_group_system:
apps_data = dict((app['name'], app) for app in request.env['ir.module.module'].sudo().search_read(
['|', ('name', 'ilike', 'website'), ('application', '=', True)],
['id', 'sequence', 'name', 'shortdesc', 'state'],
order='sequence ASC'))
else:
apps_data = {}
dashboard_data = {
'groups': {
'system': has_group_system,
@@ -25,7 +18,6 @@ class WebsiteBackend(http.Controller):
},
'currency': request.env.user.company_id.currency_id.id,
'dashboards': {
'apps_data': apps_data,
'visits': {},
}
}
@@ -10,8 +10,6 @@ var session = require('web.session');
var web_client = require('web.web_client');
var Widget = require('web.Widget');
var local_storage = require('web.local_storage');
var _t = core._t;
var QWeb = core.qweb;
@@ -29,7 +27,6 @@ var Dashboard = Widget.extend(ControlPanelMixin, {
'click .js_link_analytics_settings': 'on_link_analytics_settings',
'click .o_dashboard_action': 'on_dashboard_action',
'click .o_dashboard_action_form': 'on_dashboard_action_form',
'click .o_dashboard_hide_panel': 'on_dashboard_hide_panel',
},
init: function(parent, context) {
@@ -38,7 +35,6 @@ var Dashboard = Widget.extend(ControlPanelMixin, {
this.date_range = 'week'; // possible values : 'week', 'month', year'
this.date_from = moment().subtract(1, 'week');
this.date_to = moment();
this.hidden_apps = JSON.parse(local_storage.getItem('website_dashboard_hidden_app_ids') || '[]');
this.dashboards_templates = ['website.dashboard_visits'];
this.graphs = [];
@@ -277,18 +273,6 @@ var Dashboard = Widget.extend(ControlPanelMixin, {
});
},
on_dashboard_hide_panel: function (ev) {
ev.preventDefault();
ev.stopPropagation();
var $action = $(ev.currentTarget);
// update hidden module list
this.hidden_apps = JSON.parse(local_storage.getItem('website_dashboard_hidden_app_ids') || '[]');
this.hidden_apps.push(JSON.parse($action.data('module_id')));
local_storage.setItem('website_dashboard_hidden_app_ids', JSON.stringify(this.hidden_apps));
// remove box
$action.closest(".o_box_item").remove();
},
update_cp: function() {
var self = this;
if (!this.$searchview) {
@@ -152,30 +152,6 @@
background-color: darken(@odoo-brand-primary, 10%);
}
}
&.o_apps {
position: relative;
background-color: @odoo-brand-optional;
color: white;
.o_apps_hidden {
display: none;
&.o_dashboard_hide_panel {
position: absolute;
top: 0px;
right: 0px;
background: @brand-danger;
padding: 6px;
}
}
&:hover {
background-color: #45818E;
.o_apps_show {
display: none;
}
.o_apps_hidden {
display: block;
}
}
}
.o_highlight {
font-size: 27px;
}
@@ -15,53 +15,7 @@
</t>
<t t-name="website.dashboard_header">
<div class="row o_dashboard_common">
<div class="o_box">
<a href="#" class="o_box_item o_dashboard_action" name="website.action_website" title="Go to Website">
<div class="o_inner_box o_primary">
<i class="fa fa-globe fa-3x"></i><br/>
Go to Website
</div>
</a>
<t t-if="widget.groups.system">
<t t-set="apps" t-value="{
'website_crm': {'icon': 'fa-file-text-o', 'help': _('Add a contact form to your Contact Us page.')},
'website_sale': {'icon': 'fa-shopping-cart', 'help': _('Sell online to reach new customers.')},
'website_blog': {'icon': 'fa-rss-square', 'help': _('Build up a community with an efficient content strategy.')},
'website_hr_recruitment': {'icon': 'fa-suitcase', 'help': _('Promote your job announces to attract new talents.')},
'website_event': {'icon': 'fa-ticket', 'help': _('Promote your events, manage attendance and sell tickets.')},
'im_livechat': {'icon': 'fa-comments-o', 'help': _('Chat with your visitors in real time.')},
}"/>
</t>
<t t-if="! widget.groups.system"><t t-set="apps" t-value="{}"/></t>
<t t-set="vignette_max" t-value="6"/>
<t t-set="vignette_nbr" t-value="1"/>
<t t-foreach="apps" t-as="app">
<t t-set="app_data" t-value="widget.dashboards_data.apps_data[app]"/>
<t t-set="app_dashboard" t-value="apps[app]"/>
<t t-if="vignette_nbr &lt; vignette_max &amp;&amp; widget.hidden_apps.indexOf(app_data['id']) == -1 &amp;&amp; app_data['state'] == 'uninstalled'">
<t t-set="vignette_nbr" t-value="vignette_nbr + 1"/>
<a href="#" class="o_box_item o_dashboard_action_form"
name="Apps"
data-res_model="ir.module.module"
t-att-data-res_id="app_data['id']"
t-att-title="app_dashboard['help']">
<div class="o_inner_box o_apps">
<div class="o_apps_show">
<i t-attf-class="fa #{app_dashboard['icon']} fa-3x"></i><br/>
<t t-esc="app_data['shortdesc']"/>
</div>
<div class="o_apps_hidden">
<i class="fa fa-plus-circle fa-3x"></i><br/>
Add this feature
</div>
<i class="o_apps_hidden o_dashboard_hide_panel fa fa-close" t-att-data-module_id="app_data['id']" title="Remove this suggestion from dashboard"/>
</div>
</a>
</t>
</t>
</div>
</div>
<div class="row o_dashboard_common"/>
</t>
<t t-name="website.dashboard_visits">
@@ -111,4 +65,5 @@
<button class="btn btn-sm btn-default js_date_range" data-date="year">Last Year</button>
</div>
</t>
</templates>