Skip to content

Commit 651a1a3

Browse files
committed
Made it so the plugin whose settings were saved will be the plugin currently selected when the user is returned to the edit plugin settings screen. This is necessary because the default behavior is simply to auto-select whatever happens to be the first plugin in the list.
1 parent 96c9c4d commit 651a1a3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/MT/CMS/Plugin.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ sub cfg_plugins {
3535
$param{reset} = 1 if $app->param('reset');
3636
$param{saved} = 1 if $app->param('saved');
3737
$param{mod_perl} = 1 if $ENV{MOD_PERL};
38+
$param{plugin} = $app->param('plugin');
3839
$param{screen_id} = "list-plugins";
3940
$param{screen_class} = "plugin-settings";
4041
build_plugin_table( $app, param => \%param, scope => $q->param('blog_id') ? 'blog:'.$q->param('blog_id') : 'system' );
@@ -73,6 +74,7 @@ sub save_config {
7374
}
7475

7576
$app->add_return_arg( saved => 1 );
77+
$app->add_return_arg( plugin => $profile->{object}->id );
7678
$app->call_return;
7779
}
7880

@@ -285,7 +287,8 @@ sub build_plugin_table {
285287
plugin_config_link => $plugin->config_link(),
286288
plugin_config_html => $config_html,
287289
plugin_settings_id => $settings->id,
288-
plugin_id => $id,
290+
plugin_id => $plugin->id,
291+
plugin_num => $id,
289292
plugin_compat_errors => $registry->{compat_errors},
290293
};
291294
my $block_tags = $plugin->registry('tags', 'block');

tmpl/cms/include/plugins_content_nav.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ $(document).ready( function() {
1010
$(this).parent().addClass('active');
1111
$('#' + newactive).show();
1212
});
13+
<mt:if name="plugin">
14+
$('#content-nav ul li a[title="plugin-<$mt:var name="plugin"$>"]').trigger('click');
15+
<mt:else>
1316
if (a && $('#content-nav ul li a[title="'+a[1]+'"]')) {
1417
$('#content-nav ul li a[title="'+a[1]+'"]').trigger('click');
1518
} else {
1619
$('#content-nav ul li:first-child').find('a').trigger('click');
1720
}
21+
</mt:if>
1822
});
1923
</script>
2024
<ul>
2125
<mt:loop name="plugin_loop">
22-
<li><a href="javascript:void(0)" title="plugin-<$mt:var name="plugin_id" dirify="1"$>"><b><$mt:var name="plugin_name"$></b></a></li>
26+
<li<mt:if name="plugin" eq="$plugin_id"> class="active"</mt:if>><a href="javascript:void(0)" title="plugin-<$mt:var name="plugin_id" dirify="1"$>"><b><$mt:var name="plugin_name"$></b></a></li>
2327
</mt:loop>
2428
</ul>

0 commit comments

Comments
 (0)