Skip to content

Commit fc02631

Browse files
Merge remote-tracking branch 'refs/remotes/Codeinwp/master' into issue-240
2 parents 05bdb1e + 0684c08 commit fc02631

File tree

12 files changed

+91
-12
lines changed

12 files changed

+91
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
### v3.0.7 - 2018-03-26
3+
**Changes:**
4+
* Adds insert button in chart library.
5+
* Remove frontend assets where they are not needed.
6+
* Improve non-English charts compatibility.
7+
* Adds a filter to change charts locale.
8+
29
### v3.0.6 - 2018-02-27
310
**Changes:**
411
* Fix UTF-8 support while saving the data.

classes/Visualizer/Module/Admin.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ public function enqueueMediaScripts() {
157157
wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION, true );
158158
wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION, true );
159159
wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION, true );
160+
wp_localize_script(
161+
'visualizer-media-view', 'visualizer', array(
162+
'i10n' => array(
163+
'insert' => __( 'Insert', 'visualizer' ),
164+
),
165+
)
166+
);
160167
wp_enqueue_script( 'visualizer-media-toolbar', VISUALIZER_ABSURL . 'js/media/toolbar.js', array( 'visualizer-media-view' ), Visualizer_Plugin::VERSION, true );
161168
wp_enqueue_script( 'visualizer-media', VISUALIZER_ABSURL . 'js/media.js', array( 'visualizer-media-toolbar' ), Visualizer_Plugin::VERSION, true );
162169
}

classes/Visualizer/Module/Frontend.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
5454
parent::__construct( $plugin );
5555

5656
$this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' );
57+
$this->_addFilter( 'visualizer_get_language', 'getLanguage' );
5758
$this->_addShortcode( 'visualizer', 'renderChart' );
5859

5960
// add do_shortocde hook for widget_text filter
@@ -69,6 +70,14 @@ public function __construct( Visualizer_Plugin $plugin ) {
6970
add_action( 'rest_api_init', array( $this, 'endpoint_register' ) );
7071
}
7172

