Browse Source

Merge pull request #159 from qor5/fix-pb

Fix PB
Chenyang 1 year ago
parent
commit
531b7c0624
1 changed files with 5 additions and 34 deletions
  1. 5 34
      pagebuilder/builder.go

+ 5 - 34
pagebuilder/builder.go

@@ -6,7 +6,6 @@ import (
 	"html/template"
 	"net/http"
 	"net/url"
-	"os"
 	"path"
 	"reflect"
 	"sort"
@@ -485,32 +484,6 @@ function(e){
 		if err := db.Model(&Category{}).Where("locale_code = ?", locale).Find(&categories).Error; err != nil {
 			panic(err)
 		}
-		var showURLComp h.HTMLComponent
-		if p.ID != 0 && p.GetStatus() == publish.StatusOnline {
-			var u string
-			domain := os.Getenv("PUBLISH_URL")
-			if p.OnlineUrl != "" {
-				u = domain + p.getAccessUrl(p.OnlineUrl)
-			} else {
-				var c Category
-				for _, e := range categories {
-					if e.ID == p.CategoryID {
-						c = *e
-						break
-					}
-				}
-
-				var localPath string
-				if l10nB != nil {
-					localPath = l10nB.GetLocalePath(p.LocaleCode)
-				}
-				u = domain + p.getAccessUrl(p.getPublishUrl(localPath, c.Path))
-			}
-
-			showURLComp = h.Div(
-				h.A().Text(u).Href(u).Target("_blank"),
-			).Class("mb-4")
-		}
 
 		var vErr web.ValidationErrors
 		if ve, ok := ctx.Flash.(*web.ValidationErrors); ok {
@@ -519,12 +492,10 @@ function(e){
 
 		msgr := i18n.MustGetModuleMessages(ctx.R, I18nPageBuilderKey, Messages_en_US).(*Messages)
 
-		return h.Div(
-			showURLComp,
-			VAutocomplete().Label(msgr.Category).FieldName(field.Name).MenuProps("top").
-				Items(categories).Value(p.CategoryID).ItemText("Path").ItemValue("ID").
-				ErrorMessages(vErr.GetFieldErrors("Page.Category")...),
-		).ClassIf("mb-4", p.ID != 0)
+		return vx.VXAutocomplete().Label(msgr.Category).FieldName(field.Name).
+			Multiple(false).Chips(false).
+			Items(categories).Value(p.CategoryID).ItemText("Path").ItemValue("ID").
+			ErrorMessages(vErr.GetFieldErrors("Page.Category")...)
 	})
 
 	eb.Field("TemplateSelection").ComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) h.HTMLComponent {
@@ -738,7 +709,7 @@ func configureVersionListDialog(db *gorm.DB, pb *presets.Builder, pm *presets.Mo
 				h.Text(""),
 			),
 		)
-	})
+	}).Label("Unread Notes")
 	lb.Field("Option").ComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) h.HTMLComponent {
 		p := obj.(*Page)
 		id := ctx.R.FormValue("select_id")