Browse Source

Improved article management

keplyx 4 years ago
parent
commit
edf5641aff
2 changed files with 9 additions and 5 deletions
  1. 2
    0
      assets/css/list.css
  2. 7
    5
      assets/js/listManager.js

+ 2
- 0
assets/css/list.css View File

@@ -48,6 +48,8 @@
48 48
     width: 200px;
49 49
     height: 50px;
50 50
     overflow: hidden;
51
+    font-size: 0.8rem;
52
+    line-height: 25px;
51 53
 }
52 54
 
53 55
 .list-price {

+ 7
- 5
assets/js/listManager.js View File

@@ -129,8 +129,10 @@ class ListManager {
129 129
             } else {
130 130
                 if (this.editableTypes[i]['name'] === 'icon')
131 131
                     formData += "<i class='mdi mdi-" + value + "' style='margin-left: 5px'></i>";
132
-                formData += '<input name="' + inputName + '" id="' + inputId + '" type="' + inputType + '" placeholder="Entrez une valeur" class="form-control" value="' + value + '" required />';
133
-
132
+                if (this.editableTypes[i]['name'] === 'description')
133
+                    formData += '<textarea name="' + inputName + '" id="' + inputId + '" type="' + inputType + '" placeholder="Entrez une valeur" class="form-control" required >' + value + '</textarea>';
134
+                else
135
+                    formData += '<input name="' + inputName + '" id="' + inputId + '" type="' + inputType + '" placeholder="Entrez une valeur" class="form-control" value="' + value + '" required />';
134 136
             }
135 137
         }
136 138
         formData += "</div></form>";
@@ -210,9 +212,7 @@ class ListManager {
210 212
         if (index === -1)
211 213
             index = this.displayedData.length - 1;
212 214
         let iconContainer = this.displayedData[index].find(".list-category");
213
-        for (let i = 0; i < categories.length; i++) {
214
-            iconContainer.html(this.getCategoryIcons(this.currentData[index]['id']));
215
-        }
215
+        iconContainer.html(this.getCategoryIcons(this.currentData[index]['id']));
216 216
     }
217 217
 
218 218
     updateAssociationList(articleId, newCategories) {
@@ -229,6 +229,8 @@ class ListManager {
229 229
     }
230 230
 
231 231
     updateArticleImage(image, index) {
232
+        if (index === -1)
233
+            index = this.displayedData.length - 1;
232 234
         $(this.displayedData[index].find("img")[0]).attr('src', window.URL.createObjectURL(image));
233 235
     }
234 236
 

Loading…
Cancel
Save