category-display.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. {template 'common/header'}
  2. <div class="we7-page-title">微官网</div>
  3. <ul class="we7-page-tab">
  4. <li><a href="{php echo url('site/multi')}">微官网列表</a></li>
  5. <li><a href="{php echo url('site/style')}">微官网模板</a></li>
  6. <li><a href="{php echo url('site/article')}">文章管理</a></li>
  7. <li class="active"><a href="{php echo url('site/category')}">文章分类管理</a></li>
  8. </ul>
  9. <div class="we7-page-search we7-padding-bottom clearfix">
  10. <div class="pull-right">
  11. {if empty($id)}<a href="{php echo url('site/category/post')}" class="btn btn-primary we7-padding-horizontal">+新建文章分类</a>{/if}
  12. {if !empty($id)}<a href="{php echo url('site/category/post', array('id' => $id))}" class="btn btn-primary we7-padding-horizontal">编辑文章分类</a>{/if}
  13. </div>
  14. </div>
  15. <form action="./index.php?c=site&a=category&do=delete" class="we7-form" method="post">
  16. <table class="table we7-table table-hover article-list vertical-middle" id="js-wesite-category-display">
  17. <col width="80px">
  18. <col width="130px"/>
  19. <col width="235px">
  20. <col width="90px"/>
  21. <col width=""/>
  22. <tr>
  23. <th></th>
  24. <th class="text-left">排序</th>
  25. <th class="text-left">分类名称</th>
  26. <th>设为栏目</th>
  27. <th class="text-right">操作</th>
  28. </tr>
  29. {loop $category $row}
  30. <tr>
  31. <td>
  32. <input type="checkbox" we7-check-all="1" name="rid[]" id="rid-{$row['id']}" value="{$row['id']}">
  33. <label for="rid-{$row['id']}">&nbsp;</label>
  34. </td>
  35. <td class="text-left">{$row['displayorder']}</td>
  36. <td class="text-left">
  37. <span>{$row['name']}</span>
  38. </td>
  39. <td>
  40. <label>
  41. <div class="switch switch{php echo $row['enabled'] ? 'On' : 'Off'}" onclick="changeStatus({$row['id']})"></div>
  42. </label>
  43. </td>
  44. <td style="position: relative;">
  45. <div class="link-group">
  46. {if empty($row['parentid'])}
  47. <a href="{php echo url('site/category/post', array('parentid' => $row['id']))}" >&nbsp;+添加子分类</a>
  48. {/if}
  49. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="js-clip">复制链接</a>
  50. <a href="{php echo url('site/article/post', array('pcate' => $row['id']));}" >添加文章</a>
  51. <a href="{php echo url('site/category/post', array('id' => $row['id']));}" >编辑</a>
  52. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" class="del" onclick="return confirm('确认删除此分类吗?');return false;">删除</a>
  53. </div>
  54. </td>
  55. </tr>
  56. {loop $children[$row['id']] $row}
  57. <tr class="bg-light-gray">
  58. <td>
  59. <input type="checkbox" name="rid[]" id="rid-{$row['id']}" value="{$row['id']}">
  60. <label for="rid-{$row['id']}">&nbsp;</label>
  61. </td>
  62. <td class="text-left">
  63. <div class="pad-left">
  64. {$row['displayorder']}
  65. </div>
  66. </td>
  67. <td class="text-left"><span class="color-gray" style="margin-left: 50px;">{$row['name']}</span></td>
  68. <td>
  69. <label>
  70. <div class="switch switch{php echo $row['enabled'] ? 'On' : 'Off'}" onclick="changeStatus({$row['id']})"></div>
  71. </label>
  72. </td>
  73. <td style="position: relative;" class="text-right">
  74. <div class="link-group">
  75. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="we7-margin-right-sm js-clip">复制链接</a>
  76. <a href="{php echo url('site/article/post', array('pcate' => $row['parentid'], 'ccate' => $row['id']));}" class="we7-margin-right-sm">添加文章</a>
  77. <a href="{php echo url('site/category/post', array('id' => $row['id'], 'parentid' => $row['parentid']));}" class="we7-margin-right-sm">编辑</a>
  78. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" class="del" onclick="return confirm('确认删除此分类吗?');return false;">删除</a>
  79. </div>
  80. </td>
  81. </tr>
  82. {/loop}
  83. {/loop}
  84. </table>
  85. <div class="clearfix"></div>
  86. <div class="we7-margin-left">
  87. <input type="checkbox" we7-check-all="1" name="rid[]" id="select_all" value="1">
  88. <label for="select_all">&nbsp;</label>
  89. <input type="submit" class="btn btn-danger" name="submit" value="删除" onclick="if(!confirm('确定删除选中的规则吗?')) return false;"/>
  90. <input type="hidden" name="token" value="{$_W['token']}" />
  91. </div>
  92. </form>
  93. <script>
  94. $('#select_all').click(function(){
  95. $('.article-list :checkbox').prop('checked', $(this).prop('checked'));
  96. });
  97. $('.js-clip').each(function(){
  98. util.clip(this, $(this).attr('data-url'));
  99. });
  100. var changeStatus = function(id) {
  101. var id = parseInt(id);
  102. $.post('./index.php?c=site&a=category&do=change_status', {id: id},function(data) {
  103. if (data.message.errno == 0){
  104. util.message(data.message.message, data.redirect, 'success');
  105. } else {
  106. if (data.message.errno == 1) util.toast('更改失败!', 'error');
  107. if (data.message.errno == -1) util.toast('分类不存在,请刷新重试!');
  108. }
  109. }, 'json');
  110. }
  111. </script>
  112. {template 'common/footer'}