diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index c76403a1443..39bb5d8c5d9 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1182,6 +1182,7 @@ padding-bottom: 16px; } .openerp a.oe_logo { + position: relative; width: 220px; display: block; text-align: center; @@ -1190,6 +1191,24 @@ margin: 14px 0; border: 0; } +.openerp a.oe_logo .oe_logo_edit { + margin: 14px 0; + position: absolute; + top: 1px; + padding: 4px; + width: 100%; + display: none; + text-align: center; + color: #eeeeee; + background: rgba(37, 37, 37, 0.9); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.openerp a.oe_logo:hover .oe_logo_edit_admin { + display: block; +} .openerp .oe_footer { position: fixed; bottom: 0; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index bf0ff4cece4..eab40a5b5bd 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -958,12 +958,26 @@ $sheet-padding: 16px text-shadow: 0 1px 1px white padding-bottom: 16px a.oe_logo + position: relative width: 220px display: block text-align: center img margin: 14px 0 border: 0 + .oe_logo_edit + margin: 14px 0 + position: absolute + top: 1px + padding: 4px + width: 100% + display: none + text-align: center + color: #eee + background: rgba(37,37,37,0.9) + @include box-sizing(border) + &:hover .oe_logo_edit_admin + display: block .oe_footer position: fixed bottom: 0 diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 9e5a5936089..4ad159e3ac5 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1118,6 +1118,9 @@ instance.web.Client = instance.web.Widget.extend({ instance.web.WebClient = instance.web.Client.extend({ _template: 'WebClient', + events: { + 'click .oe_logo_edit_admin': 'logo_edit' + }, init: function(parent) { this._super(parent); this._current_state = null; @@ -1188,7 +1191,29 @@ instance.web.WebClient = instance.web.Client.extend({ }, update_logo: function() { var img = this.session.url('/web/binary/company_logo'); - this.$el.find('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', this.session.uid === 1); + }, + logo_edit: function(ev) { + var self = this; + new instance.web.Model("res.users").get_func("read")(this.session.uid, ["company_id"]).then(function(res) { + self.rpc("/web/action/load", { action_id: "base.action_res_company_form" }).done(function(result) { + result.res_id = res['company_id'][0]; + result.target = "new"; + result.views = [[false, 'form']]; + result.flags = { + action_buttons: true, + }; + self.action_manager.do_action(result); + var form = self.action_manager.dialog_widget.views.form.controller; + form.on("on_button_cancel", self.action_manager.dialog, self.action_manager.dialog.close); + form.on('record_saved', self, function() { + self.action_manager.dialog.close(); + self.update_logo(); + }); + }); + }); + return false; }, check_timezone: function() { var self = this; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index dc31a24dc31..5afadaeffd0 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -439,7 +439,10 @@ - +