diff options
| author | Mayur Maheshwari (OpenERP) <mma@tinyerp.com> | 2012-06-21 16:42:44 +0530 |
|---|---|---|
| committer | Mayur Maheshwari (OpenERP) <mma@tinyerp.com> | 2012-06-21 16:42:44 +0530 |
| commit | 64d7a8ae41db20a5bb8f41bae5c9ea1cab01fe0a (patch) | |
| tree | b00da6a48cb2c3e90a00b1131d1145a1745fbd7d /addons/anonymous/static/src | |
| parent | 61a3238d978ab40e661974dc2b75fbda700f7c70 (diff) | |
| parent | d17d4384058155649e6013d162f0182131d03dc4 (diff) | |
[MERGE]: Merge with lp:openobject-addons
bzr revid: mma@tinyerp.com-20120621111244-sddylu3jxapx73cv
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 | 13 |
2 files changed, 57 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..4c6d2fcbf54 --- /dev/null +++ b/addons/anonymous/static/src/xml/anonymous.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- vim:fdl=1: +--> +<templates id="template" xml:space="preserve"> + +<t t-name="UserMenu.anonymous"> + <a href="#" class="oe_user_menu oe_topbar_item oe_topbar_anonymous_login"> + <img class="oe_topbar_avatar" t-att-src="_s + '/web/static/src/img/icons/gtk-dialog-authentication.png'"/> + Login + </a> +</t> + +</templates> |
