user-groups.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. {% extends '../layout/admin.html' %}
  2. {% block html_title %}{{ customTitle(t('UserGroup management')) }}{% endblock %}
  3. {% block content_header %}
  4. <div class="header-wrap">
  5. <header id="page-header">
  6. <h1 id="admin-title" class="title">{{ t('UserGroup management') }}</h1>
  7. </header>
  8. </div>
  9. {% endblock %}
  10. {% block content_main %}
  11. <div class="content-main">
  12. {% set smessage = req.flash('successMessage') %}
  13. {% if smessage.length %}
  14. <div class="alert alert-success">
  15. {{ smessage }}
  16. </div>
  17. {% endif %}
  18. {% set emessage = req.flash('errorMessage') %}
  19. {% if emessage.length %}
  20. <div class="alert alert-danger">
  21. {{ emessage }}
  22. </div>
  23. {% endif %}
  24. <div class="row">
  25. <div class="col-md-3">
  26. {% include './widget/menu.html' with {current: 'user-group'} %}
  27. </div>
  28. <div class="col-md-9">
  29. <p>
  30. {% if isAclEnabled %}
  31. <button data-toggle="collapse" class="btn btn-default" href="#createGroupForm">新規グループの作成</button>
  32. {% else %}
  33. 現在の設定では新規グループの作成はできません。
  34. {% endif %}
  35. </p>
  36. <form role="form" action="/admin/user-group/create" method="post">
  37. <div id="createGroupForm" class="collapse">
  38. <div class="form-group">
  39. <label for="createGroupForm[userGroupName]">グループ名</label>
  40. <textarea class="form-control" name="createGroupForm[userGroupName]" placeholder="例: Group1"></textarea>
  41. </div>
  42. <button type="submit" class="btn btn-primary">作成する</button>
  43. </div>
  44. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  45. </form>
  46. {% set createdUserGroup = req.flash('createdUserGroup') %}
  47. {% if createdUserGroup.length %}
  48. <div class="modal fade in" id="createdGroupModal">
  49. <div class="modal-dialog">
  50. <div class="modal-content">
  51. <div class="modal-header">
  52. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  53. <h4 class="modal-title">グループを作成しました</h4>
  54. </div>
  55. <div class="modal-body">
  56. <p>
  57. 作成したグループにユーザを追加してください
  58. </p>
  59. <pre>{{ createdUserGroup.name }}</pre>
  60. </div>
  61. </div><!-- /.modal-content -->
  62. </div><!-- /.modal-dialog -->
  63. </div><!-- /.modal -->
  64. {% endif %}
  65. <div class="modal fade" id="admin-delete-user-group-modal">
  66. <div class="modal-dialog">
  67. <div class="modal-content">
  68. <div class="modal-header bg-danger">
  69. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  70. <div class="modal-title">
  71. <i class="icon icon-fire"></i> グループの削除
  72. </div>
  73. </div>
  74. <div class="modal-body">
  75. <dl>
  76. <dt>グループ名</dt>
  77. <dd><span id="admin-delete-user-group-name"></span></dd>
  78. </dl>
  79. <span class="text-danger">
  80. グループの削除を行うと元に戻すことはできませんのでご注意ください。
  81. </span>
  82. </div>
  83. <div class="modal-footer">
  84. <form action="/admin/user-group.remove" method="post" id="admin-user-groups-delete" class="text-right">
  85. <input type="hidden" name="user_group_id" value="">
  86. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  87. <button type="submit" value="" class="btn btn-sm btn-danger">
  88. <i class="icon icon-fire"></i> 削除
  89. </button>
  90. </form>
  91. </div>
  92. </div>
  93. <!-- /.modal-content -->
  94. </div>
  95. <!-- /.modal-dialog -->
  96. </div>
  97. <h2>グループ一覧</h2>
  98. <table class="table table-bordered table-user-list">
  99. <thead>
  100. <tr>
  101. <th width="60px">#</th>
  102. <th>{{ t('Name') }}</th>
  103. <th>ユーザ一覧</th>
  104. <th width="100px">作成日</th>
  105. <th width="70px"></th>
  106. </tr>
  107. </thead>
  108. <tbody>
  109. {% for sGroup in userGroups %}
  110. {% set sGroupDetailPageUrl = '/admin/user-group-detail/' + sGroup._id.toString() %}
  111. <tr>
  112. <td>
  113. <img src="{{ sGroup|picture }}" class="picture img-circle" />
  114. </td>
  115. <td><a href="{{ sGroupDetailPageUrl }}">{{ sGroup.name | preventXss }}</a></td>
  116. <td><ul class="list-inline">
  117. {% for relation in userGroupRelations.get(sGroup) %}
  118. <li class="list-inline-item badge badge-primary">{{relation.relatedUser.username}}</li>
  119. {% endfor %}
  120. </ul></td>
  121. <td>{{ sGroup.createdAt|date('Y-m-d', sGroup.createdAt.getTimezoneOffset()) }}</td>
  122. {% if isAclEnabled %}
  123. <td>
  124. <div class="btn-group admin-group-menu">
  125. <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
  126. <i class="icon-settings"></i> <span class="caret"></span>
  127. </button>
  128. <ul class="dropdown-menu" role="menu">
  129. <li>
  130. <a href="{{ sGroupDetailPageUrl }}">
  131. <i class="icon-fw icon-note"></i> 編集
  132. </a>
  133. </li>
  134. <li>
  135. <a href="#"
  136. data-user-group-id="{{ sGroup._id.toString() }}"
  137. data-user-group-name="{{ sGroup.name.toString() | encodeHTML }}"
  138. data-target="#admin-delete-user-group-modal"
  139. data-toggle="modal">
  140. <i class="icon-fw icon-fire text-danger"></i> 削除する
  141. </a>
  142. </li>
  143. </ul>
  144. </div>
  145. </td>
  146. {% else %}
  147. <td></td>
  148. {% endif %}
  149. </tr>
  150. {% endfor %}
  151. </tbody>
  152. </table>
  153. {% include '../widget/pager.html' with {path: "/admin/user-groups", pager: pager} %}
  154. </div>
  155. </div>
  156. </div>
  157. {% endblock content_main %}
  158. {% block content_footer %}
  159. {% endblock content_footer %}