Ticket #62 (closed enhancement: wontfix)

Opened 8 months ago

Last modified 1 month ago

Post preview

Reported by: dottedmag Assigned to:
Priority: major Milestone:
Component: blog Version:
Keywords: Cc:

Description (Last modified by dottedmag)

It would be nice to have a "post preview" button when post is created/edited.

Attachments

preview.patch (2.4 kB) - added by benjaminwarfield on 06/04/08 04:46:46.
Preview a post.

Change History

(follow-up: ↓ 2 ) 04/05/08 22:20:53 changed by dottedmag

  • description changed.

(in reply to: ↑ 1 ) 06/03/08 16:43:18 changed by benjaminwarfield

Replying to dottedmag:

I typically use 'Post would act as draft' the view it from there. I'll see if I can come up with something as I would like a cleaner way to preview as well.

06/03/08 23:55:45 changed by benjaminwarfield

So, what I've come up with as a quick hack is simple. In apps/blog/models.py add a boolean model called 'is_preview', check for it and then set is_draft to true. Save the new post, then use RedirectException? to send the user to the draft page (may be more useful to pop-up, but that's annoying on most browsers). On the draft page, check to see if 'is_preview' is true, then maybe display an overlay via css stating it's a draft and to click through to edit it, or post it, which would remove it's draft and preview status. I've got a POC that I'll post a diff for later.

I'm thinking that if there are any javascript hackers in the bunch, it might be doable, and faster to do it client side. My only beef with that would be not saving it as a draft, which I find useful. Say someone starts a blog, previews it, then gets distracted and navigates away.

Opinions?

benjaminwarfield@just-another.net

06/03/08 23:56:54 changed by benjaminwarfield

I forgot to mention that my POC also requires patching apps/blog/views.py, and does add an extra column to the DB.

Will post it later this evening (EST)

06/04/08 04:41:07 changed by benjaminwarfield

See attached export for a quick POC on how this could work. You could use this in a template by testing for is_preview and acting accordingly like this:

{% if object.is_preview %}
  <div id="post-draft">THIS IS A PREVIEW <a href="/admin/blog/post/{{ object.id }}/">Continue Editing</a></div>
{% endif %}

06/04/08 04:46:46 changed by benjaminwarfield

  • attachment preview.patch added.

Preview a post.

06/04/08 08:55:04 changed by piranha

Hmm... I think 'Post would act as draft' is enough now, just because we have plans to make custom admin, which will simplify things a lot.

What do you think?

06/04/08 14:51:43 changed by benjaminwarfield

I agree completely, I just wanted to give an alternative implementation. The patch I posted uses the draft option anyway :).

10/19/08 22:33:38 changed by piranha

  • status changed from new to closed.
  • resolution set to wontfix.

Use is_draft for that.

Ohloh project report for byteflow