mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-04 12:17:42 +02:00
Snippets Plugin: view embed code feature added.
This commit is contained in:
18
plugins/box/snippets/js/snippets.js
Normal file
18
plugins/box/snippets/js/snippets.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
if (typeof $.monstra == 'undefined') $.monstra = {};
|
||||||
|
|
||||||
|
$.monstra.snippets = {
|
||||||
|
|
||||||
|
init: function() { },
|
||||||
|
|
||||||
|
showEmbedCodes: function(name) {
|
||||||
|
$('#shortcode').html('{snippet get="'+name+'"}');
|
||||||
|
$('#phpcode').html('<?php echo Snippet::get("'+name+'"); ?>');
|
||||||
|
$('#embedCodes').modal();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$.monstra.snippets.init();
|
||||||
|
});
|
@@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Add plugin navigation link
|
||||||
Navigation::add(__('Snippets', 'snippets'), 'extends', 'snippets', 3);
|
Navigation::add(__('Snippets', 'snippets'), 'extends', 'snippets', 3);
|
||||||
|
|
||||||
|
// Add Plugin Javascript
|
||||||
|
Javascript::add('plugins/box/snippets/js/snippets.js', 'backend');
|
||||||
|
|
||||||
|
|
||||||
class SnippetsAdmin extends Backend {
|
class SnippetsAdmin extends Backend {
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<h2><?php echo __('Snippets', 'snippets'); ?></h2>
|
<h2><?php echo __('Snippets', 'snippets'); ?></h2>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<?php if(Notification::get('success')) Alert::success(Notification::get('success')); ?>
|
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo (
|
echo (
|
||||||
@@ -21,14 +21,38 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php echo basename($snippet, '.snippet.php'); ?></td>
|
<td><?php echo basename($snippet, '.snippet.php'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
|
<div class="btn-toolbar">
|
||||||
|
<div class="btn-group">
|
||||||
<?php echo Html::anchor(__('Edit', 'snippets'), 'index.php?id=snippets&action=edit_snippet&filename='.basename($snippet, '.snippet.php'), array('class' => 'btn btn-actions')); ?>
|
<?php echo Html::anchor(__('Edit', 'snippets'), 'index.php?id=snippets&action=edit_snippet&filename='.basename($snippet, '.snippet.php'), array('class' => 'btn btn-actions')); ?>
|
||||||
|
<a class="btn dropdown-toggle btn-actions" data-toggle="dropdown" href="#" style="font-family:arial;"><span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><?php echo Html::anchor(__('View Embed Code', 'snippets'), 'javascript:;', array('title' => __('View Embed Code', 'snippets'), 'onclick' => '$.monstra.snippets.showEmbedCodes("'.basename($snippet, '.snippet.php').'");')); ?></li>
|
||||||
|
</ul>
|
||||||
<?php echo Html::anchor(__('Delete', 'snippets'),
|
<?php echo Html::anchor(__('Delete', 'snippets'),
|
||||||
'index.php?id=snippets&action=delete_snippet&filename='.basename($snippet, '.snippet.php').'&token='.Security::token(),
|
'index.php?id=snippets&action=delete_snippet&filename='.basename($snippet, '.snippet.php').'&token='.Security::token(),
|
||||||
array('class' => 'btn btn-actions', 'onclick' => "return confirmDelete('".__('Delete snippet: :snippet', 'snippets', array(':snippet' => basename($snippet, '.snippet.php')))."')"));
|
array('class' => 'btn btn-actions', 'onclick' => "return confirmDelete('".__('Delete snippet: :snippet', 'snippets', array(':snippet' => basename($snippet, '.snippet.php')))."')"));
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<!-- /Snippets_list -->
|
<!-- /Snippets_list -->
|
||||||
|
|
||||||
|
<div id="embedCodes" class="modal hide fade">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3><?php echo __('Embed Code', 'snippets'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>
|
||||||
|
<b><?php echo __('Shortcode', 'snippets'); ?></b><br>
|
||||||
|
<code id="shortcode"></code>
|
||||||
|
<br> <br>
|
||||||
|
<b><?php echo __('PHP Code', 'snippets'); ?></b><br>
|
||||||
|
<code id="phpcode"></code>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
Reference in New Issue
Block a user