r98001 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98000‎ | r98001 | r98002 >
Date:13:52, 24 September 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
SpecialMoodBarFeedback: Add nojs paging links
* Add images for left and right arrows, enabled and disabled. Used the images Brandon uploaded to mediawiki.org
** The naming is a bit weird. I would've preferred to call them page-{active,disabled}-{left,right}.png , but had to use {ltr,rtl} instead because ResourceLoader instructs CSSJanus to flip ltrand rtl in URLs, but not to flip left and right in URLs. I considered changing that behavior but didn't like the backwards compatibility implications. I may revisit that later
* Add messages for "More" (which was hardcoded all the time; for shame!), "Newer" and "Older"
* Output a link or a <span>, depending on whether there are results in the given direction. Going back (the "Newer" link) is not yet functional
* Tweak the CSS
** Share common rules between More, Newer and Older
** Show either More or Newer&Older, depending on whether JS is enabled. This requires r95318 which is currently only in trunk
** Made the text for disabled "links" (really spans) gray. Pulled the color value from the PNG
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/SpecialMoodBarFeedback.php (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-ltr.png (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-rtl.png (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-ltr.png (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-rtl.png (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/page.css (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/SpecialMoodBarFeedback.php
@@ -102,6 +102,7 @@
103103 global $wgLang, $wgRequest;
104104 $now = wfTimestamp( TS_UNIX );
105105 $list = '';
 106+ $firstRow = false; // TODO support the "Newer" link with this
106107 foreach ( $rows as $row ) {
107108 $type = $row->mbf_type;
108109 $typeMsg = wfMessage( "moodbar-type-$type" )->escaped();
@@ -139,11 +140,33 @@
140141 // Only show paging stuff if the result is not empty and there are more results
141142 $html = "<ul id=\"fbd-list\">$list</ul>";
142143 if ( $lastRow ) {
143 - $offset = wfTimestamp( TS_MW, $lastRow->mbf_timestamp ) . '|' . intval( $lastRow->mbf_id );
144 - $moreURL = htmlspecialchars( $this->getTitle()->getLinkURL( $this->getQuery( $offset ) ) );
145144 $moreText = wfMessage( 'moodbar-feedback-more' )->escaped();
146 - $html .= "<div id=\"fbd-list-more\"><a href=\"$moreURL\">More</a></div>";
 145+ $html .= '<div id="fbd-list-more"><a href="#">' . $moreText . '</a></div>';
147146 }
 147+
 148+ $olderURL = $newerURL = false;
 149+ if ( $lastRow ) {
 150+ $offset = wfTimestamp( TS_MW, $lastRow->mbf_timestamp ) . '|' . intval( $lastRow->mbf_id );
 151+ $olderURL = htmlspecialchars( $this->getTitle()->getLinkURL( $this->getQuery( $offset ) ) );
 152+ }
 153+ if ( $firstRow ) {
 154+ $newerURL = htmlspecialchars( '#' ); // TODO
 155+ }
 156+ $olderText = wfMessage( 'moodbar-feedback-older' )->escaped();
 157+ $newerText = wfMessage( 'moodbar-feedback-newer' )->escaped();
 158+ $html .= '<div id="fbd-list-newer-older"><div id="fbd-list-newer">';
 159+ if ( $newerURL ) {
 160+ $html .= "<a href=\"$newerURL\">$newerText</a>";
 161+ } else {
 162+ $html .= "<span class=\"fbd-page-disabled\">$newerText</span>";
 163+ }
 164+ $html .= '</div><div id="fbd-list-older">';
 165+ if ( $olderURL ) {
 166+ $html .= "<a href=\"$olderURL\">$olderText</a>";
 167+ } else {
 168+ $html .= "<span class=\"fbd-page-disabled\">$olderText</span>";
 169+ }
 170+ $html .= '</div><div style="clear: both;"></div></div>';
148171 return $html;
149172 }
150173 }
Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -84,6 +84,9 @@
8585 'moodbar-feedback-whatis' => 'What is this feature?',
8686 'moodbar-feedback-permalink' => 'link to here',
8787 'moodbar-feedback-noresults' => 'There are no comments that match your filters.',
 88+ 'moodbar-feedback-more' => 'More',
 89+ 'moodbar-feedback-newer' => 'Newer',
 90+ 'moodbar-feedback-older' => 'Older',
8891 // Mood types
8992 'moodbar-type-happy' => 'Happy',
9093 'moodbar-type-sad' => 'Sad',
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/page.css
@@ -87,22 +87,82 @@
8888 list-style: none;
8989 }
9090
91 -#fbd-list-more {
 91+.client-nojs #fbd-list-more {
 92+ display: none;
 93+}
 94+
 95+.client-js #fbd-list-newer-older {
 96+ display: none;
 97+}
 98+
 99+#fbd-list-more, #fbd-list-newer-older {
92100 margin: 1em 0 0 13em;
93101 padding: 0.5em;
94102 background-color: #e8f2f8;
 103+}
 104+
 105+#fbd-list-more a, #fbd-list-newer a, #fbd-list-older a,
 106+#fbd-list-newer .fbd-page-disabled, #fbd-list-older .fbd-page-disabled {
 107+ font-size: 1.4em;
 108+ background-repeat: no-repeat;
 109+}
 110+
 111+#fbd-list-more {
