Explorar el Código

change the separation of terms to semicolon and add some basic styles

ksieren hace 2 años
padre
commit
6ac2656970

+ 1 - 1
Classes/Controller/DashboardController.php

@@ -64,7 +64,7 @@ class DashboardController extends ActionController
     }
 
     public function createAction(string $termList, string $categoryTitle, string $typeTitle, string $urlTitle): void {
-        $terms = array_map('trim', explode(',', $termList));
+        $terms = array_map('trim', explode(';', $termList));
         $category = $this->categoryController->createAction($categoryTitle);
         $categoryObj = $this->categoryRepository->findByUid($category);
         $type = $this->typeController->createAction($typeTitle);

+ 1 - 1
Resources/Private/Layouts/Backend.html

@@ -20,7 +20,7 @@
     <be:moduleLayout.button.shortcutButton displayName="Add" />
 
     <div id="begriffe-main-content">
-        <f:render section="List" />
+        <f:render section="main" />
     </div>
 
 </be:moduleLayout>

+ 29 - 20
Resources/Private/Templates/Dashboard/Index.html

@@ -1,5 +1,4 @@
-<html
-    xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
+<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
     xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
     xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
     data-namespace-typo3-fluid="true">
@@ -7,33 +6,43 @@
 <f:layout name="Backend" />
 
 
-<f:section name="List">
+<f:section name="main">
   <h1>Dashboard</h1>
 
-  <h2>Add words (comma-separated) with a category</h2>
+  <h2>Add words (semicolon-separated) with a category</h2>
   <f:flashMessages />
   <f:form action="create">
-    <label for="termList">Terms:</label>
-    <f:form.textfield name="termList" /><br>
-    <label for="categoryTitle">Category:</label>
-    <f:form.textfield name="categoryTitle" /><br>
-<!--    <f:form.select name="category" options="{categories}" optionValueField="uid" optionLabelField="title" /><br>-->
-    <label for="typeTitle">Type:</label>
-    <f:form.textfield name="typeTitle" /><br>
-    <label for="urlTitle">URL:</label>
-    <f:form.textfield name="urlTitle" /><br>
+    <div class="form-group" additionalAttributes="{style: 'margin-bottom: 1rem;'}">
+      <label for="termList">Terms:</label>
+      <f:form.textfield name="termList" additionalAttributes="{style: 'width: 100%; height: 30px; display: block;'}" /><br>
+    </div>
+    <div class="form-group">
+      <label for="categoryTitle">Category:</label>
+      <f:form.textfield name="categoryTitle" additionalAttributes="{style: 'width: 150px; height: 30px; display: block;'}" /><br>
+    </div>
+    <div class="form-group">
+      <label for="typeTitle">Type:</label>
+      <f:form.textfield name="typeTitle" additionalAttributes="{style: 'width: 150px; height: 30px; display: block;'}" /><br>
+    </div>
+    <div class="form-group">
+      <label for="urlTitle">URL:</label>
+      <f:form.textfield name="urlTitle" additionalAttributes="{style: 'width: 400px; height: 30px; display: block;'}" /><br>
+    </div>
     <f:form.submit value="Save" />
   </f:form>
 
+  <hr style="width: 100%; border: 1px solid black; margin: 20px 0;">
+
   <h2>List of terms</h2>
-  <table>
+  <table style="width: 100%;">
     <thead>
     <tr>
-      <th>ID</th>
-      <th>Term</th>
-      <th>Type</th>
-      <th>Category</th>
-      <th>Url</th>
+      <th additionalAttributes="{style: 'width: 10px;'}">ID</th>
+      <th additionalAttributes="{style: 'width: 200px;'}">Term</th>
+      <th additionalAttributes="{style: 'width: 200px;'}">Type</th>
+      <th additionalAttributes="{style: 'width: 200px;'}">Category</th>
+      <th additionalAttributes="{style: 'width: 200px;'}">Url</th>
+      <th additionalAttributes="{style: 'width: 100px;'}">Action</th>
     </tr>
     </thead>
     <tbody>
@@ -45,7 +54,7 @@
         <td>{term.category.title}</td>
         <td>{term.url.title}</td>
         <td>
-          <f:link.action action="deleteTerm" arguments="{termId: term.uid}" class="btn btn-danger" title="Delete" onclick="return confirm('Are you sure you want to delete this term?');">Delete</f:link.action>
+          <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>
         </td>
       </tr>
     </f:for>