Skip to content

Commit ce3119f

Browse files
Fix file conflict #930
2 parents 6e422fd + 1aa78e3 commit ce3119f

File tree

14 files changed

+71
-26
lines changed

14 files changed

+71
-26
lines changed

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Components/Sidebar/HorizontalAxisSettings.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const {
1818
TextControl
1919
} = wp.components;
2020

21+
import { getColorCode } from '../../utils.js';
22+
2123
class HorizontalAxisSettings extends Component {
2224
constructor() {
2325
super( ...arguments );
@@ -85,9 +87,9 @@ class HorizontalAxisSettings extends Component {
8587
label={ __( 'Base Line Color' ) }
8688
>
8789
<ColorPalette
88-
value={ settings.hAxis.baselineColor }
90+
value={ settings.vAxis.baselineColor }
8991
onChange={ e => {
90-
settings.hAxis.baselineColor = e;
92+
settings.vAxis.baselineColor = getColorCode( e );
9193
this.props.edit( settings );
9294
} }
9395
/>
@@ -100,7 +102,7 @@ class HorizontalAxisSettings extends Component {
100102
value={ settings.hAxis.textStyle.color || settings.hAxis.textStyle }
101103
onChange={ e => {
102104
settings.hAxis.textStyle = {};
103-
settings.hAxis.textStyle.color = e;
105+
settings.hAxis.textStyle.color = getColorCode( e );
104106
this.props.edit( settings );
105107
} }
106108
/>

classes/Visualizer/Gutenberg/src/Components/Sidebar/VerticalAxisSettings.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const {
1818
TextControl
1919
} = wp.components;
2020

21+
import { getColorCode } from '../../utils.js';
22+
2123
class VerticalAxisSettings extends Component {
2224
constructor() {
2325
super( ...arguments );
@@ -85,9 +87,9 @@ class VerticalAxisSettings extends Component {
8587
label={ __( 'Base Line Color' ) }
8688
>
8789
<ColorPalette
88-
value={ settings.vAxis.baselineColor }
90+
value={ settings.hAxis.baselineColor }
8991
onChange={ e => {
90-
settings.vAxis.baselineColor = e;
92+
settings.hAxis.baselineColor = getColorCode( e );
9193
this.props.edit( settings );
9294
} }
9395
/>
@@ -100,7 +102,7 @@ class VerticalAxisSettings extends Component {
100102
value={ settings.vAxis.textStyle.color || settings.vAxis.textStyle }
101103
onChange={ e => {
102104
settings.vAxis.textStyle = {};
103-
settings.vAxis.textStyle.color = e;
105+
settings.vAxis.textStyle.color = getColorCode( e );
104106
this.props.edit( settings );
105107
} }
106108
/>

classes/Visualizer/Gutenberg/src/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,14 @@ export const getFormatterForGoogle = ( dataType ) => {
178178
}
179179
return null;
180180
};
181+
182+
export const getColorCode = ( color ) => {
183+
if ( -1 === color.indexOf( '#' ) ) {
184+
let getCssVar = color.match( /\((.*)\)/ ).pop();
185+
if ( getCssVar ) {
186+
let style = getComputedStyle( document.body );
187+
return style.getPropertyValue( getCssVar );
188+
}
189+
}
190+
return color;
191+
};

classes/Visualizer/Module.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
6767
$this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 );
6868
$this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 );
6969
$this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS, 'getDataAs', 10, 3 );
70+
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
7071
register_shutdown_function( array($this, 'onShutdown') );
7172

7273
}
@@ -791,4 +792,21 @@ public function _getImage( $chart = null ) {
791792
'csv' => $image,
792793
);
793794
}
795+
796+
/**
797+
* Filter chart title.
798+
*
799+
* @access public
800+
* @param string $post_title Post title.
801+
* @param int $post_id Post ID.
802+
* @return string
803+
*/
804+
public function filterChartTitle( $post_title, $post_id ) {
805+
$post_type = get_post_type( $post_id );
806+
$post_title = trim( $post_title );
807+
if ( 'visualizer' === $post_type && 'Visualization' === $post_title ) {
808+
return sprintf( '%s #%d', $post_title, $post_id );
809+
}
810+
return $post_title;
811+
}
794812
}

classes/Visualizer/Module/Chart.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,15 +1245,16 @@ public function cloneChart() {
12451245
'vaction' => false,
12461246
),
12471247
admin_url( 'admin.php' )
1248-
)
1248+
),
1249+
null,
1250+
'db'
12491251
);
12501252
}
12511253
}
12521254

12531255
if ( defined( 'WP_TESTS_DOMAIN' ) ) {
12541256
wp_die();
12551257
}
1256-
12571258
wp_redirect( $redirect );
12581259
exit;
12591260
}

classes/Visualizer/Module/Frontend.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ public function renderChart( $atts ) {
341341
$attributes['data-lazy-limit'] = $atts['lazy'];
342342
}
343343

344+
$attributes = apply_filters( 'visualizer_container_attributes', $attributes, $chart->ID );
345+
344346
$chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false );
345347

346348
// Get and update settings.

classes/Visualizer/Plugin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class Visualizer_Plugin {
9090
const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions';
9191
const FILTER_GET_CHART_DATA_AS = 'visualizer-get-chart-data-as';
9292
const FILTER_HANDLE_CACHE_EXPIRATION_TIME = 'visualizer-handle-expiration-time';
93+
const FILTER_CHART_TITLE = 'the_title';
9394

9495
const CF_DB_SCHEDULE = 'visualizer-db-schedule';
9596
const CF_DB_QUERY = 'visualizer-db-query';

classes/Visualizer/Render/Sidebar/Graph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ protected function _renderHorizontalAxisSettings() {
242242
esc_html__( 'Specify 0 to disable the minor gridlines.', 'visualizer' ),
243243
0,
244244
'number',
245-
array( 'min' => 0, 'max' => 1, 'step' => 1 )
245+
array( 'min' => 0, 'step' => 1 )
246246
);
247247

248248
self::_renderColorPickerItem(
@@ -358,7 +358,7 @@ protected function _renderVerticalAxisSettings() {
358358
esc_html__( 'Specify 0 to disable the minor gridlines.', 'visualizer' ),
359359
0,
360360
'number',
361-
array( 'min' => 0, 'max' => 1, 'step' => 1 )
361+
array( 'min' => 0, 'step' => 1 )
362362
);
363363

364364
self::_renderColorPickerItem(

images/pro/excel.png

10.1 KB
Loading

0 commit comments

Comments
 (0)