95112 text-align: center;
96113 }
97114
98115 #fbd-list-more a {
99 - font-size: 1.4em;
100 - padding-left: 20px;
101116 /* @embed */
102117 background-image: url(images/page-more.png);
103118 background-position: left center;
104 - background-repeat: no-repeat;
 119+ padding-left: 20px;
105120 }
106121
 122+#fbd-list-newer {
 123+ float: left;
 124+}
 125+
 126+#fbd-list-newer a, #fbd-list-newer .fbd-page-disabled {
 127+ background-position: left center;
 128+ padding-left: 20px;
 129+}
 130+
 131+/* The images here are named -ltr instead of -left and -rtl instead of -right
 132+ * because ResourceLoader flips -ltr and -rtl in URLs, but not -left and -right
 133+ */
 134+#fbd-list-newer a {
 135+ /* @embed */
 136+ background-image: url(images/page-active-ltr.png);
 137+}
 138+
 139+#fbd-list-newer .fbd-page-disabled {
 140+ /* @embed */
 141+ background-image: url(images/page-disabled-ltr.png);
 142+}
 143+
 144+#fbd-list-older {
 145+ float: right;
 146+}
 147+
 148+#fbd-list-older a, #fbd-list-older .fbd-page-disabled {
 149+ background-position: right center;
 150+ padding-right: 20px;
 151+}
 152+
 153+#fbd-list-older a {
 154+ /* @embed */
 155+ background-image: url(images/page-active-rtl.png);
 156+}
 157+
 158+#fbd-list-older .fbd-page-disabled {
 159+ /* @embed */
 160+ background-image: url(images/page-disabled-rtl.png);
 161+}
 162+
 163+.fbd-page-disabled {
 164+ color: #c6c6c6;
 165+}
 166+
107167 .fbd-item {
108168 border-bottom: solid 1px silver;
109169 position: relative;
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-ltr.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-ltr.png
___________________________________________________________________
Added: svn:mime-type
110170 + image/png
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-rtl.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-rtl.png
___________________________________________________________________
Added: svn:mime-type
111171 + image/png
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-ltr.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-ltr.png
___________________________________________________________________
Added: svn:mime-type
112172 + image/png
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-rtl.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-rtl.png
___________________________________________________________________
Added: svn:mime-type
113173 + image/png

Follow-up revisions

RevisionCommit summaryAuthorDate
r98002Add message docs for r98001catrope14:11, 24 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95318* (bug 30497) Add client-nojs and client-js classes on document element to le...brion18:33, 23 August 2011

Comments

#Comment by Siebrand (talk | contribs)   13:56, 24 September 2011

Please add message documentation for the newly added messages. Thanks.

Status & tagging log