Coder Social home page Coder Social logo

Content Field Blank With Ponzu about ponzu HOT 9 CLOSED

ponzu-cms avatar ponzu-cms commented on April 28, 2024
Content Field Blank With Ponzu

from ponzu.

Comments (9)

Nemesisesq avatar Nemesisesq commented on April 28, 2024

I am running go1.8

ponzu version 0.9.1

ponzu --cli version 0.9.1

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Could you paste the generated review.go file here too? Did you edit it at all or immediate just build and run?

Also, can you try visiting http://localhost:8080/admin/edit?type=Review

It's strange that you're able to run the project but the content type isn't showing.

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024
package content

import (
	"fmt"

	"github.com/ponzu-cms/ponzu/management/editor"
	"github.com/ponzu-cms/ponzu/system/item"
)

type Review struct {
	item.Item

	Title      string   `json:"title"`
	Author     string   `json:"author"`
	Rating     float64  `json:"rating"`
	Body       string   `json:"body"`
	WebsiteUrl string   `json:"website_url"`
	Items      []string `json:"items"`
	Photos     []string `json:"photos"`
}

// MarshalEditor writes a buffer of html to edit a Review within the CMS
// and implements editor.Editable
func (r *Review) MarshalEditor() ([]byte, error) {
	view, err := editor.Form(r,
		// Take note that the first argument to these Input-like functions
		// is the string version of each Review field, and must follow
		// this pattern for auto-decoding and auto-encoding reasons:
		editor.Field{
			View: editor.Input("Title", r, map[string]string{
				"label":       "Title",
				"type":        "text",
				"placeholder": "Enter the Title here",
			}),
		},
		editor.Field{
			View: editor.Input("Author", r, map[string]string{
				"label":       "Author",
				"type":        "text",
				"placeholder": "Enter the Author here",
			}),
		},
		editor.Field{
			View: editor.Input("Rating", r, map[string]string{
				"label":       "Rating",
				"type":        "text",
				"placeholder": "Enter the Rating here",
			}),
		},
		editor.Field{
			View: editor.Input("Body", r, map[string]string{
				"label":       "Body",
				"type":        "text",
				"placeholder": "Enter the Body here",
			}),
		},
		editor.Field{
			View: editor.Input("WebsiteUrl", r, map[string]string{
				"label":       "WebsiteUrl",
				"type":        "text",
				"placeholder": "Enter the WebsiteUrl here",
			}),
		},
		editor.Field{
			View: editor.Input("Items", r, map[string]string{
				"label":       "Items",
				"type":        "text",
				"placeholder": "Enter the Items here",
			}),
		},
		editor.Field{
			View: editor.Input("Photos", r, map[string]string{
				"label":       "Photos",
				"type":        "text",
				"placeholder": "Enter the Photos here",
			}),
		},
	)

	if err != nil {
		return nil, fmt.Errorf("Failed to render Review editor view: %s", err.Error())
	}

	return view, nil
}

func init() {
	item.Types["Review"] = func() interface{} { return new(Review) }
}

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

Error:
There is no type registered for Review

Add this to the file which defines Review{} in the 'content' package:

func init() {			
	item.Types["Review"] = func() interface{} { return new(Review) }
}		

This is what I get when I visit the link above

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Hmm.. what is the output of pwd from within the directory you are executing ponzu run ?

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

/Users/nem/go/src/github.com/wearevest/vestCMS is the output of pwd

I just got it working when I reinstalled it in a different place. i'm going to try to reinstall

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Ok, great - go ahead and close this issue if your new build works. Otherwise let me know and I will try to continue help w/ debugging.

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

It's working now, I'm not exactly sure why. If I have any other problems I will let you know thank you.

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Sounds good! Glad it's working now

from ponzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.