[MERGE] tiles style

bzr revid: al@openerp.com-20111208114722-1tko0x521cf3r2qk
This commit is contained in:
Antony Lesuisse 2011-12-08 12:47:22 +01:00
commit a5b31d465e
5 changed files with 199 additions and 140 deletions

View File

@ -1080,15 +1080,7 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
// TODO: add actual loading if there is url state to unpack, test on window.location.hash
// not logged in
if (!this.session.uid) { return; }
var ds = new openerp.web.DataSetSearch(this, 'res.users');
ds.read_ids([this.session.uid], ['action_id'], function (users) {
var home_action = users[0].action_id;
if (!home_action) {
self.default_home();
return;
}
self.execute_home_action(home_action[0], ds);
})
self.action_manager.do_action({type: 'ir.actions.client', tag: 'default_home'});
},
default_home: function () {
},

View File

@ -309,3 +309,53 @@
.oe-static-home-tile-text p {
margin: 0.5em 0;
}
.openerp .oe_installer {
width: 980px;
}
.openerp .oe_installer h1, .openerp .oe_installer h3 {
margin: 16px 24px;
color: #555
}
.openerp .oe_installer li {
float: left;
list-style: none;
}
.openerp .oe_installer li img {
display: block;
margin: 12px auto 16px;
height: 64px;
width: 64px;
}
.openerp .oe_installer li div {
color: #555;
}
.openerp .oe_installer li a {
display: block;
height: 120px;
width: 194px;
border: 1px solid #f4f2f2;
margin: 6px;
padding: 12px;
text-align: center;
text-transform: uppercase;
text-decoration: none;
font-size: 12px;
font-weight: 800;
background: white;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-ms-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: 0 1px 2px #bbb;
-webkit-box-shadow: 0 1px 2px #bbb;
-o-box-shadow: 0 1px 2px #bbb;
box-shadow: 0 1px 2px #bbb;
}

View File

