diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-02 13:03:43 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-02 13:03:43 -0400 |
commit | e47e83cf6bded3d1924b4d500193e7876833ef83 (patch) | |
tree | 058f011637e67455dcd8451fbfa784b5883c6f69 /app/views/admin/blogs | |
parent | 528ccde8915cd1ed7a39e137dd4d98869797956a (diff) | |
download | thoughts-e47e83cf6bded3d1924b4d500193e7876833ef83.tar.gz thoughts-e47e83cf6bded3d1924b4d500193e7876833ef83.tar.bz2 thoughts-e47e83cf6bded3d1924b4d500193e7876833ef83.zip |
Created admin panel
Currently allows you to create and edit blogs, including associated records. Uses a WYSIWYG editor that allows uploading images. Also included jQuery :(
Diffstat (limited to 'app/views/admin/blogs')
-rw-r--r-- | app/views/admin/blogs/_form.html.haml | 23 | ||||
-rw-r--r-- | app/views/admin/blogs/edit.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/blogs/index.html.haml | 10 | ||||
-rw-r--r-- | app/views/admin/blogs/new.html.haml | 2 |
4 files changed, 37 insertions, 0 deletions
diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml new file mode 100644 index 0000000..55a297a --- /dev/null +++ b/app/views/admin/blogs/_form.html.haml | |||
@@ -0,0 +1,23 @@ | |||
1 | - if f.object.errors.any? | ||
2 | %ul#errors | ||
3 | - f.object.errors.full_messages.each do |error| | ||
4 | %li= error | ||
5 | %fieldset#content | ||
6 | .title-field | ||
7 | = f.label :title | ||
8 | = f.text_field :title, placeholder: "Title" | ||
9 | .slug-field | ||
10 | = f.label :slug, "https://feffernoo.se/says/" | ||
11 | = f.text_field :slug, placeholder: "insert-slug-here" | ||
12 | .body-field | ||
13 | = f.label :body | ||
14 | = f.cktext_area :body | ||
15 | %fieldset#details | ||
16 | .details-module | ||
17 | = f.fields_for :records, Record.new do |builder| | ||
18 | .should-create-record-field | ||
19 | = builder.check_box :_destroy, {checked: false}, "0", "1" | ||
20 | = builder.label :_destroy, "Create record?" | ||
21 | .record-description-field | ||
22 | = builder.text_area :description, placeholder: "record text" | ||
23 | .details-module= f.submit | ||
diff --git a/app/views/admin/blogs/edit.html.haml b/app/views/admin/blogs/edit.html.haml new file mode 100644 index 0000000..3f4d412 --- /dev/null +++ b/app/views/admin/blogs/edit.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | = form_for @blog, url: admin_blog_url(@blog), html: { id: "blog-form" } do |f| | ||
2 | = render partial: "form", locals: { f: f } | ||
diff --git a/app/views/admin/blogs/index.html.haml b/app/views/admin/blogs/index.html.haml new file mode 100644 index 0000000..448617a --- /dev/null +++ b/app/views/admin/blogs/index.html.haml | |||
@@ -0,0 +1,10 @@ | |||
1 | %table#entries | ||
2 | %tr | ||
3 | %th Title | ||
4 | %th Date created | ||
5 | %th | ||
6 | - @blogs.each do |blog| | ||
7 | %tr{ class: cycle("even", "odd") } | ||
8 | %td= blog.title | ||
9 | %td= blog.created_at.strftime("%B %d, %Y, %l:%M%P") | ||
10 | %td= link_to "Edit", edit_admin_blog_url(blog) | ||
diff --git a/app/views/admin/blogs/new.html.haml b/app/views/admin/blogs/new.html.haml new file mode 100644 index 0000000..914f27b --- /dev/null +++ b/app/views/admin/blogs/new.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | = form_for @blog, url: admin_blogs_url, html: { id: "blog-form" } do |f| | ||
2 | = render partial: "form", locals: { f: f } | ||