[FIX] linkedin: display a button to connect on linkedin if there are an error of connected linkedin module
bzr revid: chm@openerp.com-20130109123357-2e2ogcy510ctqk8q
This commit is contained in:
@@ -42,3 +42,13 @@
|
||||
color: grey;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.openerp .oe_social_network_login {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.openerp .oe_social_network_login .oe_error {
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,13 @@ openerp.web_linkedin = function(instance) {
|
||||
var QWeb = instance.web.qweb;
|
||||
var _t = instance.web._t;
|
||||
|
||||
openerp.web_linkedin.onLinkedInAuth = function () {
|
||||
IN.API.Profile("me")
|
||||
.result( function(me) {
|
||||
console.log("me", me);
|
||||
});
|
||||
};
|
||||
|
||||
instance.web_linkedin.LinkedinTester = instance.web.Class.extend({
|
||||
init: function() {
|
||||
this.linkedin_added = false;
|
||||
@@ -15,8 +22,12 @@ openerp.web_linkedin = function(instance) {
|
||||
test_linkedin: function() {
|
||||
var self = this;
|
||||
return this.test_api_key().then(function() {
|
||||
if (self.linkedin_added)
|
||||
if (self.linkedin_added) {
|
||||
if (IN.User.isAuthorized()) {
|
||||
self.auth_def.resolve();
|
||||
}
|
||||
return self.linkedin_def.promise();
|
||||
}
|
||||
var tag = document.createElement('script');
|
||||
tag.type = 'text/javascript';
|
||||
tag.src = "http://platform.linkedin.com/in.js";
|
||||
@@ -178,6 +189,7 @@ openerp.web_linkedin = function(instance) {
|
||||
instance.web_linkedin.LinkedinPopup = instance.web.Dialog.extend({
|
||||
template: "Linkedin.popup",
|
||||
init: function(parent, text) {
|
||||
var self = this;
|
||||
this._super(parent, {title:_t("LinkedIn search")});
|
||||
this.text = text;
|
||||
this.limit = 5;
|
||||
@@ -189,6 +201,20 @@ openerp.web_linkedin = function(instance) {
|
||||
instance.web_linkedin.tester.test_authentication().done(function() {
|
||||
self.trigger("authentified");
|
||||
});
|
||||
|
||||
this.bind_error();
|
||||
},
|
||||
bind_error: function() {
|
||||
var self = this;
|
||||
this.error_message = window.setTimeout(function() {self.$(".oe_social_network_login .oe_error").show();}, 500);
|
||||
this.$el.on("DOMNodeInserted", function (e) {
|
||||
self.$el.off("DOMNodeInserted");
|
||||
window.clearTimeout(self.error_message);
|
||||
self.$(".oe_social_network_login .oe_error").hide();
|
||||
});
|
||||
this.$(".oe_social_network_login .oe_error").click(function () {
|
||||
IN.User.authorize();
|
||||
});
|
||||
},
|
||||
authentified: function() {
|
||||
var self = this;
|
||||
|
||||
@@ -8,12 +8,16 @@
|
||||
</t>
|
||||
<t t-name="Linkedin.popup">
|
||||
<div>
|
||||
<script type="in/Login">
|
||||
</script>
|
||||
<h2 style="margin-top: -10px;">People</h2>
|
||||
<div class="oe_linkedin_pop_p" style='display: table;width:100%'/>
|
||||
<div class="oe_social_network_login">
|
||||
<script type="in/Login">
|
||||
<b><?js= firstName ?> <?js= lastName ?></b>, is your account on LinkedIn.
|
||||
</script>
|
||||
<img src="http://developer.linkedin.com/sites/default/files/js-signin.png" class="oe_error"/>
|
||||
</div>
|
||||
<h2>People</h2>
|
||||
<div class="oe_linkedin_pop_p"></div>
|
||||
<h2>Companies</h2>
|
||||
<div class="oe_linkedin_pop_c" style='display: table;width:100%'/>
|
||||
<div class="oe_linkedin_pop_c"></div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="Linkedin.EntityWidget">
|
||||
|
||||
Reference in New Issue
Block a user