diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-03 13:58:57 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-03 14:01:41 -0400 |
commit | 8e15dbd73035c2a2198a2828a20ddcebe0739823 (patch) | |
tree | f93ada8d2c3c06e8cf1908bf5b0e22b1b54dd956 /app/views | |
parent | 49b11f2864f75bcfb8d0d01439939ed68aa90b8f (diff) | |
download | thoughts-8e15dbd73035c2a2198a2828a20ddcebe0739823.tar.gz thoughts-8e15dbd73035c2a2198a2828a20ddcebe0739823.tar.bz2 thoughts-8e15dbd73035c2a2198a2828a20ddcebe0739823.zip |
Implemented streams
Currently there are no links to the pages for editing stream updates, and the admin panel for managing streams could probably have a better look & feel, but here's some basic working functionality. refs #8
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin/blogs/edit.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/blogs/new.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/streams/_form.html.haml | 25 | ||||
-rw-r--r-- | app/views/admin/streams/edit.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/streams/index.html.haml | 13 | ||||
-rw-r--r-- | app/views/admin/streams/new.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/updates/_form.html.haml | 22 | ||||
-rw-r--r-- | app/views/admin/updates/edit.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/updates/new.html.haml | 2 | ||||
-rw-r--r-- | app/views/blogs/_blog.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/admin.html.haml | 4 | ||||
-rw-r--r-- | app/views/streams/_stream.html.haml | 6 | ||||
-rw-r--r-- | app/views/streams/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/updates/_update.html.haml | 3 |
14 files changed, 86 insertions, 3 deletions
diff --git a/app/views/admin/blogs/edit.html.haml b/app/views/admin/blogs/edit.html.haml index 3f4d412..f356069 100644 --- a/app/views/admin/blogs/edit.html.haml +++ b/app/views/admin/blogs/edit.html.haml | |||
@@ -1,2 +1,2 @@ | |||
1 | = form_for @blog, url: admin_blog_url(@blog), html: { id: "blog-form" } do |f| | 1 | = form_for @blog, url: admin_blog_url(@blog), html: { id: "entry-form" } do |f| |
2 | = render partial: "form", locals: { f: f } | 2 | = render partial: "form", locals: { f: f } |
diff --git a/app/views/admin/blogs/new.html.haml b/app/views/admin/blogs/new.html.haml index 914f27b..0005278 100644 --- a/app/views/admin/blogs/new.html.haml +++ b/app/views/admin/blogs/new.html.haml | |||
@@ -1,2 +1,2 @@ | |||
1 | = form_for @blog, url: admin_blogs_url, html: { id: "blog-form" } do |f| | 1 | = form_for @blog, url: admin_blogs_url, html: { id: "entry-form" } do |f| |
2 | = render partial: "form", locals: { f: f } | 2 | = render partial: "form", locals: { f: f } |
diff --git a/app/views/admin/streams/_form.html.haml b/app/views/admin/streams/_form.html.haml new file mode 100644 index 0000000..ce457cb --- /dev/null +++ b/app/views/admin/streams/_form.html.haml | |||
@@ -0,0 +1,25 @@ | |||
1 | %fieldset#content | ||
2 | .title-field | ||
3 | = f.label :title | ||
4 | = f.text_field :title, placeholder: "Title" | ||
5 | .slug-field | ||
6 | = f.label :slug, "https://feffernoo.se/thinks/" | ||
7 | = f.text_field :slug, placeholder: "insert-slug-here" | ||
8 | .body-field | ||
9 | = f.label :body | ||
10 | = f.cktext_area :body | ||
11 | %fieldset#details | ||
12 | - if f.object.errors.any? | ||
13 | #errors.details-module | ||
14 | %h3 Error! | ||
15 | %ul | ||
16 | - f.object.errors.full_messages.each do |error| | ||
17 | %li= error | ||
18 | .details-module | ||
19 | = f.fields_for :records, Record.new do |builder| | ||
20 | .should-create-record-field | ||
21 | = builder.check_box :_destroy, {checked: false}, "0", "1" | ||
22 | = builder.label :_destroy, "Create record?" | ||
23 | .record-description-field | ||
24 | = builder.text_area :description, placeholder: "record text" | ||
25 | .details-module= f.submit | ||
diff --git a/app/views/admin/streams/edit.html.haml b/app/views/admin/streams/edit.html.haml new file mode 100644 index 0000000..1b58331 --- /dev/null +++ b/app/views/admin/streams/edit.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | = form_for @stream, url: admin_stream_url(@stream), html: { id: "entry-form" } do |f| | ||
2 | = render partial: "form", locals: { f: f } | ||
diff --git a/app/views/admin/streams/index.html.haml b/app/views/admin/streams/index.html.haml new file mode 100644 index 0000000..c69c6f9 --- /dev/null +++ b/app/views/admin/streams/index.html.haml | |||
@@ -0,0 +1,13 @@ | |||
1 | %table#entries | ||
2 | %tr | ||
3 | %th Title | ||
4 | %th Date created | ||
5 | %th | ||
6 | - @streams.each do |stream| | ||
7 | %tr{ class: cycle("even", "odd") } | ||
8 | %td= stream.title | ||
9 | %td= stream.created_at.strftime("%B %d, %Y, %l:%M%P") | ||
10 | %td | ||
11 | %ul.admin-actions | ||
12 | %li= link_to "Edit", edit_admin_stream_url(stream) | ||
13 | %li= link_to "Add Update", new_admin_stream_update_url(stream) | ||
diff --git a/app/views/admin/streams/new.html.haml b/app/views/admin/streams/new.html.haml new file mode 100644 index 0000000..52febf5 --- /dev/null +++ b/app/views/admin/streams/new.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | = form_for @stream, url: admin_streams_url, html: { id: "entry-form" } do |f| | ||
2 | = render partial: "form", locals: { f: f } | ||
diff --git a/app/views/admin/updates/_form.html.haml b/app/views/admin/updates/_form.html.haml new file mode 100644 index 0000000..9dd8741 --- /dev/null +++ b/app/views/admin/updates/_form.html.haml | |||
@@ -0,0 +1,22 @@ | |||
1 | %fieldset#content | ||
2 | .title-field | ||
3 | = f.label :title | ||
4 | = f.text_field :title, value: @stream.title, readonly: true | ||
5 | .body-field | ||
6 | = f.label :body | ||
7 | = f.cktext_area :body | ||
8 | %fieldset#details | ||
9 | - if f.object.errors.any? | ||
10 | #errors.details-module | ||
11 | %h3 Error! | ||
12 | %ul | ||
13 | - f.object.errors.full_messages.each do |error| | ||
14 | %li= error | ||
15 | .details-module | ||
16 | = f.fields_for :records, Record.new do |builder| | ||
17 | .should-create-record-field | ||
18 | = builder.check_box :_destroy, {checked: false}, "0", "1" | ||
19 | = builder.label :_destroy, "Create record?" | ||
20 | .record-description-field | ||
21 | = builder.text_area :description, placeholder: "record text" | ||
22 | .details-module= f.submit | ||
diff --git a/app/views/admin/updates/edit.html.haml b/app/views/admin/updates/edit.html.haml new file mode 100644 index 0000000..5651d23 --- /dev/null +++ b/app/views/admin/updates/edit.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | = form_for @update, url: admin_stream_update_url(@stream, @update), html: { id: "entry-form" } do |f| | ||
2 | = render partial: "form", locals: { f: f } | ||
diff --git a/app/views/admin/updates/new.html.haml b/app/views/admin/updates/new.html.haml new file mode 100644 index 0000000..14c6d77 --- /dev/null +++ b/app/views/admin/updates/new.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | = form_for @update, url: admin_stream_updates_url(@stream), html: { id: "entry-form" } do |f| | ||
2 | = render partial: "form", locals: { f: f } | ||
diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index e83d21a..91b1d20 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml | |||
@@ -1,3 +1,3 @@ | |||
1 | %article#blog-post | 1 | %article#blog-post |
2 | %h2#blog-title= blog.title | 2 | %h2#blog-title= blog.title |
3 | %section#blog-content= blog.body.html_safe | 3 | %section#blog-content.entry-content= blog.body.html_safe |
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 7f8c171..68bbd96 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml | |||
@@ -24,5 +24,9 @@ | |||
24 | = link_to "Blogs", admin_blogs_url, class: "major-link" | 24 | = link_to "Blogs", admin_blogs_url, class: "major-link" |
25 | %ul.minors | 25 | %ul.minors |
26 | %li.minor= link_to "New blog", new_admin_blog_url | 26 | %li.minor= link_to "New blog", new_admin_blog_url |
27 | %li{major_sidebar_attrs("streams")} | ||
28 | = link_to "Streams", admin_streams_url, class: "major-link" | ||
29 | %ul.minors | ||
30 | %li.minor= link_to "New stream", new_admin_stream_url | ||
27 | #main | 31 | #main |
28 | = yield | 32 | = yield |
diff --git a/app/views/streams/_stream.html.haml b/app/views/streams/_stream.html.haml new file mode 100644 index 0000000..84a6478 --- /dev/null +++ b/app/views/streams/_stream.html.haml | |||
@@ -0,0 +1,6 @@ | |||
1 | %article#stream-post | ||
2 | %h2#stream-title= stream.title | ||
3 | - unless stream.body.blank? | ||
4 | %header#stream-intro.entry-content= stream.body.html_safe | ||
5 | - unless stream.updates.empty? | ||
6 | = render stream.updates | ||
diff --git a/app/views/streams/show.html.haml b/app/views/streams/show.html.haml new file mode 100644 index 0000000..dcec0a2 --- /dev/null +++ b/app/views/streams/show.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | .breadcrumb= link_to "← Back to home page", root_path | ||
2 | = render @stream | ||
diff --git a/app/views/updates/_update.html.haml b/app/views/updates/_update.html.haml new file mode 100644 index 0000000..c8ce224 --- /dev/null +++ b/app/views/updates/_update.html.haml | |||
@@ -0,0 +1,3 @@ | |||
1 | %section.stream-update.entry-content{ id: "update-#{update.id}" } | ||
2 | %time.update-posted= update.created_at.strftime("%b #{update.created_at.day.ordinalize} %Y at %-I:%M:%S%P") | ||
3 | = update.body.html_safe | ||