Thibault Delavallée (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-user-profile-tpa into lp:openobject-addons.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-user-profile-tpa/+merge/145577 -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-user-profile-tpa/+merge/145577 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-user-profile-tpa.
=== added directory 'user_profile' === added file 'user_profile/__init__.py' --- user_profile/__init__.py 1970-01-01 00:00:00 +0000 +++ user_profile/__init__.py 2013-01-30 10:53:30 +0000 @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added file 'user_profile/__openerp__.py' --- user_profile/__openerp__.py 1970-01-01 00:00:00 +0000 +++ user_profile/__openerp__.py 2013-01-30 10:53:30 +0000 @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today OpenERP S.A. (<http://www.openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +{ + 'name': 'User Profile', + 'category': 'Social Network', + 'summary': 'User Profile completion Notification', + 'description':""" +User Profile completion Notification. +===================================== + +""", + 'version': '1.0', + 'depends': ['mail'], + 'css': ['static/src/css/*.css'], + 'js': ['static/src/js/*.js'], + 'qweb': ['static/src/xml/*.xml'], + 'images': [], + 'installable': True, + 'auto_install': True, +} === added directory 'user_profile/static' === added directory 'user_profile/static/src' === added directory 'user_profile/static/src/css' === added file 'user_profile/static/src/css/user_profile.css' --- user_profile/static/src/css/user_profile.css 1970-01-01 00:00:00 +0000 +++ user_profile/static/src/css/user_profile.css 2013-01-30 10:53:30 +0000 @@ -0,0 +1,50 @@ +.openerp .oe_user_profile_sidebar{ + float: right; + width:30%; + margin-left:300px; + margin-right: 150px; + height:auto; + font-size:15px; + position: relative; +} +.openerp .oe_user_profile_detail,.oe_user_profile_group +{ + background: #EDEDF6; + height:auto; + width:100%; + margin-top:15px; + margin-left:10px; + border-radius: 2px; + border: solid 1px rgba(0,0,0,0.03); +} +.openerp .oe_mail { + position: absolute; +} +.openerp .oe_user_display { + margin-left:10px; + margin-top:4px; +} +.openerp .oe_suggested_groups{ + border-radius: 2px; + margin-top:1px; + width:100%; + margin-left:10px; + height:100px; +} +.openerp .oe_group_images{ + width:30%; + float:left; +} +.openerp .oe_group_image_content{ + border-radius: 2px; + border: solid 1px rgba(0,0,0,0.03); +} +.openerp .oe_group_content{ + width:70%; + float:right; +} +.openerp .oe_join_group +{ + margin-top:10px; +} + === added directory 'user_profile/static/src/img' === added directory 'user_profile/static/src/js' === added file 'user_profile/static/src/js/user_profile.js' --- user_profile/static/src/js/user_profile.js 1970-01-01 00:00:00 +0000 +++ user_profile/static/src/js/user_profile.js 2013-01-30 10:53:30 +0000 @@ -0,0 +1,90 @@ +openerp.user_profile = function(session){ + var _t = session.web._t, + _lt = session.web._lt; + var user_profile = session.user_profile = {}; + + user_profile.Side_bar = session.mail.Widget.include( { + template : 'user_profile.side_bar', + init: function (parent, action) { + var self = this; + this._super(parent, action); + this.ds_todo = new session.web.DataSetSearch(this, 'ir.profile.todo'); + this.ds_mailgroup = new session.web.DataSetSearch(this, 'mail.group'); + this.res_user = new session.web.DataSetSearch(this, 'res.users'); + this.get_user_info(); + this.get_suggested_group(); + this.group = {}; + }, + bind_events: function() { + var self = this; + this.$('.oe_add_link').on('click', 'a', { uid: this.session.uid}, self.open_user_profile_view); + this.$el.on('click','button',{ context: this.context}, self.join_group); + }, + get_user_info: function() { + var self = this; + var uncomplite=0; + return self.res_user.call('fields_view_get', {'view_type':'form',context: self.context}).then(function(res){ + self.res_user.call('read',[self.session.uid]).then(function(result){ + _(_.keys(res.fields)).each(function (data) { + if (!result[data]){ + self.$('.oe_add_link').append('<li><a id="'+res.fields[data].string+'" class="oe_add_detail" src="">' + res.fields[data].string +'</a></li>'); + uncomplite+=1; + } + }); + var value = Math.round((_.size(res.fields)-uncomplite)*(100/_.size(res.fields))) + self.$('.oe_profile_complete').append('<p>Your Profile is complete: <progress value='+value+' max="100">'+value+'</progress></p>'); + }); + }); + }, + get_suggested_group: function () { + var self = this; + var show=0; + return self.ds_mailgroup.read_slice([]).then(function(res){ + _.chain(res) + .sortBy(function(result){return _.size(result.message_ids); }).reverse() + .filter(function(result) { + return !result.message_is_follower; + }) + .map(function(result) { + if(show>2)return; + show+=1; + self.$('.oe_suggest_groups').append('<div class="oe_suggested_groups"><div class="oe_group_images"><img src="'+self.session.url('/web/binary/image', {model: 'mail.group', field: 'image_small', id:result.id, resize: ''})+'" class="oe_group_image_content"/></div><div class="oe_group_content"><a>'+result.name+'</a></br><button type="button" id="'+result.name+'" class="oe_join_group">Join Group</button></div></div>') + }); + }); + }, + join_group:function(event){ + this.ds_mailgroup = new session.web.DataSetSearch(this, 'mail.group'); + var self= this; + return this.ds_mailgroup.call('search',[[ ['name','=',$(this).attr('id')] ]]).then(function(res){ + self.ds_mailgroup.call('message_subscribe_users', [res,[event.data.uid]]); + }).then(function(res){ + location.reload(); + }); + }, + open_user_profile_view: function(event){ + var self = this; + var action = { + name : 'Complete Profile', + type: 'ir.actions.act_window', + res_model: 'res.users', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + res_id : event.data.uid, + target: 'new', + flags : { + action_buttons: true, + }, + }; + var action_manager = new session.web.ActionManager(this); + action_manager.do_action(action); + var form = action_manager.dialog_widget.views.form.controller; + form.on("on_button_cancel", action_manager.dialog, action_manager.dialog.close); + form.on('save', self, function() { + action_manager.dialog.close(); + location.reload(); + }); + return false; + } + }); +} === added directory 'user_profile/static/src/xml' === added file 'user_profile/static/src/xml/user_profile.xml' --- user_profile/static/src/xml/user_profile.xml 1970-01-01 00:00:00 +0000 +++ user_profile/static/src/xml/user_profile.xml 2013-01-30 10:53:30 +0000 @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates id="template" xml:space="preserve"> + <t t-extend="mail.Root" t-name="user_profile.side_bar"> + <t t-jquery="div" t-operation="after"> + <div class="oe_user_profile_sidebar"> + <div class="oe_user_profile_detail"> + <p class="oe_user_display">Complete Your Profile</p> + <div class="oe_profile_complete"/> + <ul class="oe_add_link"/> + </div> + <div class="oe_user_profile_group"> + <p class="oe_user_display">Suggested Groups</p> + <div class="oe_suggest_groups"/> + </div> + </div> + </t> + </t> +</templates>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp