Skip to content

remove chart types page while editing #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion classes/Visualizer/Module/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,14 @@ public function renderChartPages() {
// dispatch pages
$this->_chart = get_post( $chart_id );
$tab = isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'visualizer';

// skip chart type pages only for existing charts.
if ( VISUALIZER_SKIP_CHART_TYPE_PAGE && 'auto-draft' !== $this->_chart->post_status ) {
$tab = 'settings';
}

switch ( $tab ) {
case 'settings':
// changed by Ash/Upwork
$this->_handleDataAndSettingsPage();
break;
case 'type': // fall through.
Expand Down
17 changes: 9 additions & 8 deletions classes/Visualizer/Render/Page/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,16 @@ class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_up
* @access protected
*/
protected function _renderToolbar() {
// changed by Ash/Upwork
echo '<div class="toolbar-div">';
echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
esc_html_e( 'Back', 'visualizer' );
echo '</a>';
echo '</div>';
// don't show back button at all.
// NOTE: We can't be selective on the post_status here because when a new chart reaches the settings screen, its status changes to publish.
if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) {
echo '<div class="toolbar-div">';
echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
esc_html_e( 'Back', 'visualizer' );
echo '</a>';
echo '</div>';
}
echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
echo '</div>';

}

}
2 changes: 2 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
defined( 'VISUALIZER_PRO' ) || define( 'VISUALIZER_PRO', false );
}
// Added by Ash/Upwork
define( 'VISUALIZER_SKIP_CHART_TYPE_PAGE', true );

/**
* Automatically loads classes for the plugin. Checks a namespace and loads only
* approved classes.
Expand Down