File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
classes/Visualizer/Render/Page Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ protected function _renderToolbar() {
129
129
}
130
130
?>
131
131
<input type="submit" class="button button-primary button-large push-right" value="<?php esc_attr_e ( 'Next ' , 'visualizer ' ); ?> ">
132
+ <input type="button" class="button button-secondary button-large push-left viz-abort" value="<?php esc_attr_e ( 'Abort & Close ' , 'visualizer ' ); ?> ">
132
133
<?php
133
134
}
134
135
}
Original file line number Diff line number Diff line change 121
121
122
122
init_type_vs_library ( ) ;
123
123
124
+ $ ( '.viz-abort' ) . on ( 'click' , function ( e ) {
125
+ e . preventDefault ( ) ;
126
+ window . parent . postMessage ( 'visualizer:mediaframe:close' , '*' ) ;
127
+ } ) ;
128
+
124
129
}
125
130
126
131
function init_type_vs_library ( ) {
Original file line number Diff line number Diff line change 65
65
var wnd = window ,
66
66
view = new vmv . Chart ( { action : vu . create } ) ;
67
67
68
+ window . parent . addEventListener ( 'message' , function ( event ) {
69
+ switch ( event . data ) {
70
+ case 'visualizer:mediaframe:close' :
71
+ view . close ( ) ;
72
+ break ;
73
+ }
74
+ } , false ) ;
75
+
68
76
// remove the 'type' while refreshing the library page on creation of a new chart.
69
77
// this is to avoid cases where users have filtered for chart type A and end up creating chart type B
70
78
wnd . send_to_editor = function ( ) {
108
116
} ) ;
109
117
return false ;
110
118
} ) ;
119
+
120
+ // if addnew is found as a GET request parameter, show the modal.
121
+ if ( location . href . indexOf ( 'addnew' ) !== - 1 ) {
122
+ $ ( '.add-new-chart' ) . trigger ( 'click' ) ;
123
+ }
124
+
111
125
$ ( window ) . resize ( function ( ) {
112
126
clearTimeout ( resizeTimeout ) ;
113
127
resizeTimeout = setTimeout ( function ( ) {
You can’t perform that action at this time.
0 commit comments