about summary refs log tree commit diff stats
path: root/app/assets
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-07-04 10:42:21 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-07-04 10:42:21 -0400
commitd48adb741c5c30ba3f2d3c039a7e342b43add352 (patch)
treecbc25ac929e73702142a5ec5728a98dc54d88602 /app/assets
parent66353403efcc9c0b16c82ea8ab9860ca8a44aa4c (diff)
downloadthoughts-d48adb741c5c30ba3f2d3c039a7e342b43add352.tar.gz
thoughts-d48adb741c5c30ba3f2d3c039a7e342b43add352.tar.bz2
thoughts-d48adb741c5c30ba3f2d3c039a7e342b43add352.zip
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
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/admin/records.coffee24
-rw-r--r--app/assets/stylesheets/admin/layout.scss6
2 files changed, 26 insertions, 4 deletions
diff --git a/app/assets/javascripts/admin/records.coffee b/app/assets/javascripts/admin/records.coffee index 69cd471..3a1ed51 100644 --- a/app/assets/javascripts/admin/records.coffee +++ b/app/assets/javascripts/admin/records.coffee
@@ -1,9 +1,25 @@
1# Place all the behaviors and hooks related to the matching controller here. 1# Place all the behaviors and hooks related to the matching controller here.
2# All this logic will automatically be available in application.js. 2# All this logic will automatically be available in application.js.
3# You can use CoffeeScript in this file: http://coffeescript.org/ 3# You can use CoffeeScript in this file: http://coffeescript.org/
4
5create_record_toggle = (checked) ->
6 if checked
7 $(".record-description-field").show()
8 else
9 $(".record-description-field").hide()
10
11published_field_toggle = (checked) ->
12 if checked
13 $(".should-create-record-field input[type=checkbox]").prop("disabled", false)
14 else
15 $(".should-create-record-field input[type=checkbox]").prop("disabled", true)
16 $(".should-create-record-field input[type=checkbox]").prop("checked", false)
17 create_record_toggle(false)
18
4$(document).on "turbolinks:load", -> 19$(document).on "turbolinks:load", ->
20 if $(".published-field").length > 0
21 published_field_toggle($(".published-field input[type=checkbox]").prop("checked"))
5 $(".should-create-record-field input[type=checkbox]").change -> 22 $(".should-create-record-field input[type=checkbox]").change ->
6 if $(".should-create-record-field input[type=checkbox]").prop("checked") 23 create_record_toggle($(this).prop("checked"))
7 $(".record-description-field").show() 24 $(".published-field input[type=checkbox]").change ->
8 else 25 published_field_toggle($(this).prop("checked"))
9 $(".record-description-field").hide()
diff --git a/app/assets/stylesheets/admin/layout.scss b/app/assets/stylesheets/admin/layout.scss index 6645709..f68cf6a 100644 --- a/app/assets/stylesheets/admin/layout.scss +++ b/app/assets/stylesheets/admin/layout.scss
@@ -190,6 +190,12 @@ body {
190 } 190 }
191} 191}
192 192
193.published-field {
194 label {
195 font-size: .75em;
196 }
197}
198
193.record-description-field { 199.record-description-field {
194 display: none; 200 display: none;
195 margin-top: 1em; 201 margin-top: 1em;