Skip to content

Commit dbcfade

Browse files
Merge pull request #461 from contactashish13/test-3.3.0
Test 3.3.0
2 parents 2400225 + 60d538c commit dbcfade

File tree

8 files changed

+67
-27
lines changed

8 files changed

+67
-27
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
5858
$this->_addAction( 'admin_menu', 'registerAdminMenu' );
5959
$this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
6060
$this->_addFilter( 'plugin_action_links', 'getPluginActionLinks', 10, 2 );
61+
$this->_addFilter( 'plugin_row_meta', 'getPluginMetaLinks', 10, 2 );
6162
$this->_addFilter( 'visualizer_logger_data', 'getLoggerData' );
6263
$this->_addFilter( 'visualizer_get_chart_counts', 'getChartCountsByTypeAndMeta' );
6364
$this->_addFilter( 'visualizer_feedback_review_trigger', 'feedbackReviewTrigger' );
@@ -806,12 +807,12 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
806807
if ( $plugin_file === plugin_basename( VISUALIZER_BASEFILE ) ) {
807808
// knowledge base link
808809
$plugin_meta[] = sprintf(
809-
'<a href="https://github.com/codeinwp/visualizer/wiki" target="_blank">%s</a>',
810-
esc_html__( 'Knowledge Base', 'visualizer' )
810+
'<a href="https://docs.themeisle.com/category/657-visualizer" target="_blank">%s</a>',
811+
esc_html__( 'Docs', 'visualizer' )
811812
);
812813
// flattr link
813814
$plugin_meta[] = sprintf(
814-
'<a style="color:red" href="https://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/" target="_blank">%s</a>',
815+
'<a style="color:red" href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank">%s</a>',
815816
esc_html__( 'Pro Addon', 'visualizer' )
816817
);
817818
}

classes/Visualizer/Module/Chart.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,22 @@ private function _handleDataAndSettingsPage() {
606606
// save meta data only when it is NOT being canceled.
607607
if ( ! ( isset( $_POST['cancel'] ) && 1 === intval( $_POST['cancel'] ) ) ) {
608608
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST );
609+
610+
// we will keep a parameter called 'internal_title' that will be set to the given title or, if empty, the chart ID
611+
// this will help in searching with the chart id.
612+
$settings = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
613+
$title = null;
614+
if ( isset( $settings['title'] ) && ! empty( $settings['title'] ) ) {
615+
$title = $settings['title'];
616+
if ( is_array( $title ) ) {
617+
$title = $settings['title']['text'];
618+
}
619+
}
620+
if ( empty( $title ) ) {
621+
$title = $this->_chart->ID;
622+
}
623+
$settings['internal_title'] = $title;
624+
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $settings );
609625
}
610626
$render = new Visualizer_Render_Page_Send();
611627
$render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID );

