r101657 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101656‎ | r101657 | r101658 >
Date:18:49, 2 November 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Got classes for listItems and headings working so they can be changed on updates
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/es.Surface.css (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.ListItemView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/es.Surface.css
@@ -40,36 +40,37 @@
4141 font-size: 1em;
4242 }
4343
44 -h1.editSurface-headingBlock, h2.editSurface-headingBlock {
 44+.editSurface-headingBlock-level1,
 45+.editSurface-headingBlock-level2 {
4546 border-bottom: 1px solid #AAA;
4647 }
4748
48 -h1.editSurface-headingBlock > * {
 49+.editSurface-headingBlock-level1 > * {
4950 font-size:188%;
5051 font-weight: normal;
5152 }
5253
53 -h2.editSurface-headingBlock > * {
 54+.editSurface-headingBlock-level2 > * {
5455 font-size:150%;
5556 font-weight: normal;
5657 }
5758
58 -h3.editSurface-headingBlock > * {
 59+.editSurface-headingBlock-level3 > * {
5960 font-size:132%;
6061 font-weight: bold;
6162 }
6263
63 -h4.editSurface-headingBlock > * {
 64+.editSurface-headingBlock-level4 > * {
6465 font-size:116%;
6566 font-weight: bold;
6667 }
6768
68 -h5.editSurface-headingBlock > * {
 69+.editSurface-headingBlock-level5 > * {
6970 font-size:100%;
7071 font-weight: bold;
7172 }
7273
73 -h6.editSurface-headingBlock > * {
 74+.editSurface-headingBlock-level6 > * {
7475 font-size:80%;
7576 font-weight: bold;
7677 }
Index: trunk/parsers/wikidom/lib/hype/views/es.ListItemView.js
@@ -24,10 +24,19 @@
2525 };
2626
2727 es.ListItemView.prototype.setClasses = function() {
28 - // TODO: Unset previously set classes in case of switching from bullet list to numbered list
29 - // or changing indentation level
30 - var styles = this.model.getElementAttribute( 'styles' );
31 - this.$.addClass( 'editSurface-listItem-' + styles[ styles.length - 1 ] )
 28+ var classes = this.$.attr( 'class' ),
 29+ styles = this.model.getElementAttribute( 'styles' );
 30+ this.$
 31+ // Remove any existing level classes
 32+ .attr(
 33+ 'class',
 34+ classes
 35+ .replace( /editSurface-listItem-level[0-9]+/, '' )
 36+ .replace( /editSurface-listItem-(bullet|number)/, '' )
 37+ )
 38+ // Set the list style class from the style on top of the stack
 39+ .addClass( 'editSurface-listItem-' + styles[styles.length - 1] )
 40+ // Set the list level class from the length of the stack
3241 .addClass( 'editSurface-listItem-level' + ( styles.length - 1 ) );
3342 };
3443
Index: trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js
@@ -12,8 +12,26 @@
1313
1414 // DOM Changes
1515 this.$.addClass( 'editSurface-headingBlock' );
 16+
 17+ // Events
 18+ this.on( 'update', this.setClasses );
 19+
 20+ // Initialization
 21+ this.setClasses();
1622 };
1723
 24+/* Methods */
 25+
 26+es.HeadingView.prototype.setClasses = function() {
 27+ var classes = this.$.attr( 'class' ),
 28+ level = this.model.getElementAttribute( 'level' );
 29+ this.$
 30+ // Remove any existing level classes
 31+ .attr( 'class', classes.replace( /editSurface-headingBlock-level[1-6]/, '' ) )
 32+ // Add a new level class
 33+ .addClass( 'editSurface-headingBlock-level' + level );
 34+};
 35+
1836 /* Inheritance */
1937
2038 es.extendClass( es.HeadingView, es.DocumentViewLeafNode );

Status & tagging log