Kipcool has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69903


Change subject: Using automatic css ellipsis instead of fixed truncation for 
definitions in header. Also reduced a bit the text sizes.
......................................................................

Using automatic css ellipsis
instead of fixed truncation for definitions in header.
Also reduced a bit the text sizes.

Change-Id: I492dc2aea91640eb5f535d4d040097377a1c44ce
---
M OmegaWiki/Editor.php
M resources/tables.css
2 files changed, 38 insertions(+), 14 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLexicalData 
refs/changes/03/69903/1

diff --git a/OmegaWiki/Editor.php b/OmegaWiki/Editor.php
index 4e1387d..2ba72ce 100644
--- a/OmegaWiki/Editor.php
+++ b/OmegaWiki/Editor.php
@@ -1295,11 +1295,13 @@
                $expression = getExpression( $expressionId );
 
                // getting the truncated definition
-               $escapedDefinition = htmlspecialchars( $definition );
                if ( ( $this->truncateAt > 0 ) && ( strlen( $definition ) > 
$this->truncateAt ) ) {
+                       $escapedDefinition = htmlspecialchars( $definition );
                        $spancontent = htmlspecialchars( mb_substr( 
$definition, 0, $this->truncateAt ) ) . wfMessage( 'ellipsis' )->text();
-                       $escapedDefinition = Html::element( 'span', array( 
'title' => $escapedDefinition ), $spancontent );
+                       $definition = Html::element( 'span', array( 'title' => 
$escapedDefinition ), $spancontent );
                }
+
+               $htmlDefinition = Html::element('span', array( 'class' => 
'defheader' ), $definition );
 
                // setting the definition as meta description for the page
                if ( $isMetaDescSet == 0 ) {
@@ -1311,9 +1313,8 @@
                $DMPageName = $definingExpression . " (" . $definedMeaningId . 
")" ;
                $DMTitle = Title::makeTitle( NS_DEFINEDMEANING , $DMPageName );
                $editURL = $DMTitle->getLocalURL( 'action=edit' ) ;
-               $editLink = Html::openElement( 'span', array( 'class' => 
'dm_edit_link' ) );
-               $editLink .= Html::rawElement( 'sup', array(), '['. createLink( 
$editURL , wfMessage( 'edit')->text() ) . ']' );
-               $editLink .= Html::closeElement( 'span' );
+               $editLinkContent = '['. createLink( $editURL , wfMessage( 
'edit')->text() ) . ']';
+               $editLink = Html::rawElement( 'span', array( 'class' => 
'dm_edit_link' ), $editLinkContent );
 
                if ( $wgUser->getOption( 'ow_alt_layout' ) ) {
                        // EXPERIMENTAL LAYOUT:
@@ -1331,7 +1332,7 @@
                        if ( $translation != "" ) {
                                $output .= " : " . $translation;
                        }
-                       $output .= Html::element('br') . $escapedDefinition ;
+                       $output .= Html::element('br') . $htmlDefinition ;
 
                } else {
                        // STANDARD CLASSIC LAYOUT:
@@ -1343,7 +1344,7 @@
                                // try to get a translation
                                $definedMeaningAsLink = definedMeaningAsLink( 
$definedMeaningId );
                        }
-                       $output = $editLink . $definedMeaningAsLink . ": " . 
$escapedDefinition ;
+                       $output =  $definedMeaningAsLink . $editLink . " : " . 
$htmlDefinition ;
                }
 
                return $output ;
diff --git a/resources/tables.css b/resources/tables.css
index 697b587..3016d6f 100644
--- a/resources/tables.css
+++ b/resources/tables.css
@@ -46,11 +46,6 @@
        display: none;
 }
 
-/* edit links for definedmeaning that shows next to a definition */
-.dm_edit_link {
-       float:right;
-       font-size:60%;
-}
 
 /*****
  * Language filtering Icon Styling (icon on top of page)
@@ -251,15 +246,43 @@
 /******
  * other hierarchical elements
  */
+
+/* edit links for definedmeaning that shows next to a definition */
+.dm_edit_link {
+       /* does not work well with float because of text-overflow of the 
definitions */
+       position:absolute;
+       right:0;
+
+       /* a bit up */
+       top:-0.5em;
+
+       /* <sup> */
+       font-size:50%;
+       vertical-align: super;
+
+       /* for a bit of prettiness, to avoid text overlaps */
+       /* same color as below */
+       background-color: #e0ffff;
+       /* top right bottom left - color extends a bit on the sides, except 
right */
+       padding: 0.5em 0em 0.5em 0.5em;
+}
+
 .level3 {
-       font-size:120% ;
+       /* main definitions on one line */
+       text-overflow: ellipsis;
+       white-space: nowrap;
+       overflow: hidden;
+
+       /* need position relative so that the absolute dm_edit_link use this as 
parent */
+       position:relative;
+       font-size:110% ;
        background-color: #e0ffff;
        margin-top:10px;
        padding:5px;
 }
 
 .level4 {
-       font-size:110% ;
+       font-size:105% ;
        font-weight: bold;
        padding:5px;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/69903
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I492dc2aea91640eb5f535d4d040097377a1c44ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to