Skip to content

Commit 1f28bec

Browse files
authored
Merge pull request #233 from contactashish13/issue-226
remove chart types page while editing
2 parents dc138da + 147032f commit 1f28bec

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,14 @@ public function renderChartPages() {
262262
// dispatch pages
263263
$this->_chart = get_post( $chart_id );
264264
$tab = isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'visualizer';
265+
266+
// skip chart type pages only for existing charts.
267+
if ( VISUALIZER_SKIP_CHART_TYPE_PAGE && 'auto-draft' !== $this->_chart->post_status ) {
268+
$tab = 'settings';
269+
}
270+
265271
switch ( $tab ) {
266272
case 'settings':
267-
// changed by Ash/Upwork
268273
$this->_handleDataAndSettingsPage();
269274
break;
270275
case 'type': // fall through.

classes/Visualizer/Render/Page/Data.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,16 @@ class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_up
401401
* @access protected
402402
*/
403403
protected function _renderToolbar() {
404-
// changed by Ash/Upwork
405-
echo '<div class="toolbar-div">';
406-
echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
407-
esc_html_e( 'Back', 'visualizer' );
408-
echo '</a>';
409-
echo '</div>';
404+
// don't show back button at all.
405+
// 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.
406+
if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) {
407+
echo '<div class="toolbar-div">';
408+
echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
409+
esc_html_e( 'Back', 'visualizer' );
410+
echo '</a>';
411+
echo '</div>';
412+
}
410413
echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
411-
echo '</div>';
412-
413414
}
414415

415416
}

index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
defined( 'VISUALIZER_PRO' ) || define( 'VISUALIZER_PRO', false );
3131
}
3232
// Added by Ash/Upwork
33+
define( 'VISUALIZER_SKIP_CHART_TYPE_PAGE', true );
34+
3335
/**
3436
* Automatically loads classes for the plugin. Checks a namespace and loads only
3537
* approved classes.

0 commit comments

Comments
 (0)