@ -318,90 +318,6 @@ openerp.web_dashboard.ConfigOverview = openerp.web.View.extend({
}
});
/*
* ApplicationTiles
* This client action designed to be used as a dashboard widget display
* either a list of application to install (if none is installed yet) or
* a list of root menu
*/
openerp.web.client_actions.add( 'board.home.applications', 'openerp.web_dashboard.ApplicationTiles');
openerp.web_dashboard.apps = {
applications: [
[
{
module: 'crm', name: 'CRM',
help: "Acquire leads, follow opportunities, manage prospects and phone calls, \u2026"
}, {
module: 'sale', name: 'Sales',
help: "Do quotations, follow sales orders, invoice and control deliveries"
}, {
module: 'account_voucher', name: 'Invoicing',
help: "Send invoice, track payments and reminders"
}, {
module: 'point_of_sale', name: 'Point of Sales',
help: "Manage shop sales, use touch-screen POS"
}
], [
{
module: 'purchase', name: 'Purchase',
help: "Do purchase orders, control invoices and reception, follow your suppliers, \u2026"
}, {
module: 'stock', name: 'Warehouse',
help: "Track your stocks, schedule product moves, manage incoming and outgoing shipments, \u2026"
}, {
module: 'mrp', name: 'Manufacturing',
help: "Manage your manufacturing, control your supply chain, personalize master data, \u2026"
}, {
module: 'account_accountant', name: 'Accounting and Finance',
help: "Record financial operations, automate followup, manage multi-currency, \u2026"
}
], [
{
module: 'project', name: 'Projects',
help: "Manage projects, track tasks, invoice task works, follow issues, \u2026"
}, {
module: 'hr', name: 'Human Resources',
help: "Manage employees and their contracts, follow laves, recruit people, \u2026"
}, {
module: 'marketing', name: 'Marketing',
help: "Manage campaigns, follow activities, automate emails, \u2026"
}, {
module: 'knowledge', name: 'Knowledge',
help: "Track your documents, browse your files, \u2026"
}
]
]
};
openerp.web_dashboard.ApplicationTiles = openerp.web.View.extend({
template: 'ApplicationTiles',
start: function () {
this._super();
$('.secondary_menu', this.$element.closest('.openerp')).hide();
return this.do_display_root_menu();
},
stop: function () {
$('.secondary_menu', this.$element.closest('.openerp')).show();
this._super();
},
do_display_root_menu: function() {
var self = this;
return new openerp.web.DataSetSearch( this, 'ir.ui.menu', null, [['parent_id', '=', false]])
.read_slice( ['name', 'web_icon_data', 'web_icon_hover_data'], {}, function (applications) {
// Create a matrix of 3*x applications
var rows = [];
while (applications.length) {
rows.push(applications.splice(0, 3));
}
var tiles = QWeb.render( 'ApplicationTiles.content', {rows: rows});
self.$element.append(tiles)
.find('.oe-dashboard-home-tile')
.click(function () {
openerp.webclient.menu.on_menu_click(null, $(this).data('menuid'))
});
});
}
});
/*
* Widgets
* This client action designed to be used as a dashboard widget display
@ -442,4 +358,115 @@ openerp.web_dashboard.Widget = openerp.web.View.extend(/** @lends openerp.web_da
}
});
/*
* HomeTiles this client action display either the list of application to
* install (if none is installed yet) or a list of root menu items
*/
openerp.web.client_actions.add('default_home', 'session.web_dashboard.ApplicationTiles');
openerp.web_dashboard.ApplicationTiles = openerp.web.Widget.extend({
template: 'web_dashboard.ApplicationTiles',
init: function(parent) {
this._super(parent);
},
start: function() {
var self = this;
var applications = [
{module: 'crm', name: 'CRM', menu: 'Sales', help: "Acquire leads, follow opportunities, manage prospects and phone calls, \u2026"},
];
var domain = [['core','=',true],['state','=','installed']];
var ds = new openerp.web.DataSetSearch(this, 'ir.module.module',{},domain);
ds.read_slice(['id'], {}, function(result) {
if(result.length) {
self.on_installed_database();
} else {
self.on_uninstalled_database();
}
});
},
on_uninstalled_database: function() {
console.log("UNINSTALLED");
this.$element.html("ApplicationInstaller");
installer = new openerp.web_dashboard.ApplicationInstaller(this);
installer.appendTo(this.$element);
},
on_installed_database: function() {
console.log("INSTALLED");
this.$element.html("ApplicationTiles");
var self = this;
var ds = new openerp.web.DataSetSearch( this, 'ir.ui.menu', null, [['parent_id', '=', false]]);
var r = ds.read_slice( ['name', 'web_icon_data', 'web_icon_hover_data'], {}, function (applications) {
// Create a matrix of 3*x applications
var rows = [];
while (applications.length) {
rows.push(applications.splice(0, 3));
}
var tiles = QWeb.render( 'ApplicationTiles.content', {rows: rows});
self.$element.append(tiles).find('.oe-dashboard-home-tile').click(function () {
openerp.webclient.menu.on_menu_click(null, $(this).data('menuid'))
});
});
}
});
/**
* ApplicationInstaller
* This client action display a list of applications to install.
*/
openerp.web.client_actions.add( 'board.application.installer', 'openerp.web_dashboard.ApplicationInstaller');
openerp.web_dashboard.ApplicationInstaller = openerp.web.View.extend({
template: 'web_dashboard.ApplicationInstaller',
start: function () {
this._super();
$('.secondary_menu', this.$element.closest('.openerp')).hide();
this.$element.append("Display ir module module kanban view");
},
/* currenlt unused */
on_install_clicked: function() {
var Installer = new openerp.web.DataSet(this, 'base.setup.installer');
Installer.call('default_get', [], function (installed_modules) {
console.log(installed_modules);
self.$element.html(QWeb.render('Welcome-Page', {'applications': applications}));
self.$element.find('.install-module-link').click(function () {
self.install_module($(this).data('module'), $(this).data('menu'));
return false;
});
});
},
install_module: function (module_name, menu_name) {
var self = this;
var Modules = new openerp.web.DataSetSearch(
this, 'ir.module.module', null,
[['name', '=', module_name], ['state', '=', 'uninstalled']]);
var Upgrade = new openerp.web.DataSet(this, 'base.module.upgrade');
$.blockUI();
Modules.read_slice(['id'], {}, function (records) {
if (!(records.length === 1)) { $.unblockUI(); return; }
Modules.call('state_update',
[_.pluck(records, 'id'), 'to install', ['uninstalled']],
function () {
Upgrade.call('upgrade_module', [[]], function () {
self.run_configuration_wizards(menu_name);
});
}
)
});
},
run_configuration_wizards: function (menu_name) {
var self = this;
new openerp.web.DataSet(this, 'res.config').call('start', [[]], function (action) {
self.widget_parent.widget_parent.do_action(action, function () {
openerp.webclient.do_reload();
});
self.$element.empty();
var dss = new openerp.web.DataSetSearch(this, 'ir.ui.menu', null, [['parent_id', '=', false], ['name', '=', menu_name]]);
dss.read_slice(['id'], {}, function(menus) {
if(!(menus.length === 1)) { $.unblockUI(); return; }
$.when(openerp.webclient.menu.on_menu_click(null, menus[0].id)).then($.unblockUI);
});
});
}
});
};

