r90926 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90925‎ | r90926 | r90927 >
Date:00:04, 28 June 2011
Author:krinkle
Status:deferred
Tags:
Comment:
Initial check-in of MoodBar front-end:
- Renamed module to ext.moodBar per convention.
- Added i18n msgs for two triggers ("Using SITENAME..." and "Feedback"), to be used in bucket testing.
- Added script that injects the trigger and some styling for them.
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.hooks.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.php (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.css (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.js (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/images (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/images/speechbubble-icon-ellipse-blue.png (added) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/images/speechbubble-icon-rndrectangle-blue.png (added) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -14,8 +14,21 @@
1515
1616 $messages['en'] = array(
1717 'moodbar-desc' => 'Allows specified users to send their "mood" back to the site operator',
 18+ 'moodbar-trigger-using' => 'Using $1...',
 19+ 'tooltip-p-moodbar-trigger-using' => '',
 20+ 'moodbar-trigger-feedback' => 'Feedback',
 21+ 'tooltip-p-moodbar-trigger-feedback' => '',
1822 );
 23+
 24+/** Message documentation
 25+ * @author Krinkle
 26+ */
1927
 28+$messages['qqq'] = array(
 29+ 'moodbar-trigger-using' => 'Link text of the MoodBar overlay trigger. $1 is the SITENAME.',
 30+ 'moodbar-trigger-feedback' => 'Link text of the MoodBar overlay trigger. $1 is the SITENAME.',
 31+);
 32+
2033 /** Afrikaans (Afrikaans)
2134 * @author Naudefj
2235 */
Index: trunk/extensions/MoodBar/modules/ext.moodBar/images/speechbubble-icon-rndrectangle-blue.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/images/speechbubble-icon-rndrectangle-blue.png
___________________________________________________________________
Added: svn:mime-type
2336 + image/png
Index: trunk/extensions/MoodBar/modules/ext.moodBar/images/speechbubble-icon-ellipse-blue.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/images/speechbubble-icon-ellipse-blue.png
___________________________________________________________________
Added: svn:mime-type
2437 + image/png
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.css
@@ -0,0 +1,22 @@
 2+/* Based on p-personal */
 3+#p-moodbar {
 4+ position: absolute;
 5+ left: 10.75em;
 6+ top: 0px;
 7+}
 8+
 9+#p-moodbar p {
 10+ margin-top: 0.5em;
 11+ margin-right: 0.75em;
 12+ font-size: 0.75em;
 13+ white-space: nowrap;
 14+ line-height: 1.125em;
 15+ text-transform: none;
 16+ padding-left: 20px !important;
 17+ /* @embed */
 18+ background: url(images/speechbubble-icon-ellipse-blue.png) left top no-repeat;
 19+}
 20+
 21+#mw-moodbar-overlay {
 22+
 23+}
\ No newline at end of file
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.css
___________________________________________________________________
Added: svn:eol-style
124 + native
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.js
@@ -0,0 +1,52 @@
 2+/**
 3+ * Front-end scripting for the MoodBar MediaWiki extension
 4+ *
 5+ * @author Timo Tijhof, 2011
 6+ */
 7+( function( $ ) {
 8+
 9+ var mb = mw.moodBar = {
 10+
 11+ ui: {
 12+ // jQuery objects
 13+ pMoodbar: null,
 14+ trigger: null,
 15+ overlay: null // @todo
 16+ },
 17+ event: {
 18+ trigger: function( e ) {
 19+ e.preventDefault();
 20+ }
 21+ },
 22+ init: function() {
 23+ var ui = mb.ui;
 24+
 25+ // Create portlet
 26+ ui.pMoodbar = $( '<div id="p-moodbar"></div>' );
 27+
 28+ // Create trigger
 29+ ui.trigger = $( '<a>', {
 30+ href: '#',
 31+ title: mw.msg( 'tooltip-p-moodbar-trigger-using' ),
 32+ text: mw.msg( 'moodbar-trigger-using', mw.config.get( 'wgSiteName' ) ),
 33+ click: mb.event.trigger
 34+ });
 35+
 36+ // Insert trigger into portlet
 37+ ui.trigger
 38+ .wrap( '<p>' )
 39+ .parent()
 40+ .appendTo( ui.pMoodbar );
 41+
 42+ // Inject portlet into document, when document is ready
 43+ $( mb.inject );
 44+ },
 45+ inject: function() {
 46+ $( '#mw-head' ).append( mb.ui.pMoodbar );
 47+ }
 48+
 49+ };
 50+
 51+ mw.moodBar.init();
 52+
 53+} )( jQuery );
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.js
___________________________________________________________________
Added: svn:eol-style
154 + native
Index: trunk/extensions/MoodBar/MoodBar.php
@@ -30,13 +30,18 @@
3131
3232 // Resources
3333 $mbResourceTemplate = array(
34 - 'localBasePath' => dirname(__FILE__),
35 - 'remoteExtPath' => 'MoodBar'
 34+ 'localBasePath' => dirname(__FILE__) . '/modules',
 35+ 'remoteExtPath' => 'MoodBar/modules'
3636 );
3737
38 -$wgResourceModules['ext.moodbar'] = $mbResourceTemplate + array(
39 - 'styles' => array( ),
40 - 'scripts' => array( ),
41 - 'dependencies' => array( ),
42 - 'messages' => array( ),
 38+$wgResourceModules['ext.moodBar'] = $mbResourceTemplate + array(
 39+ 'styles' => 'ext.moodBar/ext.moodBar.css',
 40+ 'scripts' => 'ext.moodBar/ext.moodBar.js',
 41+ 'messages' => array(
 42+ 'moodbar-trigger-using',
 43+ 'tooltip-p-moodbar-trigger-using',
 44+ 'moodbar-trigger-feedback',
 45+ 'tooltip-p-moodbar-trigger-feedback',
 46+ ),
 47+ 'position' => 'top',
4348 );
Index: trunk/extensions/MoodBar/MoodBar.hooks.php
@@ -5,8 +5,8 @@
66 * Adds MoodBar JS to the output if appropriate.
77 */
88 public static function onPageDisplay( &$output, &$skin ) {
9 - if ( self::shouldShowMoodbar() ) {
10 - $output->addModules( array('ext.moodbar') );
 9+ if ( self::shouldShowMoodbar( $output, $skin ) ) {
 10+ $output->addModules( array('ext.moodBar') );
1111 }
1212
1313 return true;
@@ -15,8 +15,15 @@
1616 /**
1717 * Determines whether or not we should show the MoodBar.
1818 */
19 - public static function shouldShowMoodbar() {
20 - return true;
 19+ public static function shouldShowMoodbar( &$output, &$skin ) {
 20+ // Front-end appends to header elements, which have different
 21+ // locations and IDs in every skin.
 22+ // Untill there is some kind of central registry of element-ids
 23+ // that skins implement, or a fixed name for each of them, just
 24+ // show it in Vector for now.
 25+ if ( $skin->getSkinName() == 'vector' ) {
 26+ return true;
 27+ }
2128 }
2229
2330 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r90953Followup r90926 for Translatewikiraymond12:53, 28 June 2011

Status & tagging log