Procházet zdrojové kódy

Merge pull request #171 from qor5/remove-edit-content-page

remove EditPageContent button
Azuma Daisuke před 1 rokem
rodič
revize
4c19eed35d
2 změnil soubory, kde provedl 0 přidání a 54 odebrání
  1. 0 50
      pagebuilder/builder.go
  2. 0 4
      pagebuilder/messages.go

+ 0 - 50
pagebuilder/builder.go

@@ -550,38 +550,6 @@ function(e){
 		return nil
 	})
 
-	eb.Field("EditContainer").ComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) h.HTMLComponent {
-		msgr := i18n.MustGetModuleMessages(ctx.R, I18nPageBuilderKey, Messages_en_US).(*Messages)
-		p := obj.(*Page)
-		if p.ID == 0 {
-			return nil
-		}
-		if p.GetStatus() == publish.StatusDraft {
-			var href = fmt.Sprintf("%s/editors/%d?version=%s", b.prefix, p.ID, p.GetVersion())
-			if locale, isLocalizable := l10n.IsLocalizableFromCtx(ctx.R.Context()); isLocalizable && l10nON {
-				href = fmt.Sprintf("%s/editors/%d?version=%s&locale=%s", b.prefix, p.ID, p.GetVersion(), locale)
-			}
-			return h.Div(
-				VBtn(msgr.EditPageContent).
-					Target("_blank").
-					Href(href).
-					Color("secondary"),
-			)
-		} else {
-			var href = fmt.Sprintf("%s/preview?id=%d&version=%s", b.prefix, p.ID, p.GetVersion())
-			if locale, isLocalizable := l10n.IsLocalizableFromCtx(ctx.R.Context()); isLocalizable && l10nON {
-				href = fmt.Sprintf("%s/preview?id=%d&version=%s&locale=%s", b.prefix, p.ID, p.GetVersion(), locale)
-			}
-			return h.Div(
-				VBtn(msgr.Preview).
-					Target("_blank").
-					Href(href).
-					Color("secondary"),
-			)
-		}
-		return nil
-	})
-
 	eb.SaveFunc(func(obj interface{}, id string, ctx *web.EventContext) (err error) {
 		localeCode, _ := l10n.IsLocalizableFromCtx(ctx.R.Context())
 		p := obj.(*Page)
@@ -1703,24 +1671,6 @@ func (b *Builder) ConfigTemplate(pb *presets.Builder, db *gorm.DB) (pm *presets.
 	dp.Field("Overview").ComponentFunc(templateSettings(db, pm))
 
 	eb := pm.Editing("Name", "Description")
-	eb.Field("EditContainer").ComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) h.HTMLComponent {
-		msgr := i18n.MustGetModuleMessages(ctx.R, I18nPageBuilderKey, Messages_en_US).(*Messages)
-		m := obj.(*Template)
-		if m.ID == 0 {
-			return nil
-		}
-
-		var href = fmt.Sprintf("%s/editors/%d?tpl=1", b.prefix, m.ID)
-		if locale, isLocalizable := l10n.IsLocalizableFromCtx(ctx.R.Context()); isLocalizable && l10nON {
-			href = fmt.Sprintf("%s/editors/%d?tpl=1&locale=%s", b.prefix, m.ID, locale)
-		}
-		return h.Div(
-			VBtn(msgr.EditPageContent).
-				Target("_blank").
-				Href(href).
-				Color("secondary"),
-		)
-	})
 
 	eb.SaveFunc(func(obj interface{}, id string, ctx *web.EventContext) (err error) {
 		this := obj.(*Template)

+ 0 - 4
pagebuilder/messages.go

@@ -6,7 +6,6 @@ const I18nPageBuilderKey i18n.ModuleKey = "I18nPageBuilderKey"
 
 type Messages struct {
 	Category                       string
-	EditPageContent                string
 	Preview                        string
 	Containers                     string
 	AddContainers                  string
@@ -30,7 +29,6 @@ type Messages struct {
 
 var Messages_en_US = &Messages{
 	Category:                       "Category",
-	EditPageContent:                "Edit Page Content",
 	Preview:                        "Preview",
 	Containers:                     "Containers",
 	AddContainers:                  "Add Containers",
@@ -54,7 +52,6 @@ var Messages_en_US = &Messages{
 
 var Messages_zh_CN = &Messages{
 	Category:                       "目录",
-	EditPageContent:                "编辑页面内容",
 	Preview:                        "预览",
 	Containers:                     "组件",
 	AddContainers:                  "增加组件",
@@ -78,7 +75,6 @@ var Messages_zh_CN = &Messages{
 
 var Messages_ja_JP = &Messages{
 	Category:                       "カテゴリー",
-	EditPageContent:                "ページコンテナを編集する",
 	Preview:                        "プレビュー",
 	Containers:                     "コンテナ",
 	AddContainers:                  "コンテナを追加する",