Skip to content

Commit d6ff09d

Browse files
committed
Revert "jqueryui.com: Sort demos by title"
This reverts commit 78349dc. Deployment is currently half-broken. Will revert again once jqueryui.com deployment is back up.
1 parent 78349dc commit d6ff09d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

mu-plugins/jqueryui.com/jquery-filters.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111

1212
$plugin = $post->post_name;
1313
$demoList = json_decode( file_get_contents( GW_RESOURCE_DIR . '/demos/demo-list.json' ) );
14-
$demos = $demoList->$plugin;
15-
$defaultDemo = $demos[ 0 ];
14+
$defaultDemo = $demoList->$plugin->default;
1615

1716
$demoContent .=
1817
'<div class="demo-list">' .
1918
'<h2>Examples</h2>' .
2019
'<ul>';
21-
foreach ( $demoList->$plugin as $demo ) {
22-
$filename = $demo->filename;
20+
foreach ( $demoList->$plugin as $filename => $demo ) {
2321
$demoContent .=
2422
($filename === 'default' ? '<li class="active">' : '<li>') .
2523
'<a href="/resources/demos/' . $plugin . '/' . $filename . '.html">' .

themes/jquery/js/scripts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ demoList.on( "click", "a", function( event ) {
164164
demo = parts[ 4 ].substring( 0, parts[ 4 ].length - 5 );
165165

166166
$.getJSON( "/resources/demos/demo-list.json" ).then(function( demoList ) {
167-
demoDescription.html( $.grep( demoList[ plugin ], function( x ) { return x.filename === demo; })[ 0 ].description );
167+
demoDescription.html( demoList[ plugin ][ demo ].description );
168168
demoFrame.attr( "src", filename );
169169
});
170170

0 commit comments

Comments
 (0)