73+
/**
74+
* Returns the language/locale.
75+
*/
76+
function getLanguage( $dummy, $only_language ) {
77+
return $this->get_language();
78+
}
79+
80+
7281
/**
7382
* Registers the endpoints
7483
*/
@@ -150,7 +159,6 @@ public function enqueueScripts() {
150159
wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true );
151160
wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'visualizer-google-jsapi-old', 'jquery' ), Visualizer_Plugin::VERSION, true );
152161
wp_register_script( 'visualizer-clipboardjs', VISUALIZER_ABSURL . 'js/lib/clipboardjs/clipboard.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true );
153-
wp_enqueue_script( 'visualizer-clipboardjs' );
154162
wp_register_style( 'visualizer-front', VISUALIZER_ABSURL . 'css/front.css', array(), Visualizer_Plugin::VERSION );
155163
do_action( 'visualizer_pro_frontend_load_resources' );
156164
}
@@ -268,6 +276,7 @@ public function renderChart( $atts ) {
268276
if ( 'copy' === $key ) {
269277
$copy = $this->_getDataAs( $atts['id'], 'csv' );
270278
$actions_div .= ' data-clipboard-text="' . esc_attr( $copy['csv'] ) . '"';
279+
wp_enqueue_script( 'visualizer-clipboardjs' );
271280
}
272281

273282
$actions_div .= apply_filters( 'visualizer_action_attributes', '', $key, $atts['id'] );

classes/Visualizer/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class Visualizer_Plugin {
2929

3030
const NAME = 'visualizer';
31-
const VERSION = '3.0.6';
31+
const VERSION = '3.0.7';
3232

3333
// custom post types
3434
const CPT_VISUALIZER = 'visualizer';

classes/Visualizer/Render/Templates.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ private function _renderTemplate( $id, $callback ) {
6464
* @access protected
6565
*/
6666
protected function _renderLibraryChart() {
67-
echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
68-
echo '<a class="visualizer-library-chart-action visualizer-library-chart-delete" href="javascript:;" title="', esc_attr__( 'Delete', 'visualizer' ), '"></a>';
69-
echo '<a class="visualizer-library-chart-action visualizer-library-chart-insert" href="javascript:;" title="', esc_attr__( 'Insert', 'visualizer' ), '"></a>';
70-
67+
echo '<div class="visualizer-library-chart-footer visualizer-clearfix visualizer-library-media-popup">';
7168
echo '<span class="visualizer-library-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">&nbsp;[visualizer id=&quot;{{data.id}}&quot;]&nbsp;</span>';
7269
echo '</div>';
7370
}

css/media.css

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Version: 3.0.6
2+
Version: 3.0.7
33
*/
44
#visualizer-library-view {
55
padding: 30px 10px 10px 30px;
@@ -171,4 +171,35 @@ i.mce-i-visualizer-icon:before {
171171
-webkit-font-smoothing: antialiased;
172172
font: 400 20px/1 dashicons;
173173
vertical-align: top;
174+
}
175+
176+
.visualizer-chart-bg, .visualizer-chart-insert-bg {
177+
display: none;
178+
}
179+
180+
.visualizer-library-chart:hover .visualizer-chart-bg {
181+
display: block;
182+
position: absolute;
183+
background: #000000;
184+
width: 100%;
185+
height: 100%;
186+
top: 0;
187+
left: 0;
188+
opacity: 0.3;
189+
}
190+
191+
.visualizer-library-chart:hover .visualizer-chart-bg ~ .visualizer-chart-insert-bg {
192+
display: block;
193+
position: absolute;
194+
top: 0;
195+
left: 0;
196+
width: 100%;
197+
height: 100%;
198+
z-index: 99999;
199+
}
200+
201+
button.visualizer-library-chart-insert{
202+
position: absolute;
203+
top: 45%;
204+
left: 45%;
174205
}

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Visualizer: Charts and Graphs Lite
55
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
66
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
7-
Version: 3.0.6
7+
Version: 3.0.7
88
Author: Themeisle
99
Author URI: http://themeisle.com
1010
License: GPL v2.0 or later

js/media/view.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* global google */
33
/* global visualizer */
44
/* global showNotice */
5-
(function($, wpm) {
5+
(function($, wpm, visualizer) {
66
var libraryWidth, libraryHeight, wpmv, wpmV, wpmvv, wpmvvl, wpmvvb, l10n;
77

88
wpmv = wpm.view;
@@ -269,6 +269,18 @@
269269
}
270270

271271
self.renderCollection();
272+
$('.visualizer-library-chart').css('position', 'relative')
273+
.append($(
274+
// jshint ignore:start
275+
'<div class="visualizer-chart-bg"></div>'
276+
+ '<div class="visualizer-chart-insert-bg">'
277+
+ '<button class="button button-primary visualizer-library-chart-insert">' + visualizer.i10n.insert + '</button>'
278+
+ '</div>'
279+
// jshint ignore:end
280+
))
281+
.on('mouseover', function(){
282+
$(this).addClass('hover');
283+
});
272284
content.unlock();
273285
}
274286
}
@@ -464,7 +476,7 @@
464476
this.controller.trigger('visualizer:library:page', $(e.target).data('page'));
465477
}
466478
});
467-
})(jQuery, wp.media);
479+
})(jQuery, wp.media, visualizer);
468480

469481
(function($) {
470482
$.fn.lock = function() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visualizer",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"description": "Visualizer Lite",
55
"repository": {
66
"type": "git",

readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
144144
5. Charts library
145145

146146
## Changelog ##
147+
### 3.0.7 - 2018-03-26 ###
148+
149+
* Adds insert button in chart library.
150+
* Remove frontend assets where they are not needed.
151+
* Improve non-English charts compatibility.
152+
* Adds a filter to change charts locale.
153+
154+
147155
### 3.0.6 - 2018-02-27 ###
148156

149157
* Fix UTF-8 support while saving the data.

0 commit comments

Comments
 (0)