Index.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
  2. <f:layout name="Backend" />
  3. <f:section name="main">
  4. <h1>Dashboard</h1>
  5. <hr style="width: 100%; border: 1px solid black; margin: 20px 0;">
  6. <h2>List of terms</h2>
  7. <style>
  8. th {
  9. cursor: pointer;
  10. }
  11. th:hover {
  12. background-color: #f1f1f1;
  13. }
  14. </style>
  15. <table id="termsTable" style="width: 100%">
  16. <thead>
  17. <tr>
  18. <th onclick="sortTable('termsTable',0)" additionalAttributes="{style: 'width: 10px;'}">ID</th>
  19. <th onclick="sortTable('termsTable',1)" additionalAttributes="{style: 'width: 200px;'}">Term</th>
  20. <th onclick="sortTable('termsTable',2)" additionalAttributes="{style: 'width: 200px;'}">Type</th>
  21. <th onclick="sortTable('termsTable',3)" additionalAttributes="{style: 'width: 200px;'}">Category</th>
  22. <th onclick="sortTable('termsTable',4)" additionalAttributes="{style: 'width: 400px;'}">URL</th>
  23. <th additionalAttributes="{style: 'width: 100px;'}">Action</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. <f:for each="{terms}" as="term">
  28. <tr>
  29. <td>{term.uid}</td>
  30. <td>{term.term}</td>
  31. <td>{term.type.title}</td>
  32. <td>{term.category.title}</td>
  33. <td>{term.url.title}</td>
  34. <td>
  35. <f:link.action action="deleteTerm" arguments="{termId: term.uid}" class="btn" title="Delete" onclick="return confirm('Are you sure you want to delete this term?');">Delete</f:link.action>
  36. </td>
  37. </tr>
  38. </f:for>
  39. </tbody>
  40. </table>
  41. <hr style="width: 100%; border: 1px solid black; margin: 20px 0;">
  42. <h2>List of types</h2>
  43. <table id="typesTable" style="width: 210px;">
  44. <thead>
  45. <tr>
  46. <th onclick="sortTable('typesTable',0)" additionalAttributes="{style: 'width: 10px;'}">ID</th>
  47. <th onclick="sortTable('typesTable',1)" additionalAttributes="{style: 'width: 200px;'}">Title</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <f:for each="{types}" as="type">
  52. <tr>
  53. <td>{type.uid}</td>
  54. <td>{type.title}</td>
  55. </tr>
  56. </f:for>
  57. </tbody>
  58. </table>
  59. <hr style="width: 100%; border: 1px solid black; margin: 20px 0;">
  60. <h2>List of categories</h2>
  61. <table id="categoriesTable" style="width: 210px;">
  62. <thead>
  63. <tr>
  64. <th onclick="sortTable('categoriesTable',0)" additionalAttributes="{style: 'width: 10px;'}">ID</th>
  65. <th onclick="sortTable('categoriesTable',1)" additionalAttributes="{style: 'width: 200px;'}">Title</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <f:for each="{categories}" as="category">
  70. <tr>
  71. <td>{category.uid}</td>
  72. <td>{category.title}</td>
  73. </tr>
  74. </f:for>
  75. </tbody>
  76. </table>
  77. <hr style="width: 100%; border: 1px solid black; margin: 20px 0;">
  78. <h2>Add words (semicolon-separated) with a type</h2>
  79. <f:flashMessages />
  80. <f:form action="create">
  81. <div class="form-group" additionalAttributes="{style: 'margin-bottom: 1rem;'}">
  82. <label for="termList">Terms:</label>
  83. <f:form.textfield name="termList" additionalAttributes="{style: 'width: 100%; height: 30px; display: block;'}" /><br>
  84. </div>
  85. <div class="form-group">
  86. <label for="typeTitle">Type:</label>
  87. <f:form.textfield name="typeTitle" additionalAttributes="{style: 'width: 150px; height: 30px; display: block;'}" /><br>
  88. </div>
  89. <div class="form-group">
  90. <label for="categoryTitle">Category:</label>
  91. <f:form.textfield name="categoryTitle" additionalAttributes="{style: 'width: 150px; height: 30px; display: block;'}" /><br>
  92. </div>
  93. <div class="form-group">
  94. <label for="urlTitle">URL:</label>
  95. <f:form.textfield name="urlTitle" additionalAttributes="{style: 'width: 400px; height: 30px; display: block;'}" /><br>
  96. </div>
  97. <f:form.submit value="Save" />
  98. </f:form>
  99. <script>
  100. function sortTable(tableId, columnIndex) {
  101. var table, rows, switching, i, x, y, shouldSwitch, direction, switchCount = 0;
  102. table = document.getElementById(tableId);
  103. switching = true;
  104. direction = "asc";
  105. while (switching) {
  106. switching = false;
  107. rows = table.rows;
  108. for (i = 1; i < (rows.length - 1); i++) {
  109. shouldSwitch = false;
  110. x = rows[i].getElementsByTagName("TD")[columnIndex];
  111. y = rows[i + 1].getElementsByTagName("TD")[columnIndex];
  112. if (direction == "asc") {
  113. if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
  114. shouldSwitch = true;
  115. break;
  116. }
  117. } else if (direction == "desc") {
  118. if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
  119. shouldSwitch = true;
  120. break;
  121. }
  122. }
  123. }
  124. if (shouldSwitch) {
  125. rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
  126. switching = true;
  127. switchCount++;
  128. } else {
  129. if (switchCount == 0 && direction == "asc") {
  130. direction = "desc";
  131. switching = true;
  132. }
  133. }
  134. }
  135. }
  136. </script>
  137. </f:section>
  138. </html>