[IMP] static home version changed my mind
authorXavier Morel <xmo@openerp.com>
Thu, 28 Jul 2011 14:25:37 +0000 (16:25 +0200)
committerXavier Morel <xmo@openerp.com>
Thu, 28 Jul 2011 14:25:37 +0000 (16:25 +0200)
bzr revid: xmo@openerp.com-20110728142537-vrwn9w0vvyl00128

26 files changed:
addons/base_default_home/__openerp__.py
addons/base_default_home/static/src/css/home.css [new file with mode: 0644]
addons/base_default_home/static/src/img/account_voucher.png [new file with mode: 0644]
addons/base_default_home/static/src/img/accounting.png [deleted file]
addons/base_default_home/static/src/img/administration.png [deleted file]
addons/base_default_home/static/src/img/association.png [deleted file]
addons/base_default_home/static/src/img/crm.png [new file with mode: 0644]
addons/base_default_home/static/src/img/hr.png [new file with mode: 0644]
addons/base_default_home/static/src/img/human-resources.png [deleted file]
addons/base_default_home/static/src/img/knowledge.png
addons/base_default_home/static/src/img/manufacturing.png [deleted file]
addons/base_default_home/static/src/img/marketing.png
addons/base_default_home/static/src/img/mrp.png [new file with mode: 0644]
addons/base_default_home/static/src/img/point-of-sale.png [deleted file]
addons/base_default_home/static/src/img/point_of_sale.png [new file with mode: 0644]
addons/base_default_home/static/src/img/profile_tools.png [new file with mode: 0644]
addons/base_default_home/static/src/img/project.png
addons/base_default_home/static/src/img/purchase.png [new file with mode: 0644]
addons/base_default_home/static/src/img/purchases.png [deleted file]
addons/base_default_home/static/src/img/sale.png [new file with mode: 0644]
addons/base_default_home/static/src/img/sales.png [deleted file]
addons/base_default_home/static/src/img/stock.png [new file with mode: 0644]
addons/base_default_home/static/src/img/tools.png [deleted file]
addons/base_default_home/static/src/img/warehouse.png [deleted file]
addons/base_default_home/static/src/js/home.js
addons/base_default_home/static/src/xml/base_default_home.xml

index f86a835..097ff0e 100644 (file)
@@ -4,4 +4,5 @@
     "depends" : ['base'],
     'active': True,
     'js': ['static/src/js/home.js'],
+    'css': ['static/src/css/home.css']
 }
