diff options
| author | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-06-13 11:08:55 +0200 |
|---|---|---|
| committer | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-06-13 11:08:55 +0200 |
| commit | c44790c56dd2ccecc23c9bbc0f3b749fe092dbf2 (patch) | |
| tree | 052df6d3925982df31867c2e685a1114ad88cfa3 /addons/anonymous/static/src | |
| parent | 0fd300caf4d114a2e5779afdf2a17438af6be688 (diff) | |
| parent | d4271f66c883eae26da625b970de0db6528994b4 (diff) | |
[MERGE] merged with main trunk
bzr revid: qdp-launchpad@openerp.com-20120613090855-9tpft9kutxzgwyze
Diffstat (limited to 'addons/anonymous/static/src')
| -rw-r--r-- | addons/anonymous/static/src/js/anonymous.js | 44 | ||||
| -rw-r--r-- | addons/anonymous/static/src/xml/anonymous.xml | 17 |
2 files changed, 61 insertions, 0 deletions
diff --git a/addons/anonymous/static/src/js/anonymous.js b/addons/anonymous/static/src/js/anonymous.js new file mode 100644 index 00000000000..a28c56ac411 --- /dev/null +++ b/addons/anonymous/static/src/js/anonymous.js @@ -0,0 +1,44 @@ +openerp.anonymous = function(instance) { + + instance.web.client_actions.add("login", "instance.web.Login"); + + instance.web.WebClient.include({ + show_login: function() { + var self = this, _super = this._super; + this.login.load_db_list().then(function() { + var dblist = self.login._db_list; + if (dblist && dblist.length === 1) { + self.login.remember_credentials = false; + // XXX get login/pass from server (via a rpc call) ? + self.login.do_login(dblist[0], 'anonymous', 'anonymous').fail(function() { + _super.apply(self, []); + }); + } else { + _super.apply(self, []); + } + }); + }, + }); + + + instance.web.UserMenu.include({ + init: function(parent) { + this._super(parent); + if (this.session.username == 'anonymous') { + this.template = 'UserMenu.anonymous'; + this.do_update = function() {}; // avoid change of avatar + } + }, + start: function() { + var self = this; + this._super.apply(this, arguments); + this.$element.find('.oe_topbar_anonymous_login').click(function() { + var p = self.getParent(); + var am = p.action_manager; + am.do_action({type:'ir.actions.client', tag:'login'}); + am.client_widget.on('login', p, p.show_application); + }); + } + }); + +}; diff --git a/addons/anonymous/static/src/xml/anonymous.xml b/addons/anonymous/static/src/xml/anonymous.xml new file mode 100644 index 00000000000..afa0ac545a6 --- /dev/null +++ b/addons/anonymous/static/src/xml/anonymous.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- vim:fdl=1: +--> +<templates id="template" xml:space="preserve"> + +<t t-name="UserMenu.anonymous"> + <ul class="oe_user_menu oe_topbar_item"> + <li> + <a href="#" class="oe_topbar_anonymous_login"> + <img class="oe_topbar_avatar" t-att-src="_s + '/web/static/src/img/icons/gtk-dialog-authentication.png'"/> + Login + </a> + </li> + </ul> +</t> + +</templates> |
