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 ++-- app/views/blogs/show.html.haml | 2 +- app/views/layouts/admin.html.haml | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 app/views/admin/blogs/drafts.html.haml (limited to 'app/views') 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) diff --git a/app/views/blogs/show.html.haml b/app/views/blogs/show.html.haml index c44d3f4..48c07dc 100644 --- a/app/views/blogs/show.html.haml +++ b/app/views/blogs/show.html.haml @@ -3,4 +3,4 @@ %footer#blog-footer This entry was posted on = succeed "." do - %time= @blog.created_at.strftime("%B #{@blog.created_at.day.ordinalize}, %Y at %-I:%M:%S%P") + %time= @blog.posted_at.strftime("%B #{@blog.posted_at.day.ordinalize}, %Y at %-I:%M:%S%P") diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 68bbd96..cb48c50 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -24,6 +24,7 @@ = link_to "Blogs", admin_blogs_url, class: "major-link" %ul.minors %li.minor= link_to "New blog", new_admin_blog_url + %li.minor= link_to "Drafts", drafts_admin_blogs_url %li{major_sidebar_attrs("streams")} = link_to "Streams", admin_streams_url, class: "major-link" %ul.minors -- cgit 1.4.1