summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2013-07-02 14:32:28 +0200
committerFabien Meghazi <fme@openerp.com>2013-07-02 14:32:28 +0200
commitfec0b5e39146701558a3124efd6ffb66f5ff67bf (patch)
treea168ce89856582cab13a6796f7dc7603c0addcf8 /addons/website/static/src
parentfe954304511203981e819b3265679b487a5c316e (diff)
[FIX] stuff
bzr revid: fme@openerp.com-20130702123228-2dzs7g9dm6gpldw3
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/css/website.css106
-rw-r--r--addons/website/static/src/css/website.sass5
-rw-r--r--addons/website/static/src/js/website.js43
-rw-r--r--addons/website/static/src/js/website_bootstrap.js12
4 files changed, 23 insertions, 143 deletions
diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css
index a7f79c31faa..fa61e0adaa2 100644
--- a/addons/website/static/src/css/website.css
+++ b/addons/website/static/src/css/website.css
@@ -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;
-}
-
-.oe_website_editor_container .oe_editable {
- outline: 1px dotted green;
-}
-
-.oe_website_editor_container .oe_editable.oe_dirty {
- outline: 1px dotted red;
+ display: inline;
}
-
-/* }}} */
diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass
index 6de72358f90..87a8973f901 100644
--- a/addons/website/static/src/css/website.sass
+++ b/addons/website/static/src/css/website.sass
@@ -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
-
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index 7e8b45e1a81..73943f10171 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -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');
}
});
diff --git a/addons/website/static/src/js/website_bootstrap.js b/addons/website/static/src/js/website_bootstrap.js
index 012c39b38b7..e70183fe767 100644
--- a/addons/website/static/src/js/website_bootstrap.js
+++ b/addons/website/static/src/js/website_bootstrap.js
@@ -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'));