From d48adb741c5c30ba3f2d3c039a7e342b43add352 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 4 Jul 2018 10:42:21 -0400 Subject: Added blog drafts An unpublished post is not viewable unless you are logged in. The "Create record" field is disabled for unpublished posts, though this is only in JavaScript and the backend will not disallow creating records for unpublished posts if forced to. Unpublishing a post does not destroy records for that post. This only applies to blog posts, currently; streams and stream updates cannot be drafted. Unpublished posts still require titles and slugs. There is no autosaving functionality yet. refs #1 --- app/views/admin/blogs/_form.html.haml | 4 ++++ app/views/admin/blogs/drafts.html.haml | 10 ++++++++++ app/views/admin/blogs/index.html.haml | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/views/admin/blogs/drafts.html.haml (limited to 'app/views/admin/blogs') diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml index 4a1c410..2066aed 100644 --- a/app/views/admin/blogs/_form.html.haml +++ b/app/views/admin/blogs/_form.html.haml @@ -15,6 +15,10 @@ %ul - f.object.errors.full_messages.each do |error| %li= error + .details-module + .published-field + = f.check_box :published + = f.label :published .details-module = f.fields_for :records, Record.new do |builder| .should-create-record-field diff --git a/app/views/admin/blogs/drafts.html.haml b/app/views/admin/blogs/drafts.html.haml new file mode 100644 index 0000000..91d3214 --- /dev/null +++ b/app/views/admin/blogs/drafts.html.haml @@ -0,0 +1,10 @@ +%table#entries + %tr + %th Title + %th Last updated + %th + - @blogs.each do |blog| + %tr{ class: cycle("even", "odd") } + %td= blog.title + %td= blog.updated_at.strftime("%B %d, %Y, %l:%M%P") + %td= link_to "Edit", edit_admin_blog_url(blog) diff --git a/app/views/admin/blogs/index.html.haml b/app/views/admin/blogs/index.html.haml index 448617a..c5db4f1 100644 --- a/app/views/admin/blogs/index.html.haml +++ b/app/views/admin/blogs/index.html.haml @@ -1,10 +1,10 @@ %table#entries %tr %th Title - %th Date created + %th Date published %th - @blogs.each do |blog| %tr{ class: cycle("even", "odd") } %td= blog.title - %td= blog.created_at.strftime("%B %d, %Y, %l:%M%P") + %td= blog.published_at.strftime("%B %d, %Y, %l:%M%P") %td= link_to "Edit", edit_admin_blog_url(blog) -- cgit 1.4.1