View File

@ -82,26 +82,54 @@
</dl>
</t>
<div t-name="ApplicationTiles" class="oe-dashboard-home-tiles"/>
<div t-name="HomeWidget" class="oe-dashboard-home-widget"/>
<t t-name="HomeWidget.content">
<h3><t t-esc="widget.title"/></h3>
<iframe width="100%" frameborder="0" t-att-src="url"/>
</t>
<div t-name="web_dashboard.ApplicationTiles.old" class="oe-dashboard-home-tiles"/>
<table t-name="ApplicationTiles.content" width="100%">
<tr t-foreach="rows" t-as="row">
<td t-foreach="row" t-as="application" width="33.3%">
<div class="oe-dashboard-home-tile"
t-att-data-menuid="application.id">
<div class="oe-dashboard-home-tile-icon">
<img t-if="application.web_icon_data"
t-att-src="'data:image/png;base64,' + application.web_icon_data"
/><img t-if="application.web_icon_hover_data" class="hover"
t-att-src="'data:image/png;base64,' + application.web_icon_hover_data"/>
<img t-if="application.web_icon_data" t-att-src="'data:image/png;base64,' + application.web_icon_data"
/><img t-if="application.web_icon_hover_data" class="hover" t-att-src="'data:image/png;base64,' + application.web_icon_hover_data"/>
</div>
<span><t t-esc="application.name"/></span>
</div>
</td>
</tr>
</table>
<div t-name="HomeWidget" class="oe-dashboard-home-widget"/>
<t t-name="HomeWidget.content">
<h3><t t-esc="widget.title"/></h3>
<iframe width="100%" frameborder="0" t-att-src="url"/>
<t t-name="web_dashboard.ApplicationTiles">
<div class="oe_installer">
<h1>Welcome to OpenERP</h1>
<ul>
<t t-foreach="applications" t-as="application" >
<li>
<a href="#" class="oe_install-module-link" t-att-data-module="application.module" t-att-data-menu="application.menu" >
<img t-att-src="'/web_dashboard/static/src/img/installer_' + application.module + '.png'"/>
<div><t t-esc="application.name"/></div>
</a>
</li>
</t>
</ul>
</div>
</t>
<t t-name="web_dashboard.ApplicationInstaller">
<div class="oe_installer">
<h1>Welcome to OpenERP</h1>
<li>Remember to bookmark this page.</li>
<li>Remember your login: <t t-esc="session.username"/></li>
<li>Choose the first OpenERP Application you want to install..</li>
<h3>Please choose the first application to install.</h3>
KANBAN HERE
</div>
</t>
</template>

View File

@ -1,38 +0,0 @@
# Ukrainian translation for openerp-web
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
# This file is distributed under the same license as the openerp-web package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2011-10-07 10:39+0200\n"
"PO-Revision-Date: 2011-12-07 16:56+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Ukrainian <uk@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2011-12-08 06:06+0000\n"
"X-Generator: Launchpad (build 14443)\n"
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
msgid "Welcome to your new OpenERP instance."
msgstr ""
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
msgid "Remember to bookmark this page."
msgstr ""
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
msgid "Remember your login:"
msgstr ""
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
msgid "Choose the first OpenERP Application you want to install.."
msgstr ""
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
msgid "Install"
msgstr ""