Merge pull request #1420 from emanueleg/preview
enable content Preview - fixes #1383
This commit is contained in:
commit
4f20b3dbe2
2 changed files with 15 additions and 2 deletions
|
@ -77,6 +77,10 @@
|
|||
_pageKey = response.data.key;
|
||||
// Set friendly URL with the key
|
||||
//$('#friendlyURL').val(response.data.key);
|
||||
$('#btnPreview').attr('data-key', response.data.key);
|
||||
if (response.data.preview) {
|
||||
$('#btnPreview').attr('data-preview', response.data.preview);
|
||||
}
|
||||
} else {
|
||||
logs('An error occurred while trying to save the current page.');
|
||||
showAlertError(response.message);
|
||||
|
@ -228,6 +232,12 @@
|
|||
openModal('type');
|
||||
});
|
||||
|
||||
$('#btnPreview').click(function() {
|
||||
if ($(this).attr('data-key') && $(this).attr('data-preview')) {
|
||||
window.open('<?php echo DOMAIN_PAGES; ?>'+$(this).attr('data-key')+'?preview='+$(this).attr('data-preview'));
|
||||
}
|
||||
});
|
||||
|
||||
$('#category').on("change", function() {
|
||||
enableBtnSave();
|
||||
});
|
||||
|
|
|
@ -548,11 +548,14 @@ class pluginAPI extends Plugin {
|
|||
'message'=>'Error trying to edit the page.'
|
||||
);
|
||||
}
|
||||
|
||||
$page = new Page($newKey);
|
||||
$preview = md5($page->uuid());
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Page edited.',
|
||||
'data'=>array('key'=>$newKey)
|
||||
'data'=>array('key'=>$newKey, 'preview'=>$preview)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1095,4 +1098,4 @@ class pluginAPI extends Plugin {
|
|||
'message'=>'An error occurred while trying to configure the plugin.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue