Skip to content

Commit

Permalink
Merge pull request #1441 from Automattic/change/stay-on-current-setti…
Browse files Browse the repository at this point in the history
…ngs-page

Keep the currently active settings page
  • Loading branch information
jom authored Apr 12, 2018
2 parents 350f874 + e39362f commit f7c1ada
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion includes/admin/class-wp-job-manager-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public function output() {
$this->init_settings();
?>
<div class="wrap job-manager-settings-wrap">
<form method="post" action="options.php">
<form class="job-manager-options" method="post" action="options.php">

<?php settings_fields( $this->settings_group ); ?>

Expand Down Expand Up @@ -546,13 +546,21 @@ public function output() {
</div>
<script type="text/javascript">
jQuery('.nav-tab-wrapper a').click(function() {
if ( '#' !== jQuery(this).attr( 'href' ).substr( 0, 1 ) ) {
return false;
}
jQuery('.settings_panel').hide();
jQuery('.nav-tab-active').removeClass('nav-tab-active');
jQuery( jQuery(this).attr('href') ).show();
jQuery(this).addClass('nav-tab-active');
window.location.hash = jQuery(this).attr('href');
jQuery( 'form.job-manager-options' ).attr( 'action', 'options.php' + jQuery(this).attr( 'href' ) );
return false;
});
var goto_hash = window.location.hash;
if ( '#' === goto_hash.substr( 0, 1 ) ) {
jQuery( 'form.job-manager-options' ).attr( 'action', 'options.php' + jQuery(this).attr( 'href' ) );
}
if ( goto_hash ) {
var the_tab = jQuery( 'a[href="' + goto_hash + '"]' );
if ( the_tab.length > 0 ) {
Expand Down

0 comments on commit f7c1ada

Please sign in to comment.