PageRenderTime 24ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/tool/policy/templates/page_managedocs_list.mustache

https://github.com/mackensen/moodle
Mustache | 151 lines | 82 code | 2 blank | 67 comment | 0 complexity | 7fdb2374b275121df0953a6e4132a64d MD5 | raw file
  1. {{!
  2. This file is part of Moodle - http://moodle.org/
  3. Moodle is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. Moodle is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  13. }}
  14. {{!
  15. @template tool_policy/page_managedocs_list
  16. Template for the policy documents management page.
  17. Classes required for JS:
  18. -
  19. Data attributes required for JS:
  20. * data-policy-name
  21. * data-policy-revision
  22. * data-action
  23. Context variables required for this template:
  24. * haspolicies
  25. * policies
  26. Example context (json):
  27. {
  28. "title": "Manage policies",
  29. "backurl": "/",
  30. "pluginbaseurl": "/admin/tool/policy/",
  31. "canviewacceptances": true,
  32. "canmanage": true,
  33. "versions": [
  34. {
  35. "id": 1,
  36. "name": "Terms &amp; conditions",
  37. "typetext": "Site policy",
  38. "audiencetext": "All users",
  39. "statustext": "Active",
  40. "optionaltext": "Optional",
  41. "revision": "1.0",
  42. "timemodified": 1521531208,
  43. "acceptancescounturl": "#",
  44. "acceptancescounttext": "10 out of 1000 (1%)"
  45. },
  46. {
  47. "indented": true,
  48. "name": "Terms &amp; conditions",
  49. "typetext": "Site policy",
  50. "audiencetext": "All users",
  51. "statustext": "Draft",
  52. "optionaltext": "Compulsory",
  53. "revision": "2.0",
  54. "timemodified": 1521531208,
  55. "acceptancescounttext": "N/A"
  56. }
  57. ]
  58. }
  59. }}
  60. <h2>{{{title}}}</h2>
  61. {{#backurl}}
  62. <div>
  63. <div class="btn-group">
  64. <a href="{{backurl}}" class="btn btn-secondary">{{#str}} back {{/str}}</a>
  65. </div>
  66. </div>
  67. {{/backurl}}
  68. {{#canaddnew}}
  69. <div>
  70. <div class="btn-group">
  71. <a href="{{pluginbaseurl}}/editpolicydoc.php" class="btn btn-primary">{{#str}} newpolicy, tool_policy {{/str}}</a>
  72. </div>
  73. </div>
  74. {{/canaddnew}}
  75. <table id="tool-policy-managedocs-wrapper" class="generaltable fullwidth listpolicydocuments">
  76. <thead>
  77. <tr>
  78. <th scope="col">{{#str}} policydocname, tool_policy {{/str}}</th>
  79. <th scope="col">{{#str}} status, tool_policy {{/str}}</th>
  80. <th scope="col">{{#str}} policydocrevision, tool_policy {{/str}}</th>
  81. {{#canviewacceptances}}
  82. <th scope="col">{{#str}} usersaccepted, tool_policy {{/str}}</th>
  83. {{/canviewacceptances}}
  84. {{#canmanage}}
  85. <th scope="col"></th>
  86. {{/canmanage}}
  87. </tr>
  88. </thead>
  89. <tbody>
  90. {{#versions}}
  91. <tr data-policy-name="{{{name}}}" data-policy-revision="{{revision}}">
  92. <td>
  93. {{#indented}}
  94. <div style="float:left">
  95. {{#pix}} level, tool_policy {{/pix}}
  96. </div>
  97. {{/indented}}
  98. <div {{#indented}}style="margin-left: 24px" {{/indented}}>
  99. <div>{{{name}}}</div>
  100. <div class="text-muted, muted"><small>{{{typetext}}}, {{{audiencetext}}}, {{{optionaltext}}}</small></div>
  101. </div>
  102. </td>
  103. <td>
  104. {{{statustext}}}
  105. </td>
  106. <td>
  107. {{revision}}
  108. <div class="text-muted, muted">
  109. <small>
  110. <time title="{{#str}} lastmodified, core {{/str}}" datetime="{{#userdate}} {{timemodified}}, %Y-%m-%dT%T%z {{/userdate}}">
  111. {{#userdate}} {{timemodified}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}
  112. </time>
  113. </small>
  114. </div>
  115. </td>
  116. {{#canviewacceptances}}
  117. <td>
  118. {{#acceptancescounturl}}
  119. <a href="{{acceptancescounturl}}">{{acceptancescounttext}}</a>
  120. {{/acceptancescounturl}}
  121. {{^acceptancescounturl}}
  122. {{acceptancescounttext}}
  123. {{/acceptancescounturl}}
  124. </td>
  125. {{/canviewacceptances}}
  126. {{#canmanage}}
  127. <td>
  128. {{#actionmenu}}
  129. {{>core/action_menu}}
  130. {{/actionmenu}}
  131. </td>
  132. {{/canmanage}}
  133. </tr>
  134. {{/versions}}
  135. </tbody>
  136. </table>
  137. {{#js}}
  138. require(['tool_policy/managedocsactions'], function(ManageDocsActions) {
  139. ManageDocsActions.init('tool-policy-managedocs-wrapper');
  140. });
  141. {{/js}}