app/Plugin/TabaCMS2/Resource/template/admin/category_list.twig line 1

Open in your IDE?
  1. {#
  2. Copyright (C) SPREAD WORKS Inc. All Rights Reserved.
  3. For the full copyright and license information, please view the LICENSE
  4. file that was distributed with this source code.
  5. #}
  6. {% extends '@admin/default_frame.twig' %}
  7. {% use "bootstrap_4_layout.html.twig" %}
  8. {% set const = TabaCMS2Constants %}
  9. {% set menus = [constant('PLUGIN_CATEGORY_ID',const),constant('PLUGIN_CODE_LC',const),constant('PLUGIN_CODE_LC',const)~'_category_'~type.typeId] %}
  10. {% set bind_prefix = constant('ADMIN_BIND_PREFIX',const) %}
  11. {% set tag_id_prefix = constant('PLUGIN_CODE_LC',const)~'_type_list' %}
  12. {% set trans_prefix = constant('PLUGIN_CODE_LC',const)~'.admin' %}
  13. {% set include_prefix = constant('PLUGIN_CODE',const)~'/Resource/template/admin/' %}
  14. {% set body_class = constant('PLUGIN_CODE_LC',const)~'_page' %}
  15. {% block title %}{{ constant('PAGE_TITLE',const)|raw }}{% endblock %}
  16. {% block sub_title %}{{ type.typeName }} - {{ (trans_prefix~'.title.category_list')|trans }}{% endblock %}
  17. {% block javascript %}
  18. <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.core.min.js', 'admin') }}"></script>
  19. <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.widget.min.js', 'admin') }}"></script>
  20. <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.mouse.min.js', 'admin') }}"></script>
  21. <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.sortable.min.js', 'admin') }}"></script>
  22. <script>
  23. $(function() {
  24.     $(".sortable").sortable({
  25.         items: 'tr',
  26.         handle: '.icon_sortable',
  27.         cursor: 'move',
  28.         opacity: 0.7,
  29.         update: function(e, ui) {
  30.             $('body').append($('<div class="modal-backdrop show"></div>'));
  31.             $.ajax({
  32.                 url: '{{ path(bind_prefix~'_category_sort',{type_id:type.typeId}) }}',
  33.                 type: 'POST',
  34.                 data: '{{ constant('Eccube\\Common\\Constant::TOKEN_NAME') }}={{ csrf_token }}&' + $(this).sortable('serialize'),
  35.                 cache: false,
  36.             }).fail((data, textStatus, jqXHR) => {
  37.             }).done((data, textStatus, jqXHR) => {
  38.             }).always((data, textStatus, jqXHR) => {
  39.                 $(".modal-backdrop").remove();
  40.             });
  41.         }
  42.     });
  43. });
  44. </script>
  45. {% endblock %}
  46. {% block main %}
  47.     <div class="c-contentsArea__cols">
  48.         <div class="c-contentsArea__primaryCol">
  49.             <div class="c-primaryCol">
  50.                 <div class="card rounded border-0 mb-4">
  51.                     <div class="card-body p-0">
  52.                         {% if list is empty or list|length == 0 %}
  53.                             <div class="p-4">データがありません。カテゴリーを登録してください。</div>
  54.                         {% else %}
  55.                             <table class="table table-sm">
  56.                                 <thead>
  57.                                     <tr>
  58.                                         <th class="border-top-0 ps-3 pt-2 pb-2">表示順</th>
  59.                                         <th class="border-top-0 ps-3 pt-2 pb-2">ID</th>
  60.                                         <th class="border-top-0 ps-3 pt-2 pb-2">カテゴリー名</th>
  61.                                         <th class="border-top-0 ps-3 pt-2 pb-2">データキー(スラッグ)</th>
  62.                                         <th class="border-top-0 ps-3 pt-2 pb-2">投稿数</th>
  63.                                         <th class="border-top-0 ps-3 pt-2 pb-2">&nbsp;</th>
  64.                                         <th class="border-top-0 ps-3 pt-2 pb-2">&nbsp;</th>
  65.                                     </tr>
  66.                                 </thead>
  67.                                 <tbody class="sortable">
  68.                                     {% for row in list %}
  69.                                     <tr id="category_ids_{{ row.getCategoryId }}">
  70.                                         <td  class="align-middle ps-2 pt-2 pb-2 icon_sortable" style="cursor:move;"><i class="fa fa-bars text-ec-gray"></i></td>
  71.                                         <td class="align-middle ps-2 pt-2 pb-2">{{ row.getCategoryId }}</td>
  72.                                         <td class="align-middle ps-2 pt-2 pb-2"><a href="{{ path(bind_prefix~'_category_edit',{type_id:type.getTypeId,category_id:row.getCategoryId}) }}">{{ row.getCategoryName }}</a></td>
  73.                                         <td class="align-middle ps-2 pt-2 pb-2">{{ row.getDataKey }}</td>
  74.                                         <td class="align-middle ps-2 pt-2 pb-2 text-end">{{ row.getPostCount|default(0)|number_format }}</td>
  75.                                         <td class="align-middle ps-2 pt-2 pb-2 text-center"><a href="{{ path(bind_prefix~'_category_edit',{type_id:type.getTypeId,category_id:row.getCategoryId}) }}"><i class="fa fa-pencil  fa-lg text-secondary"></i> 編集</a></td>
  76.                                         <td class="align-middle ps-2 pt-2 pb-2 text-center">
  77.                                             {% if row.getPostCount > 0 %}
  78.                                             <a style="cursor: not-allowed;"><i class="fa fa-close fa-lg text-secondary"></i> 削除</a>
  79.                                             {% else %}
  80.                                             <a href="{{ path(bind_prefix~'_category_delete',{category_id:row.getCategoryId}) }}" {{ csrf_token_for_anchor() }} data-method="delete" data-message="このデータを削除してもよろしいですか?"><i class="fa fa-close fa-lg text-secondary"></i> 削除</a>
  81.                                             {% endif %}
  82.                                         </td>
  83.                                     </tr>
  84.                                     {% endfor %}
  85.                                 </tbody>
  86.                             </table>
  87.                         {% endif %}
  88.                     </div>
  89.                     <div class="card-footer">
  90.                         <div id="{{ tag_id_prefix }}__footer">
  91.                             <div id="{{ tag_id_prefix }}__insert_button" class="text-center btn_area">
  92.                                 <a href="{{ url(bind_prefix~'_category_new',{type_id:type.getTypeId}) }}" class="btn btn-ec-regular">{{ 'admin.common.registration__new'|trans }}</a>
  93.                             </div>
  94.                         </div>
  95.                     </div>
  96.                 </div>
  97.             </div>
  98.         </div>
  99.     </div>
  100. {% endblock %}