classes/Visualizer/Render/Library.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ private function _renderLibrary() {
8181
echo $this->custom_css;
8282
echo '<div id="visualizer-types" class="visualizer-clearfix">';
8383
echo '<ul class="subsubsub">';
84+
// All tab.
85+
echo '<li class="visualizer-list-item all"><a class="' . ( ! isset( $_GET['type'] ) || empty( $_GET['type'] ) ? 'current' : '' ) . '" href="', esc_url( add_query_arg( array( 'vpage' => false, 'type' => false, 's' => false ) ) ), '">' . __( 'All', 'visualizer' ) . '</a> | </li>';
8486
foreach ( $this->types as $type => $array ) {
8587
if ( ! is_array( $array ) ) {
8688
// support for old pro
@@ -92,15 +94,16 @@ private function _renderLibrary() {
9294
array(
9395
'type' => $type,
9496
'vpage' => false,
97+
's' => false,
9598
)
9699
)
97100
) . '">';
98101
if ( ! $array['enabled'] ) {
99102
$link = "<a class=' visualizer-pro-only' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
100103
}
101-
echo '<li class="visualizer-list-item all">';
104+
echo '<li class="visualizer-list-item ' . esc_attr( $this->type ) . '">';
102105
if ( $type === $this->type ) {
103-
echo '<a class=" current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
106+
echo '<a class="current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
104107
echo $label;
105108
echo '</a>';
106109
} else {
@@ -112,9 +115,10 @@ private function _renderLibrary() {
112115
}
113116
echo '</ul>';
114117
echo '<form action="" method="get"><p id="visualizer-search" class="search-box">
115-
<input type="search" name="s" value="' . $filterBy . '">
118+
<input type="search" placeholder="' . __( 'Enter title', 'visualizer' ) . '" name="s" value="' . $filterBy . '">
116119
<input type="hidden" name="page" value="visualizer">
117-
<input type="submit" id="search-submit" class="button button-secondary" value="' . esc_attr__( 'Search', 'visualizer' ) . '">
120+
<button type="submit" id="search-submit" title="' . __( 'Search', 'visualizer' ) . '"><i class="dashicons dashicons-search"></i></button>
121+
<button type="button" class="add-new-chart" title="' . __( 'Add New', 'visualizer' ) . '"><i class="dashicons dashicons-plus-alt"></i></button>
118122
</p> </form>';
119123
echo '</div>';
120124
echo '<div id="visualizer-content-wrapper">';

classes/Visualizer/Render/Sidebar.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ protected function _renderManualConfigDescription() {
167167
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
168168
}
169169

170+
/**
171+
* Add the correct example for the manual configuration box.
172+
*/
173+
protected function _renderManualConfigExample() {
174+
return '{
175+
"vAxis": {
176+
"ticks": [5, 10, 15, 20],
177+
"titleTextStyle": {
178+
"color": "red"
179+
},
180+
"textPosition": "in"
181+
}
182+
}';
183+
}
184+
170185
/**
171186
* Renders chart advanced settings group.
172187
*
@@ -175,32 +190,21 @@ protected function _renderManualConfigDescription() {
175190
protected function _renderAdvancedSettings() {
176191
self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) );
177192
self::_renderSectionStart();
178-
self::_renderSectionDescription( esc_html__( 'Configure frontend actions here.', 'visualizer' ) );
193+
self::_renderSectionDescription( esc_html__( 'Configure frontend actions that need to be shown.', 'visualizer' ) );
179194
self::_renderSectionEnd();
180195

181196
$this->_renderActionSettings();
182197
self::_renderGroupEnd();
183198

184199
self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) );
185200
$this->_renderManualConfigDescription();
186-
$example = '
187-
{
188-
"vAxis": {
189-
"ticks": [5, 10, 15, 20],
190-
"titleTextStyle": {
191-
"color": "red"
192-
},
193-
"textPosition": "in"
194-
}
195-
}';
196-
197201
self::_renderTextAreaItem(
198202
esc_html__( 'Configuration', 'visualizer' ),
199203
'manual',
200204
$this->manual,
201205
sprintf(
202206
esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ),
203-
'<br><code>' . $example . '</code>'
207+
'<br><code>' . $this->_renderManualConfigExample() . '</code>'
204208
),
205209
'',
206210
array( 'rows' => 5 )

classes/Visualizer/Render/Sidebar/ChartJS.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,16 @@ protected function _renderManualConfigDescription() {
347347
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
348348
}
349349

350+
/**
351+
* Add the correct example for the manual configuration box.
352+
*/
353+
protected function _renderManualConfigExample() {
354+
return '{
355+
"cutoutPercentage": 5,
356+
"rotation": 60
357+
}';
358+
}
359+
350360
/**
351361
* Renders chart view settings group.
352362
*

classes/Visualizer/Render/Sidebar/Type/DataTable/DataTable.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function _toHTML() {
113113
protected function _renderAdvancedSettings() {
114114
self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) );
115115
self::_renderSectionStart();
116-
self::_renderSectionDescription( esc_html__( 'Configure frontend actions here.', 'visualizer' ) );
116+
self::_renderSectionDescription( esc_html__( 'Configure frontend actions that need to be shown.', 'visualizer' ) );
117117
self::_renderSectionEnd();
118118

119119
$this->_renderActionSettings();
@@ -249,7 +249,7 @@ protected function _renderTableSettings() {
249249

250250
self::_renderSectionStart( esc_html__( 'Header Row', 'visualizer' ) );
251251

252-
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );
252+
self::_renderSectionDescription( esc_html__( 'These values may not reflect on preview and will be applied once you save and reload the chart. ', 'visualizer' ) );
253253

254254
self::_renderColorPickerItem(
255255
esc_html__( 'Background Color', 'visualizer' ),
@@ -281,7 +281,7 @@ protected function _renderTableSettings() {
281281

282282
self::_renderSectionStart( esc_html__( 'Odd Table Row', 'visualizer' ) );
283283

284-
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );
284+
self::_renderSectionDescription( esc_html__( 'These values may not reflect on preview and will be applied once you save and reload the chart. ', 'visualizer' ) );
285285

286286
self::_renderColorPickerItem(
287287
esc_html__( 'Background Color', 'visualizer' ),
@@ -313,7 +313,7 @@ protected function _renderTableSettings() {
313313

314314
self::_renderSectionStart( esc_html__( 'Even Table Row', 'visualizer' ) );
315315

316-
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );
316+
self::_renderSectionDescription( esc_html__( 'These values may not reflect on preview and will be applied once you save and reload the chart. ', 'visualizer' ) );
317317

318318
self::_renderColorPickerItem(
319319
esc_html__( 'Background Color', 'visualizer' ),
@@ -345,7 +345,7 @@ protected function _renderTableSettings() {
345345

346346
self::_renderSectionStart( esc_html__( 'Table Cell', 'visualizer' ) );
347347

348-
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );
348+
self::_renderSectionDescription( esc_html__( 'These values may not reflect on preview and will be applied once you save and reload the chart. ', 'visualizer' ) );
349349

350350
self::_renderColorPickerItem(
351351
esc_html__( 'Background Color', 'visualizer' ),

css/library.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,9 @@ button.media-modal-close {
305305
/* chartjs */
306306
#visualizer-library canvas.chartjs-render-monitor {
307307
height: 100% !important;
308-
}
308+
}
309+
310+
div#visualizer-types ul, div#visualizer-types form p {
311+
vertical-align: middle;
312+
margin: 0;
313+
}

js/library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
}
6262
});
6363

64-
$('.add-new-h2').click(function () {
64+
$('.add-new-h2, .add-new-chart').click(function () {
6565
var wnd = window,
6666
view = new vmv.Chart({action: vu.create});
6767

0 commit comments

Comments
 (0)