[IMP] Hardcode css and jquery for website. Temporary revert aloha to raw contentEditable

bzr revid: fme@openerp.com-20130723131543-gyn4dcuy2rp2m3v2
This commit is contained in:
Fabien Meghazi 2013-07-23 15:15:43 +02:00
parent b7bacc8cfb
commit 1a30a11926
5 changed files with 32 additions and 45 deletions

View File

@ -119,3 +119,6 @@
}
/* }}} */
.oe_editable:focus {
outline: #80b5f2 solid 5px !important;
}

View File

@ -215,5 +215,5 @@
/* }}} */
//.aloha-editable-active, .aloha-editable-active[contenteditable=true]:focus
// outline: #80B5F2 solid 5px !important;
.oe_editable:focus
outline: #80B5F2 solid 5px !important

View File

@ -15,23 +15,25 @@ instance.website.EditorBar = instance.web.Widget.extend({
self.$('button[data-action]').prop('disabled', true);
self.$('button[data-action=edit],button[data-action=snippet]').prop('disabled', false);
self.snippet_start();
$('body').on("keypress", ".oe_editable", function(e) {
var $e = $(e.currentTarget);
if (!$e.is('.oe_dirty')) {
$e.addClass('oe_dirty');
self.$('button[data-action=save],button[data-action=cancel]').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 ?
}
if (e.which == 13) {
$e.blur();
e.preventDefault();
}
});
return this._super.apply(this, arguments);
},
edit: function () {
var self = this;
Aloha.ready(function() {
Aloha.jQuery('[data-oe-model]').aloha(); //.attr('contentEditable', 'true').addClass('oe_editable');
self.$('button').prop('disabled', true);
self.$('button[data-action=save],button[data-action=cancel],button[data-action=snippet]').prop('disabled', false);
Aloha.bind('aloha-editable-activated', function (ev, args) {
var $e = args.editable.obj;
if (!$e.is('.oe_dirty')) {
$e.addClass('oe_dirty');
// 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());
}
});
});
this.$('button[data-action=edit]').prop('disabled', true);
$('[data-oe-model]').attr('contentEditable', 'true').addClass('oe_editable');
},
save: function () {
var self = this;

View File

@ -1,4 +1,4 @@
Aloha.ready(function() {
$(function() {
// Init headless webclient
// TODO: Webclient research : use iframe embedding mode
// Meanwhile, let's HACK !!!

View File

@ -54,38 +54,24 @@
<html>
<head>
<title t-raw="title"><t t-esc="res_company.name"/></title>
<t t-raw="css"/>
<link rel='stylesheet' href='/website/static/src/css/base.css'/>
<link rel='stylesheet' href='/website/static/src/css/website.css'/>
<link rel='stylesheet' href='/website/static/lib/bootstrap/css/bootstrap.css'/>
<link rel='stylesheet' href='/web/static/lib/fontawesome/css/font-awesome.css'/>
<link rel='stylesheet' href='https://www.openerp.com/saas_master/static/site_new/fonts/lato/stylesheet.css'/>
<link href='//fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'/>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700' rel='stylesheet' type='text/css'/>
<t t-raw="script"/>
<t t-if="editable">
<link href="http://cdn.aloha-editor.org/latest/css/aloha.css" rel="stylesheet" type="text/css" />
<script>
openerp.$ = jQuery;
delete window.jQuery;
delete window.$;
Aloha = {}
Aloha.settings = {sidebar: {disabled: true}};
</script>
<script type="text/javascript" src="http://cdn.aloha-editor.org/latest/lib/require.js"></script>
<script type="text/javascript" src="http://cdn.aloha-editor.org/latest/lib/vendor/jquery-1.7.2.js"></script>
<!--
<script src="http://cdn.aloha-editor.org/latest/lib/aloha.js" data-aloha-plugins="common/ui, common/format, common/list, common/link, common/highlighteditables"></script>
-->
<script src="http://cdn.aloha-editor.org/latest/lib/aloha.js" data-aloha-plugins="common/ui, common/format, common/list, common/link"></script>
<script>
Aloha.ready(function() {
window.$ = openerp.$;
window.jQuery = openerp.$;
});
</script>
<script type="text/javascript" src="/web/static/lib/jquery/jquery-1.8.3.js"></script>
<t t-if="editable">
<t t-raw="css"/>
<t t-raw="script"/>
<link rel='stylesheet' href='static/src/css/snippets.css'/>
<script type="text/javascript" src="/website/static/src/js/website_bootstrap.js"></script>
</t>
</head>
<body class="oe_website oe_styling_v8">
<header class="oe_website_header">
<t t-call="website.header"/>
</header>
@ -182,10 +168,6 @@
</div>
</div>
</div>
</body>
</html>
</template>