You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
3.5 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  1. <div class="page-header">
  2. <h1 class="page-title">'<?=$board['brd_title']?>' 게시판 카테고리 설정</h1>
  3. </div>
  4. <div class="row">
  5. <div class="col-sm-3">
  6. <ul class="nav nav-cards">
  7. <li role="presentation"><a class="card" href="<?=base_url('admin/board/form/'.$board['brd_key'])?>">게시판 정보 수정</a></li>
  8. <li role="presentation" class="active"><a href="#" class="card selected">카테고리 설정</a></li>
  9. </ul>
  10. </div>
  11. <div class="col-sm-9">
  12. <ul class="category-list">
  13. <li>
  14. <div>
  15. <?=$board['brd_title']?>
  16. <button type="button" class="btn btn-xs btn-default" onclick="APP.BOARD.CATEGORY.form('<?=$board['brd_key']?>',0)"><i class="far fa-plus-circle"></i></button>
  17. </div>
  18. <ul id="category-list">
  19. <?php foreach($board['category'] as $cate) : ?>
  20. <li data-idx="<?=$cate['bca_idx']?>">
  21. <div>
  22. <i class="far fa-folder-open"></i> <span class="move-item"><?=$cate['bca_name']?></span>
  23. <button type="button" class="btn btn-xs btn-default" onclick="APP.BOARD.CATEGORY.form('<?=$board['brd_key']?>', <?=$cate['bca_idx']?>)"><i class="far fa-plus-circle"></i></button>
  24. <button type="button" class="btn btn-xs btn-default" onclick="APP.BOARD.CATEGORY.form('<?=$board['brd_key']?>', 0,<?=$cate['bca_idx']?>)"><i class="far fa-pencil"></i></button>
  25. <button type="button" class="btn btn-xs btn-danger" onclick="APP.BOARD.CATEGORY.remove('<?=$cate['bca_idx']?>')"><i class="far fa-trash"></i></button>
  26. </div>
  27. <ul class="items">
  28. <?php foreach($cate['items'] as $ct):?>
  29. <li data-idx="<?=$ct['bca_idx']?>">
  30. <div>
  31. <span class="move-item"><?=$ct['bca_name']?></span>
  32. <button type="button" class="btn btn-xs btn-default" onclick="APP.BOARD.CATEGORY.form('<?=$board['brd_key']?>', <?=$cate['bca_idx']?>, <?=$ct['bca_idx']?>)"><i class="far fa-pencil"></i></button>
  33. <button type="button" class="btn btn-xs btn-danger" onclick="APP.BOARD.CATEGORY.remove('<?=$ct['bca_idx']?>')"><i class="far fa-trash"></i></button>
  34. </div>
  35. </li>
  36. <?php endforeach;?>
  37. </ul>
  38. </li>
  39. <?php endforeach;?>
  40. </ul>
  41. </li>
  42. </ul>
  43. </div>
  44. </div>
  45. <script>
  46. $(function(){
  47. $("#category-list").sortable({
  48. update: function(){
  49. var obj = [];
  50. $("#category-list > li").each(function(){
  51. obj.push( $(this).data('idx') );
  52. });
  53. $.post(base_url+'/ajax/board/category_sort',{brd_key:'<?=$board['brd_key']?>', idxs:obj});
  54. }
  55. });
  56. $("#category-list >li > .items").sortable({
  57. update : function(event, ui) {
  58. var obj = [];
  59. $("#category-list >li > .items > li").each(function(){
  60. obj.push( $(this).data('idx') );
  61. });
  62. $.post(base_url+'/ajax/board/category_sort',{brd_key:'<?=$board['brd_key']?>', idxs:obj});
  63. }
  64. });
  65. });
  66. </script>