static-subpages.html.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php if (!defined('HTMLY')) die('HTMLy'); ?>
  2. <ul class="nav nav-tabs">
  3. <li class="nav-item">
  4. <a class="nav-link" aria-current="page" href="<?php echo $static->url;?>"><?php echo i18n('View');?></a>
  5. </li>
  6. <li class="nav-item">
  7. <a class="nav-link" href="<?php echo $static->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a>
  8. </li>
  9. </ul>
  10. <br>
  11. <div>
  12. <h2 class="post-index"><?php echo $static->title ?></h2>
  13. <div><?php echo $static->description;?></div>
  14. </div>
  15. <br>
  16. <a class="btn btn-primary right" href="<?php echo $static->url;?>/add?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Add_sub');?></a>
  17. <br><br>
  18. <script>
  19. $(function() {
  20. var order;
  21. $( "tbody" ).sortable({update: function(e, ui) {
  22. order = $(this).sortable('toArray');
  23. $("#saveButton").css({"display": "block"});
  24. }});
  25. $("#saveButton").click(function(){
  26. $.ajax({
  27. type: 'POST',
  28. url: '<?php echo site_url();?>admin/pages/<?php echo $static->slug;?>',
  29. dataType: 'json',
  30. data: {'json': order},
  31. success: function (response) {
  32. alert(response.message);
  33. location.reload();
  34. },
  35. });
  36. });
  37. });
  38. </script>
  39. <?php $posts = find_subpage($p->slug);?>
  40. <?php if (!empty($posts)) { ?>
  41. <table class="table post-list">
  42. <thead>
  43. <tr class="head">
  44. <th><?php echo i18n('Title');?></th>
  45. <th><?php echo i18n('Description');?></th>
  46. <?php if (config("views.counter") == "true"): ?>
  47. <th><?php echo i18n('Views');?></th>
  48. <?php endif; ?>
  49. <th><?php echo i18n('Operations');?></th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. <?php foreach ($posts as $sp): ?>
  54. <tr id="<?php echo $sp->parent;?>/<?php echo $sp->md;?>" style="cursor:move;">
  55. <td><a href="<?php echo $sp->url ?>"><?php echo $sp->title ?></a></td>
  56. <td><?php echo $sp->description;?></td>
  57. <?php if (config("views.counter") == "true"):?><td><?php echo $sp->views;?></td><?php endif;?>
  58. <td><span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Delete');?></a></span></td>
  59. </tr>
  60. <?php endforeach; ?>
  61. </tbody>
  62. </table>
  63. <br>
  64. <button class="btn btn-primary" style="display:none" id="saveButton"><?php echo i18n('save_config');?></button>
  65. <?php } else {
  66. echo i18n('No_posts_found') . '!';
  67. } ?>