jason пре 2 година
родитељ
комит
d4f458f76f

+ 1 - 1
backstage/collections/forms.py

@@ -23,7 +23,7 @@ class CollectionCreateForm(FlaskForm):
     budget = StringField('總預算', validators=[DataRequired()])
     construction = StringField('建案名稱', validators=[DataRequired()])
     collectiondesc = TextAreaField('作品集描述', validators=[DataRequired()])
-    collectionslider = MultipleFileField('作品集圖片集', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
+    # collectionslider = MultipleFileField('作品集圖片集', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
     comment = FileField('Comment', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
 
 

+ 26 - 4
backstage/static/js/yo.js

@@ -35,15 +35,17 @@ $(function () {
             readOnly: false,
             holder: 'editorjs',
         });
-    if ($('#editorjs1').length > 0)
+    /* if ($('#editorjs1').length > 0)
         editor1 = new EditorJS({
             readOnly: false,
             holder: 'editorjs1',
-        });
+        }); */
 
 });
 
 function getHeader(url) {
+    var editor1;
+
     axios.get(contentApiUrl + url).then(({ data }) => {
         frontMatters = [];
         contentMatters = [];
@@ -56,11 +58,30 @@ function getHeader(url) {
         //const content = _.get(data, '0.content', '');
         blocks = parseMd(aa);
         oTitle = $("#ctitle").val();
-        // console.log($("#ctitle"));
+        //console.log($("#ctype").val());
         // $("#dialog-form").dialog();
-        if ($("#ctype").val() == "collection") {
+        if ($("#ctype").val() == "collection")
+        {
             $("#scat").hide();
+            console.log($("#ctype").val());
+            editor1 = new EditorJS({
+                readOnly: false,
+                holder: 'editorjs1',
+                tools: {
+                    paragraph: { inlineToolbar: false },
+                    image: {
+                        class: ImageTool,
+                        config: {
+                            endpoints: {
+                                byFile: '/backstage/upload' + $('#curl').val(),
+                                byUrl: '/backstage/getimage' + $('#curl').val(),
+                            }
+                        }
+                    }
+                }
+            });
         }
+
         else if ($("#ctype").val() == "maincategories" || $("#ctype").val() == "blog") {
             $("#sdesc").hide();
         }
@@ -713,6 +734,7 @@ function ParseProductSection(inContent) {
                 }
             }
         }
+        
         , data: { blocks: editorBlocks1 }
         ,
         onReady: function () {

+ 6 - 9
backstage/templates/collections.html

@@ -91,9 +91,6 @@
     {{ form.construction.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.construction(class="form-control form-control-lg") }}
 
-    {{ form.collectionslider.label(class="form-control-label modal__label mt-3 mb-1") }}
-    {{ form.collectionslider(class="form-control form-control-lg modal__file") }}
-
     {{ form.comment.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.comment(class="form-control form-control-lg modal__file") }}
     
@@ -288,12 +285,12 @@
               </td>
               <td><input class="form-control" id="cconstruction" type="text" /></td>
             </tr>
-            <tr>
-              <td>
-                <h4>作品集圖片集</h4>
-              </td>
-              <td><input class="form-control" id="cnewccollslider" type="text" /></td>
-            </tr>
+            <td>
+              <h4>作品集圖片集1</h4>
+            </td>
+            <td>
+                <div class="form-control" id="editorjs1" style='border:inset 1px;'></div>
+            </td>
             <tr>
               <td>
                 <h4>是否顯示</h4>

BIN
backstage/upload/aaaaaaaa/img/7105fd570a574bc48f61deb7fe8171c7.webp


BIN
backstage/upload/aaaaaaaa/img/aa47eb4303134daa926670ac95d3e717.webp


BIN
backstage/upload/aaaaaaaa/img/orig/7105fd570a574bc48f61deb7fe8171c7.png


BIN
backstage/upload/aaaaaaaa/img/orig/aa47eb4303134daa926670ac95d3e717.png