@@ -1,100 +1,16 @@
|
||||
/* vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:fdl=0
|
||||
*/
|
||||
@charset "utf-8";
|
||||
|
||||
.oe_website {
|
||||
background: #e9e9e9;
|
||||
color: #646464;
|
||||
}
|
||||
|
||||
.oe_website_header {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
/* Body {{{ */
|
||||
.oe_website_body {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
padding-bottom: 32px;
|
||||
padding-top: 32px;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Footer {{{ */
|
||||
.oe_website_footer {
|
||||
border-top: solid 1px #e0e0e0;
|
||||
padding-bottom: 32px;
|
||||
padding-top: 32px;
|
||||
}
|
||||
|
||||
.oe_website_footer h5 {
|
||||
border-bottom: solid 1px rgba(0, 0, 0, 0.06);
|
||||
margin-right: 24px;
|
||||
padding-bottom: 6px;
|
||||
margin-bottom: 6px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.oe_website_footer ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.oe_website_footer ul li {
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
font-size: 14px;
|
||||
margin-right: 32px;
|
||||
}
|
||||
|
||||
.oe_website_footer ul li a {
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
.oe_website_footer ul li a:visited {
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
.oe_website_footer ul li a:hover {
|
||||
color: black;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
.oe_website_copy {
|
||||
margin-top: 24px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Editor {{{ */
|
||||
.oe_website_editorbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin: 0px;
|
||||
background: #e9e9e9;
|
||||
box-sizing: border-box;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin: 0px;
|
||||
background: #e9e9e9;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.oe_website_editorbar li {
|
||||
display: inline;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.oe_website_editor_container .oe_editable {
|
||||
outline: 1px dotted green;
|
||||
}
|
||||
|
||||
.oe_website_editor_container .oe_editable.oe_dirty {
|
||||
outline: 1px dotted red;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -15,8 +15,3 @@
|
||||
li
|
||||
display: inline
|
||||
|
||||
.oe_website_editor_container .oe_editable
|
||||
outline: 1px dotted green
|
||||
.oe_website_editor_container .oe_editable.oe_dirty
|
||||
outline: 1px dotted red
|
||||
|
||||
|
||||
@@ -10,43 +10,31 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
||||
start: function() {
|
||||
var self = this;
|
||||
var r = this._super.apply(this, arguments);
|
||||
// this.$container.addClass('oe_website_editor_container');
|
||||
Aloha.ready(function() {
|
||||
Aloha.jQuery('[data-oe-model]').aloha(); //.attr('contentEditable', 'true').addClass('oe_editable');
|
||||
self.$('button').prop('disabled', true);
|
||||
Aloha.bind('aloha-editable-activated', function (ev, args) {
|
||||
console.log(ev, args);
|
||||
var $e = args.editable.obj;
|
||||
if (!$e.is('.oe_dirty')) {
|
||||
$e.addClass('oe_dirty');
|
||||
self.$('button').prop('disabled', false);
|
||||
// TODO: Are we going to use a meta-data flag in order to know if the field shall be text or html ?
|
||||
$e.data('original', $e.html());
|
||||
}
|
||||
});
|
||||
});
|
||||
// .click(function (e) {
|
||||
// e.stopPropagation();
|
||||
// e.preventDefault();
|
||||
// });
|
||||
//$('body').on("keypress.oe_webeditor", ".oe_editable", function(e) {
|
||||
// var $e = $(e.currentTarget);
|
||||
// if (!$e.is('.oe_dirty')) {
|
||||
// $e.addClass('oe_dirty');
|
||||
// self.$('button').prop('disabled', false);
|
||||
// // TODO: Are we going to use a meta-data flag in order to know if the field shall be text or html ?
|
||||
// $e.data('original', $e.text());
|
||||
// }
|
||||
// if (e.which == 13) {
|
||||
// $e.blur();
|
||||
// e.preventDefault();
|
||||
// }
|
||||
//});
|
||||
return r;
|
||||
},
|
||||
save: function () {
|
||||
var self = this;
|
||||
var defs = [];
|
||||
this.$container.find('.oe_dirty').each(function () {
|
||||
$('.oe_dirty').each(function () {
|
||||
var $el = $(this);
|
||||
var def = self.saveElement($el).then(function () {
|
||||
$el.removeClass('oe_dirty');
|
||||
}).fail(function () {
|
||||
var data = $el.data();
|
||||
self.do_warn('Error', _.str.sprintf('Could not save %s#%d#%s', data.model, data.id, data.field));
|
||||
console.error(_.str.sprintf('Could not save %s#%d#%s', data.oeModel, data.oeId, data.oeField));
|
||||
});
|
||||
defs.push(def);
|
||||
});
|
||||
@@ -56,20 +44,13 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
||||
},
|
||||
saveElement: function ($el) {
|
||||
var data = $el.data();
|
||||
var update = {};
|
||||
update[data.field] = $el.text();
|
||||
return (new instance.web.DataSet(this, data.model)).write(data.id, update);
|
||||
return (new instance.web.DataSet(this, 'ir.ui.view')).call('save', [data.oeModel, data.oeId, data.oeField, $el.html(), data.oeXpath]);
|
||||
},
|
||||
cancel: function () {
|
||||
this.$container.find('.oe_dirty').each(function () {
|
||||
$(this).removeClass('oe_dirty').text($(this).data('original'));
|
||||
$('.oe_dirty').each(function () {
|
||||
$(this).removeClass('oe_dirty').html($(this).data('original'));
|
||||
});
|
||||
this.$('button').prop('disabled', true);
|
||||
},
|
||||
destroy: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this.$container.removeClass('oe_website_editor_container');
|
||||
this.$container.find('.oe_editable').removeAttr('contentEditable');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -12,18 +12,6 @@ Aloha.ready(function() {
|
||||
// Another hack since we have no callback when webclient has loaded modules.
|
||||
instance.web.qweb.add_template('/website/static/src/xml/website.xml');
|
||||
|
||||
setTimeout(function () {
|
||||
// HACKY HACK YUCK YUCK !!
|
||||
// TODO: Need modification to webclient. Webclient shall trigger an event when it's ready.
|
||||
// Maybe notification shall trigger event too, so the host can bind on it and use
|
||||
// it's own means in order to trigger it's own notification !?
|
||||
if (instance.web.notification) {
|
||||
instance.web.notification.$el.appendTo('body');
|
||||
} else {
|
||||
console.log("too late");
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
$(function() {
|
||||
var editor = new instance.website.EditorBar(instance.webclient);
|
||||
editor.prependTo($('body'));
|
||||
|
||||
Reference in New Issue
Block a user