r98677 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98676‎ | r98677 | r98678 >
Date:16:10, 2 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r98675; added docs and module registration
Modified paths:
  • /trunk/extensions/Contest/Contest.php (modified) (history)
  • /trunk/extensions/Contest/resources/contest.special.welcome.js (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestWelcome.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php
@@ -64,14 +64,28 @@
6565 $this->showRules( $contest );
6666 $this->showSignupLinks( $contest );
6767
68 - $out->addModules( '' );
 68+ $out->addModules( 'contest.special.welcome' );
6969 }
7070 }
7171
 72+ /**
 73+ * Show the intro text for this contest.
 74+ *
 75+ * @since 0.1
 76+ *
 77+ * @param Contest $contest
 78+ */
7279 protected function showIntro( Contest $contest ) {
7380 $this->getOutput()->addWikiText( $this->getArticleContent( $contest->getField( 'intro' ) ) );
7481 }
7582
 83+ /**
 84+ * Show a list of the challanges part of this contest.
 85+ *
 86+ * @since 0.1
 87+ *
 88+ * @param Contest $contest
 89+ */
7690 protected function showChallanges( Contest $contest ) {
7791 $out = $this->getOutput();
7892
@@ -87,15 +101,36 @@
88102 }
89103 }
90104
 105+ /**
 106+ * Show the oppertunities for this contest.
 107+ *
 108+ * @since 0.1
 109+ *
 110+ * @param Contest $contest
 111+ */
91112 protected function showOpportunities( Contest $contest ) {
92113 $this->getOutput()->addWikiText( $this->getArticleContent( $contest->getField( 'oppertunities' ) ) );
93114 }
94115
 116+ /**
 117+ * Show the rules for this contest.
 118+ *
 119+ * @since 0.1
 120+ *
 121+ * @param Contest $contest
 122+ */
95123 protected function showRules( Contest $contest ) {
96124 // TODO: we might want to have a pop-up with the content here, instead of a link to the page.
97125 $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) );
98126 }
99127
 128+ /**
 129+ * Show the signup links for this contest.
 130+ *
 131+ * @since 0.1
 132+ *
 133+ * @param Contest $contest
 134+ */
100135 protected function showSignupLinks( Contest $contest ) {
101136 $out = $this->getOutput();
102137
@@ -110,6 +145,18 @@
111146 ) );
112147 }
113148
 149+ /**
 150+ * Gets the URL for the signup links.
 151+ * When the user has to login, this will be to the login page,
 152+ * with a retunrto to the signup page.
 153+ *
 154+ * @since 0.1
 155+ *
 156+ * @param string $contestName
 157+ * @param integer|false $challangeId
 158+ *
 159+ * @return string
 160+ */
114161 protected function getSignupLink( $contestName, $challangeId = false ) {
115162 $signupitle = SpecialPage::getTitleFor( 'ContestSignup', $contestName );
116163
@@ -124,6 +171,16 @@
125172 }
126173 }
127174
 175+ /**
 176+ * Gets the content of the article with the provided page name,
 177+ * or an empty string when there is no such article.
 178+ *
 179+ * @since 0.1
 180+ *
 181+ * @param string $pageName
 182+ *
 183+ * @return string
 184+ */
128185 protected function getArticleContent( $pageName ) {
129186 $title = Title::newFromText( $pageName );
130187
@@ -135,4 +192,4 @@
136193 return $article->getContent();
137194 }
138195
139 -}
\ No newline at end of file
 196+}
Index: trunk/extensions/Contest/Contest.php
@@ -152,6 +152,17 @@
153153 )
154154 );
155155
 156+$wgResourceModules['contest.special.welcome'] = $moduleTemplate + array(
 157+ 'scripts' => array(
 158+ 'contest.special.welcome.js'
 159+ ),
 160+ 'messages' => array(
 161+ ),
 162+ 'dependencies' => array(
 163+ 'jquery.ui.button'
 164+ )
 165+);
 166+
156167 unset( $moduleTemplate );
157168
158169 $egContestSettings = array();
Index: trunk/extensions/Contest/resources/contest.special.welcome.js
@@ -10,10 +10,10 @@
1111
1212 $( document ).ready( function() {
1313
14 - $( '#contest-signup' ).click( function() {
15 -
 14+ $( '.contest-signup' ).button().click( function() {
 15+ window.location = $( this ).attr( 'data-contest-target' );
1616 } );
17 -
 17+
1818 } );
1919
2020 })( window.jQuery, window.mediaWiki );
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98675work on welcome pagejeroendedauw16:03, 2 October 2011

Status & tagging log