diff --git a/addons/base_default_home/static/src/css/home.css b/addons/base_default_home/static/src/css/home.css
new file mode 100644 (file)
index 0000000..c2a6989
--- /dev/null
@@ -0,0 +1,45 @@
+.oe-static-home {
+    text-align: center;
+}
+.oe-static-home-banner {
+    display: inline-block;
+    margin:  0.5em 0;
+    padding: 0.5em 5em;
+    border: 1px inset #808080;
+    background-color: #e6e3e3;
+    -moz-border-radius: 2em;
+    -webkit-border-radius: 2em;
+    border-radius: 2em;
+    text-align: left;
+}
+.oe-static-home-banner h1 {
+    margin: 0 0 0.3em
+}
+.oe-static-home-banner p {
+
+}
+.oe-static-home-banner address {
+    font-style: normal;
+    padding-left: 2em;
+}
+
+.oe-static-home-tiles {
+    text-align: left;
+}
+.oe-static-home-tiles td {
+    vertical-align: top;
+}
+.oe-static-home-tile {
+    margin: 0.5em;
+    padding: 0 1em;
+}
+.oe-static-home-tile-logo {
+    margin-right: 0.5em;
+}
+.oe-static-home-tile-text h2 {
+    margin-top: 0;
+    margin-bottom: 0.2em;
+}
+.oe-static-home-tile-text p {
+    margin: 0.5em 0;
+}
diff --git a/addons/base_default_home/static/src/img/account_voucher.png b/addons/base_default_home/static/src/img/account_voucher.png
new file mode 100644 (file)
index 0000000..afad133
Binary files /dev/null and b/addons/base_default_home/static/src/img/account_voucher.png differ
diff --git a/addons/base_default_home/static/src/img/accounting.png b/addons/base_default_home/static/src/img/accounting.png
deleted file mode 100644 (file)
index 6110536..0000000
Binary files a/addons/base_default_home/static/src/img/accounting.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/administration.png b/addons/base_default_home/static/src/img/administration.png
deleted file mode 100644 (file)
index ba4e403..0000000
Binary files a/addons/base_default_home/static/src/img/administration.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/association.png b/addons/base_default_home/static/src/img/association.png
deleted file mode 100644 (file)
index ed976c3..0000000
Binary files a/addons/base_default_home/static/src/img/association.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/crm.png b/addons/base_default_home/static/src/img/crm.png
new file mode 100644 (file)
index 0000000..893bb23
Binary files /dev/null and b/addons/base_default_home/static/src/img/crm.png differ
diff --git a/addons/base_default_home/static/src/img/hr.png b/addons/base_default_home/static/src/img/hr.png
new file mode 100644 (file)
index 0000000..742f3e5
Binary files /dev/null and b/addons/base_default_home/static/src/img/hr.png differ
diff --git a/addons/base_default_home/static/src/img/human-resources.png b/addons/base_default_home/static/src/img/human-resources.png
deleted file mode 100644 (file)
index 69a0dc1..0000000
Binary files a/addons/base_default_home/static/src/img/human-resources.png and /dev/null differ
index 35c8d57..7886436 100644 (file)
Binary files a/addons/base_default_home/static/src/img/knowledge.png and b/addons/base_default_home/static/src/img/knowledge.png differ
diff --git a/addons/base_default_home/static/src/img/manufacturing.png b/addons/base_default_home/static/src/img/manufacturing.png
deleted file mode 100644 (file)
index 29d8468..0000000
Binary files a/addons/base_default_home/static/src/img/manufacturing.png and /dev/null differ
index e37fefa..cfe890f 100644 (file)
Binary files a/addons/base_default_home/static/src/img/marketing.png and b/addons/base_default_home/static/src/img/marketing.png differ
diff --git a/addons/base_default_home/static/src/img/mrp.png b/addons/base_default_home/static/src/img/mrp.png
new file mode 100644 (file)
index 0000000..600104a
Binary files /dev/null and b/addons/base_default_home/static/src/img/mrp.png differ
diff --git a/addons/base_default_home/static/src/img/point-of-sale.png b/addons/base_default_home/static/src/img/point-of-sale.png
deleted file mode 100644 (file)
index ddd5b8a..0000000
Binary files a/addons/base_default_home/static/src/img/point-of-sale.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/point_of_sale.png b/addons/base_default_home/static/src/img/point_of_sale.png
new file mode 100644 (file)
index 0000000..9054576
Binary files /dev/null and b/addons/base_default_home/static/src/img/point_of_sale.png differ
diff --git a/addons/base_default_home/static/src/img/profile_tools.png b/addons/base_default_home/static/src/img/profile_tools.png
new file mode 100644 (file)
index 0000000..d6ba086
Binary files /dev/null and b/addons/base_default_home/static/src/img/profile_tools.png differ
index 8b7da18..20ba49f 100644 (file)
Binary files a/addons/base_default_home/static/src/img/project.png and b/addons/base_default_home/static/src/img/project.png differ
diff --git a/addons/base_default_home/static/src/img/purchase.png b/addons/base_default_home/static/src/img/purchase.png
new file mode 100644 (file)
index 0000000..094705c
Binary files /dev/null and b/addons/base_default_home/static/src/img/purchase.png differ
diff --git a/addons/base_default_home/static/src/img/purchases.png b/addons/base_default_home/static/src/img/purchases.png
deleted file mode 100644 (file)
index 9b8bf4f..0000000
Binary files a/addons/base_default_home/static/src/img/purchases.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/sale.png b/addons/base_default_home/static/src/img/sale.png
new file mode 100644 (file)
index 0000000..072570b
Binary files /dev/null and b/addons/base_default_home/static/src/img/sale.png differ
diff --git a/addons/base_default_home/static/src/img/sales.png b/addons/base_default_home/static/src/img/sales.png
deleted file mode 100644 (file)
index 0025e04..0000000
Binary files a/addons/base_default_home/static/src/img/sales.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/stock.png b/addons/base_default_home/static/src/img/stock.png
new file mode 100644 (file)
index 0000000..a70ccfe
Binary files /dev/null and b/addons/base_default_home/static/src/img/stock.png differ
diff --git a/addons/base_default_home/static/src/img/tools.png b/addons/base_default_home/static/src/img/tools.png
deleted file mode 100644 (file)
index 30b1514..0000000
Binary files a/addons/base_default_home/static/src/img/tools.png and /dev/null differ
diff --git a/addons/base_default_home/static/src/img/warehouse.png b/addons/base_default_home/static/src/img/warehouse.png
deleted file mode 100644 (file)
index 6232eaa..0000000
Binary files a/addons/base_default_home/static/src/img/warehouse.png and /dev/null differ
index f90561f..bc3fe2f 100644 (file)
@@ -4,37 +4,90 @@ openerp.base_default_home = function (openerp) {
     var old_home = openerp.base.WebClient.prototype.default_home;
 
     openerp.base_default_home = {
-        applications: [[
-                'sales',
-                'purchases',
-                'warehouse',
-                'manufacturing'
+        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: 'project', name: 'Projects',
+                    help: "Manage projects, track tasks, invoice task works, follow issues, \u2026"
+                }
             ], [
-                'project',
-                'accounting',
-                'human resources',
-                'marketing'
+                {
+                    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: 'hr', name: 'Human Resources',
+                    help: "Manage employees and their contracts, follow laves, recruit people, \u2026"
+                }, {
+                    module: 'point_of_sale', name: 'Point of Sales',
+                    help: "Manage shop sales, use touch-screen POS"
+                }
             ], [
-                'knowledge',
-                'point of sale',
-                'tools',
-                'administration'
+                {
+                    module: 'profile_tools', name: 'Extra Tools',
+                    help: "Track ideas, manage lunch, create surveys, share data"
+                }, {
+                    module: 'mrp', name: 'Manufacturing',
+                    help: "Manage your manufacturing, control your supply chain, personalize master data, \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.base.WebClient.prototype.default_home = function () {
-        var self = this;
-        var Installer = new openerp.base.DataSet(
-                this, 'base.setup.installer');
-        Installer.call('already_installed', [], function (installed_modules) {
-            if (!_(installed_modules).isEmpty()) {
-                return old_home.call(self);
-            }
-            self.$element.find('.oe-application').html(
-                QWeb.render('HomeInstallerTiles', {
-                    rows: openerp.base_default_home.applications
-            }));
-        });
-    }
+    _.extend(openerp.base.WebClient.prototype, {
+        default_home: function () {
+            var self = this;
+            var Installer = new openerp.base.DataSet(
+                    this, 'base.setup.installer');
+            Installer.call('already_installed', [], function (installed_modules) {
+                if (!_(installed_modules).isEmpty()) {
+                    return old_home.call(self);
+                }
+                self.$element.find('.oe-application').html(
+                    QWeb.render('StaticHome', {
+                        url: window.location.protocol + '//' + window.location.host + window.location.pathname,
+                        session: self.session,
+                        rows: openerp.base_default_home.applications
+                })).delegate('.oe-static-home-tile-text button', 'click', function () {
+                    self.install_module($(this).val());
+                })
+
+            });
+        },
+        install_module: function (module_name) {
+            var self = this;
+            var Modules = new openerp.base.DataSetSearch(
+                this, 'ir.module.module', null,
+                [['name', '=', module_name], ['state', '=', 'uninstalled']]),
+                Upgrade = new openerp.base.DataSet(this, 'base.module.upgrade');
+            Modules.read_slice(['id'], null, null, function (records) {
+                if (!(records.length === 1)) { return; }
+                Modules.call('state_update',
+                    [_.pluck(records, 'id'), 'to install', ['uninstalled']],
+                    function () {
+                        Upgrade.call('upgrade_module', [[]], function () {
+                            alert('done');
+                        });
+                    }
+                )
+            });
+        }
+    });
 };
index 829e60b..9fee5b2 100644 (file)
@@ -1,17 +1,42 @@
 <template>
-    <div t-name="HomeInstallerTiles" class="oe-dashboard-home-tiles">
-        <table width="100%">
-            <tr t-foreach="rows" t-as="row">
-                <td t-foreach="row" t-as="application" width="25%">
-                    <div class="oe-dashboard-home-tile"
-                         t-att-data-menuid="application">
-                        <div class="oe-dashboard-home-tile-icon">
-                            <img t-att-src="'/base_default_home/static/src/img/' + application.replace(new RegExp('\\s', 'g'), '-') + '.png'"/>
-                        </div>
-                        <span><t t-esc="application"/></span>
-                    </div>
-                </td>
-            </tr>
-        </table>
+    <div t-name="StaticHome" class="oe-static-home">
+        <div class="oe-static-home-banner">
+            <h1>Welcome to OpenERP</h1>
+            <p>
+                Don't forget to bookmark your application address to come back
+                later:
+            </p>
+            <address>
+                URL: <a t-att-href="url"><t t-esc="url"/></a><br/>
+                login: <t t-esc="session.login"/>
+            </address>
+        </div>
+
+        <div class="oe-static-home-tiles">
+            <table width="100%">
+                <tr t-foreach="rows" t-as="row">
+                    <td t-foreach="row" t-as="application" width="25%">
+                        <table class="oe-static-home-tile">
+                            <tr>
+                                <td>
+                                    <div class="oe-static-home-tile-logo">
+                                        <img t-att-src="'/base_default_home/static/src/img/' + application.module + '.png'"/>
+                                    </div>
+                                </td>
+                                <td>
+                                    <div class="oe-static-home-tile-text">
+                                        <h2><t t-esc="application.name"/></h2>
+                                        <p><t t-esc="application.help"/></p>
+                                        <button type="button"
+                                                t-att-value="application.module">
+                                            Install</button>
+                                    </div>
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+            </table>
+        </div>
     </div>
 </template>