Skip to content

Commit b31f08f

Browse files
close button in types screen
1 parent a61a1dc commit b31f08f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

classes/Visualizer/Render/Page/Types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ protected function _renderToolbar() {
129129
}
130130
?>
131131
<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 &amp; Close', 'visualizer' ); ?>">
132133
<?php
133134
}
134135
}

js/frame.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121

122122
init_type_vs_library();
123123

124+
$('.viz-abort').on('click', function(e){
125+
e.preventDefault();
126+
window.parent.postMessage('visualizer:mediaframe:close', '*');
127+
});
128+
124129
}
125130

126131
function init_type_vs_library() {

js/library.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
var wnd = window,
6666
view = new vmv.Chart({action: vu.create});
6767

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+
6876
// remove the 'type' while refreshing the library page on creation of a new chart.
6977
// this is to avoid cases where users have filtered for chart type A and end up creating chart type B
7078
wnd.send_to_editor = function () {
@@ -108,6 +116,12 @@
108116
});
109117
return false;
110118
});
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+
111125
$(window).resize(function () {
112126
clearTimeout(resizeTimeout);
113127
resizeTimeout = setTimeout(function () {

0 commit comments

Comments
 (0)