snippet part3 + fix alhoa hightlight
bzr revid: al@openerp.com-20130702210035-44jka7w1ijc9vak8
This commit is contained in:
parent
ba96877809
commit
2663e21f50
|
@ -215,4 +215,5 @@
|
|||
|
||||
/* }}} */
|
||||
|
||||
|
||||
//.aloha-editable-active, .aloha-editable-active[contenteditable=true]:focus
|
||||
// outline: #80B5F2 solid 5px !important;
|
||||
|
|
|
@ -6,12 +6,14 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
|||
'click button[data-action=edit]': 'edit',
|
||||
'click button[data-action=save]': 'save',
|
||||
'click button[data-action=cancel]': 'cancel',
|
||||
'click button[data-action=snippet]': 'snippet',
|
||||
},
|
||||
container: 'body',
|
||||
start: function() {
|
||||
var self = this;
|
||||
self.$('button[data-action]').prop('disabled', true);
|
||||
self.$('button[data-action=edit]').prop('disabled', false);
|
||||
self.$('button[data-action=edit],button[data-action=snippet]').prop('disabled', false);
|
||||
self.snippet_start();
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
edit: function () {
|
||||
|
@ -19,7 +21,7 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
|||
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]').prop('disabled', false);
|
||||
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')) {
|
||||
|
@ -61,11 +63,33 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
|||
},
|
||||
cancel: function () {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
snippet_start: function () {
|
||||
var self = this;
|
||||
$('.oe_snippet').click(function(ev) {
|
||||
$('.oe_selected').removeClass('oe_selected');
|
||||
$snippet = $(ev.currentTarget);
|
||||
$snippet.addClass('oe_selected');
|
||||
$snippet.draggable();
|
||||
debugger;
|
||||
});
|
||||
|
||||
},
|
||||
snippet: function (ev) {
|
||||
console.log(ev);
|
||||
$('.oe_snippet_editor').show();
|
||||
},
|
||||
});
|
||||
|
||||
$(function(){
|
||||
|
||||
function make_static(){
|
||||
$('.oe_snippet_demo').removeClass('oe_new');
|
||||
$('.oe_page *').off('mouseover');
|
||||
$('.oe_page *').off('mouseleave');
|
||||
$('.oe_page .oe_selected').removeClass('oe_selected');
|
||||
}
|
||||
|
||||
var selected_snippet = null;
|
||||
function snippet_click(event){
|
||||
if(selected_snippet){
|
||||
|
@ -114,12 +138,6 @@ $(function(){
|
|||
});
|
||||
}
|
||||
|
||||
function make_static(){
|
||||
$('.oe_snippet_demo').removeClass('oe_new');
|
||||
$('.oe_page *').off('mouseover');
|
||||
$('.oe_page *').off('mouseleave');
|
||||
$('.oe_page .oe_selected').removeClass('oe_selected');
|
||||
}
|
||||
|
||||
|
||||
function append_snippet(event){
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<li><strong>OpenERP Website Editor</strong></li>
|
||||
<li class="oe_right"><button data-action="save">Save</button></li>
|
||||
<li class="oe_right"><button data-action="cancel">Cancel</button></li>
|
||||
<li class="oe_right"><button data-action="snippet">Snippet</button></li>
|
||||
<li class="oe_right"><button data-action="edit">Edit</button></li>
|
||||
</ul>
|
||||
</t>
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
</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.$;
|
||||
|
@ -90,6 +93,7 @@
|
|||
|
||||
<div class='oe_snippet_editor' style="display: none;">
|
||||
<div class='oe_snippet_list'>
|
||||
|
||||
<div class='oe_snippet' name='Screenshot' selafter='.oe_span6' selinside='.oe_row'>
|
||||
<div class="oe_span6">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
|
@ -99,7 +103,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='oe_snippet' name='Introduction' selafter='.oe_container'>
|
||||
<div class='oe_snippet' name='Introduction' data-selector=".oe_container">
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
|
|
Loading…
Reference in New Issue