X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3193141f55df20910cf8ba35f9e669d79c90d3f4..7a12b550f4a8366c8ace2f9c55706aba7c4b17f7:/platforma/static/js/views/html.js?ds=inline diff --git a/platforma/static/js/views/html.js b/platforma/static/js/views/html.js old mode 100644 new mode 100755 index fa52bd0f..3696bdc8 --- a/platforma/static/js/views/html.js +++ b/platforma/static/js/views/html.js @@ -15,12 +15,17 @@ var HTMLView = View.extend({ $('.htmlview', this.element).html(this.model.get('data')); this.modelStateChanged('state', this.model.get('state')); - this.model.load(); + this.model.load(); }, modelDataChanged: function(property, value) { $('.htmlview', this.element).html(value); this.updatePrintLink(); + + $("*[x-editable]").each(function() { + var e = $('
'); + e.appendTo(this); + }); }, updatePrintLink: function() { @@ -69,6 +74,7 @@ var HTMLView = View.extend({ this.updatePrintLink(); this.element.bind('click', this.itemClicked.bind(this)); + // this.element.bind('mouseover', this.itemHover.bind(this)); }, reload: function() { @@ -80,6 +86,16 @@ var HTMLView = View.extend({ this._super(); }, + itemHover: function(event) + { + var $e = $(event.target); + if( $e.attr('x-editable') == 'editable' ) { + console.log('over:', $e[0]); + $e.css({'background-color': 'grey'}); + } + + }, + itemClicked: function(event) { var self = this; @@ -88,9 +104,15 @@ var HTMLView = View.extend({ var editableContent = null; var $e = $(event.target); - var n = 0; + if($e.hasClass('edit-button')) + this.openForEdit($e); + }, + + openForEdit: function($e) + { + var n = 0; - while( ($e[0] != this.element[0]) && !($e.attr('wl2o:editable')) + while( ($e[0] != this.element[0]) && !($e.attr('x-editable')) && n < 50) { // console.log($e, $e.parent(), this.element); @@ -98,12 +120,13 @@ var HTMLView = View.extend({ n += 1; } - if(!$e.attr('wl2o:editable')) + if(!$e.attr('x-editable')) return true; - - // start edition on this node - + var $origin = $e; + console.log("editable: ", $e); + + // start edition on this node var $overlay = $( '