[ADD] Save to db
bzr revid: fme@openerp.com-20130625230734-6i0vxc89gkshrp8t
This commit is contained in:
@@ -22,7 +22,12 @@ module_template = Template("""
|
||||
<img src="data:image/png;base64,{{ module.icon_image }}" onerror="this.src = '/base/static/src/img/icon.png'">
|
||||
</div>
|
||||
</div>
|
||||
<div class='oe_app_name'>{{ module.shortdesc }}</div>
|
||||
<div
|
||||
class='oe_app_name editable'
|
||||
data-model='ir.module.module'
|
||||
data-id='{{ module.id }}'
|
||||
data-field='shortdesc'
|
||||
>{{ module.shortdesc }}</div>
|
||||
<div
|
||||
class='oe_app_descr editable'
|
||||
data-model='ir.module.module'
|
||||
|
||||
@@ -1,14 +1,43 @@
|
||||
(function() {
|
||||
// Init headless webclient (TODO: check embedded mode)
|
||||
var $web = $('<div style="width: 300px; height: 300px; position: absolute; bottom: 0; right: 0;"/>').appendTo($('body'));
|
||||
// Init headless webclient
|
||||
// TODO: check embedded mode or how to put it cleanly in a dom ready callback
|
||||
var $web = $('<div style="display: none;"/>').appendTo('body');
|
||||
var s = new openerp.init(['web']);
|
||||
var wc = new s.web.WebClient();
|
||||
// TODO: disable blockUI
|
||||
wc.appendTo($web);
|
||||
var instance = openerp.instances[wc.session.name];
|
||||
|
||||
setTimeout(function () {
|
||||
// HACKY HACK YUCK YUCK !!
|
||||
// TODO: Need modification to webclient. Webclient shall trigger an event when it's ready.
|
||||
if (instance.web.notification) {
|
||||
instance.web.notification.$el.appendTo('body');
|
||||
} else {
|
||||
console.log("too late");
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
$(function() {
|
||||
$('.editable').css('outline', '1px solid red').attr('contentEditable', 'true').click(function (e) {
|
||||
$('.editable').css('outline', '1px dotted red').attr('contentEditable', 'true').click(function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('body').on("keypress", ".editable", function(e) {
|
||||
if (e.which == 13) {
|
||||
var $el = $(e.currentTarget);
|
||||
var data = $el.data();
|
||||
var update = {};
|
||||
// TODO: Are we going to use a meta-data flag in order to know if the field shall be text or html ?
|
||||
update[data.field] = $el.text();
|
||||
(new instance.web.DataSet(this, data.model)).write(data.id, update).done(function() {
|
||||
$el.blur();
|
||||
instance.webclient.do_notify('Save', _.str.sprintf('%s#%d#%s saved', data.model, data.id, data.field));
|
||||
}).fail(function () {
|
||||
console.error('fail');
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<img class='oe_logo_img' alt='OpenERP: Open Source Business Apps' src='https://www.openerp.com/saas_master/static/site_new/img/logo_oe_top_old_and_small.png'>
|
||||
</a>
|
||||
</div>
|
||||
<ul class='oe_span9 oe_right oe_top_menu editable' id='top-menu'> <li class='oe_top_menu_entry'><a class='ab_menu_apps' href='https://www.openerp.com/apps'>Applications</a></li>
|
||||
<ul class='oe_span9 oe_right oe_top_menu' id='top-menu'> <li class='oe_top_menu_entry'><a class='ab_menu_apps' href='https://www.openerp.com/apps'>Applications</a></li>
|
||||
<li class='oe_top_menu_entry'><a class='ab_menu_partners' href='https://www.openerp.com/partners/directory'>Partners</a></li>
|
||||
<li class='oe_top_menu_entry'><a class='ab_menu_training' href="https://www.openerp.com/events#view=training">Training</a></li>
|
||||
<li class='oe_top_menu_entry'><a class='ab_menu_freetrial' href='https://www.openerp.com/start'>Free Trial</a></li>
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class='oe_slide oe_home_slide'>
|
||||
<div class='oe_row'>
|
||||
<div class='oe_slide_title oe_title_font'><span class='oe_open'>Open</span><span class='oe_erp'>ERP</span><span class='oe_version'>7.0</span></div>
|
||||
<div class='oe_slide_subtitle editable'>
|
||||
<div class='oe_slide_subtitle'>
|
||||
Beautiful Business Applications<br />
|
||||
Powerful, Integrated, Open Source<br />
|
||||
<a href='https://www.openerp.com/start' class='oe_button oe_medium oe_tacky ab_banner_freetrial'>Start your <span class='oe_emph'>free</span> trial <i class='icon-arrow-right'></i></a>
|
||||
|
||||
Reference in New Issue
Block a user