diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-08-03 14:34:48 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-08-03 14:34:48 +0200 |
| commit | 56227098e4f5268a3d862fd321916e73380dfcbb (patch) | |
| tree | f71100371f0b905fe677b0cb0693871bd590c991 /addons/web_linkedin/static/src | |
| parent | f20b92105f9a11205384748a9adba4bb97b8865a (diff) | |
Now print the names
bzr revid: nicolas.vanhoren@openerp.com-20120803123448-jbvyc45gtb7ys7xk
Diffstat (limited to 'addons/web_linkedin/static/src')
| -rw-r--r-- | addons/web_linkedin/static/src/js/linkedin.js | 35 | ||||
| -rw-r--r-- | addons/web_linkedin/static/src/xml/linkedin.xml | 6 |
2 files changed, 40 insertions, 1 deletions
diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index ffe5db1f0de..3ccbfce19b9 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -120,9 +120,42 @@ openerp.web_linkedin = function(instance) { return el; }); lst = lst.concat(plst); - console.log("found", lst.length, lst); + console.log("Linkedin search found:", lst.length, lst); + self.result = lst; + self.display_result(); }); }, + display_result: function() { + var self = this; + self.$element.html("<div style='display: table;width:100%'/>"); + var i = 0; + var $row; + _.each(self.result, function(el) { + var pc = new instance.web_linkedin.PeopleCompany(self, el); + if (i % 5 === 0) { + $row = $("<div style='display: table-row;width:100%'/>"); + $row.appendTo(self.$(">div")); + } + pc.appendTo($row); + pc.$element.css("display", "table-cell"); + i++; + }); + }, + }); + + instance.web_linkedin.PeopleCompany = instance.web.Widget.extend({ + template: "PeopleCompany", + init: function(parent, data) { + this._super(parent); + this.data = data; + }, + start: function() { + if (this.data.__type === "company") { + this.$("h3").text(this.data.name); + } else { // people + this.$("h3").text(_.str.sprintf("%s %s", this.data.firstName, this.data.lastName)); + } + }, }); }; // vim:et fdc=0 fdl=0: diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml index a68c0cf7026..332ab8a3175 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -12,4 +12,10 @@ </script> </div> </t> + <t t-name="PeopleCompany"> + <div> + <h3 /> + <img /> + </div> + </t> </templates>
\ No newline at end of file |
