jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/331221 )
Change subject: Cosmetic changes to fit coding conventions, organize ...................................................................... Cosmetic changes to fit coding conventions, organize - Moved JS and CSS files into resources folder - Spacing per coding conventions - Switch to jQuery() instead of $(document).ready() since .ready() is being deprecated in jQuery 3.0 https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function - Tabbing in package.json - Renamed CSS and JS files to naming conventions Change-Id: Idfcdd1a8e3dcae181fd48a72f6cf32de9203c86d --- M Gruntfile.js M SpecialPetition.php M SpecialPetitionData.php M extension.json M package.json D petition.js R resources/ext.petition.css A resources/ext.petition.js 8 files changed, 30 insertions(+), 31 deletions(-) Approvals: jenkins-bot: Verified Siebrand: Looks good to me, approved diff --git a/Gruntfile.js b/Gruntfile.js index 171195a..0a3d1d8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,7 +10,7 @@ jshintrc: true }, all: [ - '*.js' + 'resources/*.js' ] }, banana: { diff --git a/SpecialPetition.php b/SpecialPetition.php index 9b3e81e..8a9ddc6 100755 --- a/SpecialPetition.php +++ b/SpecialPetition.php @@ -9,15 +9,14 @@ return true; } - function execute($par) { + function execute( $par ) { $out = $this->getOutput(); // Can have multiple named petitions using {{Special:Petition/foo}} // Can also specify am optional tracking parameter e.g. {{Special:Petition/foo/email}} - $arr = explode('/', $par); - $petitionName = isset($arr[0]) ? $arr[0] : 'default'; - $source = isset($arr[1]) ? $arr[1] : ''; - + $arr = explode( '/', $par ); + $petitionName = isset( $arr[0] ) ? $arr[0] : 'default'; + $source = isset( $arr[1] ) ? $arr[1] : ''; $this->setHeaders(); $this->outputHeader(); @@ -87,7 +86,7 @@ // Update the cached number of signatures $cache = ObjectCache::getMainWANInstance(); - $key = wfMemcKey( 'petition', md5($formData['petitionname']), 'numsignatures' ); + $key = wfMemcKey( 'petition', md5( $formData['petitionname'] ), 'numsignatures' ); $cache->touchCheckKey( $key ); // Log signature @@ -145,7 +144,7 @@ if ( is_callable( array( 'CountryNames', 'getNames' ) ) ) { // Need to flip as HTMLForm requires display name as the key $countries = array_flip( CountryNames::getNames( $language ) ); - ksort($countries); + ksort( $countries ); return $countries; } diff --git a/SpecialPetitionData.php b/SpecialPetitionData.php index 5ff32fe..62be195 100644 --- a/SpecialPetitionData.php +++ b/SpecialPetitionData.php @@ -45,8 +45,8 @@ $response->header( "Content-type: text/csv; charset=utf-8" ); $fh = fopen( 'php://output', 'w' ); - fputcsv( $fh, array('id', 'petitionname', 'source', 'name', - 'email', 'country', 'message', 'share', 'timestamp')); + fputcsv( $fh, array( 'id', 'petitionname', 'source', 'name', + 'email', 'country', 'message', 'share', 'timestamp' ) ); foreach( $res as $row ) { diff --git a/extension.json b/extension.json index 93f2d2a..f458cb5 100644 --- a/extension.json +++ b/extension.json @@ -44,8 +44,8 @@ }, "ResourceModules": { "ext.Petition": { - "scripts": "petition.js", - "styles": "petition.css", + "scripts": "resources/ext.petition.js", + "styles": "resources/ext.petition.css", "dependencies": "mediawiki.ui" } }, diff --git a/package.json b/package.json index 7643164..1fb7b69 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { - "private": true, - "scripts": { - "test": "grunt test" - }, - "devDependencies": { - "grunt": "0.4.5", - "grunt-cli": "0.1.13", - "grunt-banana-checker": "0.4.0", - "grunt-jsonlint": "1.0.7", - "grunt-contrib-jshint": "0.11.3" - } + "private": true, + "scripts": { + "test": "grunt test" + }, + "devDependencies": { + "grunt": "0.4.5", + "grunt-cli": "0.1.13", + "grunt-banana-checker": "0.4.0", + "grunt-jsonlint": "1.0.7", + "grunt-contrib-jshint": "0.11.3" + } } diff --git a/petition.js b/petition.js deleted file mode 100644 index f413982..0000000 --- a/petition.js +++ /dev/null @@ -1,6 +0,0 @@ -$(document).ready(function() { - // If site has geolocation, automatically select country - if( typeof(window.Geo) !== 'undefined' ) { - $('.petition-form #mw-input-wpcountry').val(Geo.country); - } -}); \ No newline at end of file diff --git a/petition.css b/resources/ext.petition.css similarity index 88% rename from petition.css rename to resources/ext.petition.css index d344a23..2e59dc2 100644 --- a/petition.css +++ b/resources/ext.petition.css @@ -1,7 +1,7 @@ /* Match rest of mw-ui-vform style */ .petition-form #mw-input-wpcountry, .petition-form #mw-input-wppersonalmessage { - padding: 0.35em 0.5em 0.35em 0.5em; + padding: 0.35em 0.5em; border: 1px solid #ccc; color: #252525; margin: 0; @@ -12,4 +12,4 @@ font-size: 0.9em; line-height: normal; color: #4d4d4d; -} \ No newline at end of file +} diff --git a/resources/ext.petition.js b/resources/ext.petition.js new file mode 100644 index 0000000..6e16563 --- /dev/null +++ b/resources/ext.petition.js @@ -0,0 +1,6 @@ +$( function() { + // If site has geolocation, automatically select country + if( typeof( window.Geo ) !== 'undefined' ) { + $( '.petition-form #mw-input-wpcountry' ).val( Geo.country ); + } +} ); -- To view, visit https://gerrit.wikimedia.org/r/331221 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idfcdd1a8e3dcae181fd48a72f6cf32de9203c86d Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Petition Gerrit-Branch: master Gerrit-Owner: SamanthaNguyen <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Pcoombe <[email protected]> Gerrit-Reviewer: SamanthaNguyen <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: Umherirrender <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
