r96624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96623‎ | r96624 | r96625 >
Date:22:28, 8 September 2011
Author:inez
Status:deferred
Tags:
Comment:
Almost working lists (still not added in DOM)
Modified paths:
  • /trunk/parsers/wikidom/lib/synth/bases/es.ModelContainerItem.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js
@@ -17,13 +17,20 @@
1818 /* Methods */
1919
2020 /**
 21+ * Creates a view for this model
 22+ */
 23+es.ListBlockItemModel.prototype.createView = function() {
 24+ return new es.ListBlockItemView( this );
 25+};
 26+
 27+/**
2128 * Gets the length of all content.
2229 *
2330 * @method
2431 * @returns {Integer} Length of all content
2532 */
2633 es.ListBlockItemModel.prototype.getContentLength = function() {
27 - return content.getLength();
 34+ return this.content.getLength();
2835 };
2936
3037 /**
@@ -36,16 +43,6 @@
3744 return { 'content': this.content.getPlainObject(), 'styles': this.styles.slice( 0 ) };
3845 };
3946
40 -/**
41 - * Gets a sum of cell content lengths.
42 - *
43 - * @method
44 - * @returns {Integer}
45 - */
46 -es.ListBlockItemModel.prototype.getLength = function() {
47 - return this.cells.getLength();
48 -};
49 -
5047 /* Inheritance */
5148
5249 es.extend( es.ListBlockItemModel, es.ModelContainerItem );
\ No newline at end of file
Index: trunk/parsers/wikidom/lib/synth/bases/es.ModelContainerItem.js
@@ -26,7 +26,7 @@
2727 * Creates a view for this model
2828 */
2929 es.ModelContainerItem.prototype.createView = function() {
30 - return new es.ViewContainerItem( this );
 30+ throw 'ModelContainerItem.createView not implemented in this subclass.';
3131 };
3232
3333 /**
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js
@@ -2,7 +2,7 @@
33 * Creates an es.ParagraphBlockView object.
44 */
55 es.ListBlockItemView = function( model ) {
6 - es.BlockView.call( this, model, 'item' );
 6+ es.ViewContainerItem.call( this, model, 'listItem' );
77 this.contentView = new es.ContentView( this.$, this.model.content );
88 };
99
@@ -34,4 +34,4 @@
3535 return this.contentView.getLineIndex( position );
3636 };
3737
38 -es.extend( es.ListBlockItemView, es.BlockView );
 38+es.extend( es.ListBlockItemView, es.ViewContainerItem );
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js
@@ -2,38 +2,39 @@
33 * Creates an es.ParagraphBlockView object.
44 */
55 es.ListBlockView = function( model ) {
6 - es.ViewContainer.call( this, model, 'list' );
7 - es.ViewContainerItem.call( this, model, 'list' );
8 - this.contentView = new es.ContentView( this.$, this.model.content );
 6+ es.ViewContainer.call( this, model, 'items' );
 7+ es.BlockView.call( this, model, 'list' );
98 };
109
1110 /**
1211 * Render content.
1312 */
1413 es.ListBlockView.prototype.renderContent = function() {
15 - this.contentView.render();
 14+ for ( var i = 0; i < this.views.length; i++ ) {
 15+ this.views[i].renderContent();
 16+ }
1617 };
1718
1819 /**
1920 * Gets offset within content of position.
2021 */
2122 es.ListBlockView.getContentOffset = function( position ) {
22 - return this.contentView.getOffset( position );
 23+ //return this.contentView.getOffset( position );
2324 };
2425
2526 /**
2627 * Gets rendered position of offset within content.
2728 */
2829 es.ListBlockView.getRenderedPosition = function( offset ) {
29 - return this.contentView.getPosition( position );
 30+ //return this.contentView.getPosition( position );
3031 };
3132
3233 /**
3334 * Gets rendered line index of offset within content.
3435 */
3536 es.ListBlockView.getRenderedLineIndex = function( offset ) {
36 - return this.contentView.getLineIndex( position );
 37+ //return this.contentView.getLineIndex( position );
3738 };
3839
3940 es.extend( es.ListBlockView, es.ViewContainer );
40 -es.extend( es.ListBlockView, es.ViewContainerItem );
 41+es.extend( es.ListBlockView, es.BlockView );

Status & tagging log