wip
bzr revid: nicolas.vanhoren@openerp.com-20120803084545-wdaxtx1e7ewujnfy
This commit is contained in:
parent
6f39a63957
commit
53f35a608c
|
@ -0,0 +1,12 @@
|
|||
|
||||
|
||||
.openerp .oe_linkedin_img {
|
||||
float: right;
|
||||
width: 1.5em;
|
||||
margin-top: -1px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.openerp .oe_linkedin_input {
|
||||
margin-right:1.5em;
|
||||
}
|
|
@ -11,6 +11,7 @@ openerp.web_linkedin = function(instance) {
|
|||
this.api_key = "cxnr0l53n73x";
|
||||
this.linkedin_added = false;
|
||||
this.linkedin_def = $.Deferred();
|
||||
this.auth_def = $.Deferred();
|
||||
},
|
||||
test_linkedin: function() {
|
||||
var self = this;
|
||||
|
@ -24,6 +25,9 @@ openerp.web_linkedin = function(instance) {
|
|||
document.getElementsByTagName('head')[0].appendChild(tag);
|
||||
self.linkedin_added = true;
|
||||
$(tag).load(function() {
|
||||
IN.Event.on(IN, "auth", function() {
|
||||
self.auth_def.resolve();
|
||||
});
|
||||
self.linkedin_def.resolve();
|
||||
});
|
||||
return self.linkedin_def.promise();
|
||||
|
@ -42,6 +46,9 @@ openerp.web_linkedin = function(instance) {
|
|||
}
|
||||
});
|
||||
},
|
||||
test_authentication: function() {
|
||||
return this.auth_def.promise();
|
||||
},
|
||||
});
|
||||
|
||||
/*return new instance.web.Model("ir.config_parameter").call("set_param", ["web.linkedin.apikey", "cxnr0l53n73x"]).pipe(function() {
|
||||
|
@ -57,21 +64,42 @@ openerp.web_linkedin = function(instance) {
|
|||
this.display_dm = new instance.web.DropMisordered(true);
|
||||
},
|
||||
initialize_content: function() {
|
||||
this._super();
|
||||
var $ht = $(QWeb.render("FieldChar.linkedin"));
|
||||
var $in = this.$("input");
|
||||
$in.replaceWith($ht);
|
||||
this.$(".oe_linkedin_input").append($in);
|
||||
this.$(".oe_linkedin_img").click(_.bind(this.search_linkedin, this));
|
||||
this._super();
|
||||
|
||||
},
|
||||
search_linkedin: function() {
|
||||
var self = this;
|
||||
this.display_dm.add(instance.web_linkedin.tester.test_linkedin()).then(function() {
|
||||
debugger;
|
||||
new instance.web_linkedin.LinkedinPopup(self, self.get("value")).open();
|
||||
});
|
||||
},
|
||||
});
|
||||
instance.web.form.widgets.add('linkedin', 'instance.web_linkedin.Linkedin');
|
||||
|
||||
instance.web_linkedin.LinkedinPopup = instance.web.Dialog.extend({
|
||||
template: "Linkedin.popup",
|
||||
init: function(parent, text) {
|
||||
this._super(parent);
|
||||
this.text = text;
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
var self = this;
|
||||
this.on("authentified", this, this.authentified);
|
||||
instance.web_linkedin.tester.test_authentication().then(function() {
|
||||
self.trigger("authentified");
|
||||
});
|
||||
},
|
||||
authentified: function() {
|
||||
IN.API.PeopleSearch().params({"last-name": this.text}).result(function(a, b, c) {
|
||||
console.log("result", a);
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
// vim:et fdc=0 fdl=0:
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
-->
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="FieldChar.linkedin">
|
||||
<img class="oe_linkedin_img" t-att-src='_s + "/web_linkedin/static/src/img/Linkedin_blue.png"' style="float: right;width: 1.5em;margin-top: -1px;"/>
|
||||
<div class="oe_linkedin_input" style="margin-right:1.5em"/>
|
||||
<img class="oe_linkedin_img" t-att-src='_s + "/web_linkedin/static/src/img/Linkedin_blue.png"'/>
|
||||
<div class="oe_linkedin_input"/>
|
||||
</t>
|
||||
<t t-name="Linkedin.popup">
|
||||
<div>
|
||||
<script type="in/Login">
|
||||
</script>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
Loading…
Reference in New Issue