dingoblog / dingo

Blog engine written in Go
MIT License
284 stars 37 forks source link

Cover image #2

Open dinever opened 8 years ago

dinever commented 8 years ago

It would be great if we can implement a cover image field for each post.

TimothyYe commented 8 years ago

For this feature, should user upload cover image to server or just provide cover image URL from any other web sites?

dinever commented 8 years ago

Hi @TimothyYe,

I think we can just add an input field in /view/admin/edit_post.html to indicate a cover image URL first, and implement a drag-and-drop upload feature later.

If you are interested in working on this one, you may find out that there is already an Image field in post.go#L43, and what we need to do is to add a line in post.go#L216 to read image link from form data:

p.Image = r.FormValue("image")

And also add an input field in /view/admin/edit_post.html like this:

<input class="mdl-textfield__input" type="url" name="image" id="image" value="{{ .Post.Image }}">

Thanks!

TimothyYe commented 8 years ago

Sure, I'll take it and try to implement this feature.

TimothyYe commented 8 years ago

@dinever Cover image URL now can be edited & saved in admin panel, I'll create a pull request later.

dinever commented 8 years ago

@TimothyYe Great. Looking forward to it.