about summary refs log tree commit diff stats
path: root/app/views
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-07-02 13:03:43 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-07-02 13:03:43 -0400
commite47e83cf6bded3d1924b4d500193e7876833ef83 (patch)
tree058f011637e67455dcd8451fbfa784b5883c6f69 /app/views
parent528ccde8915cd1ed7a39e137dd4d98869797956a (diff)
downloadthoughts-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')
-rw-r--r--app/views/admin/blogs/_form.html.haml23
-rw-r--r--app/views/admin/blogs/edit.html.haml2
-rw-r--r--app/views/admin/blogs/index.html.haml10
-rw-r--r--app/views/admin/blogs/new.html.haml2
-rw-r--r--app/views/admin/dashboard/index.html.haml1
-rw-r--r--app/views/entries/edit.html.haml11
-rw-r--r--app/views/layouts/admin.html.haml27
-rw-r--r--app/views/layouts/application.html.haml1
8 files changed, 66 insertions, 11 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 }
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml new file mode 100644 index 0000000..eaac627 --- /dev/null +++ b/app/views/admin/dashboard/index.html.haml
@@ -0,0 +1 @@
Welcome to the the ubiquitous administration panel!
diff --git a/app/views/entries/edit.html.haml b/app/views/entries/edit.html.haml deleted file mode 100644 index 1872366..0000000 --- a/app/views/entries/edit.html.haml +++ /dev/null
@@ -1,11 +0,0 @@
1= form_for @entry, url: @entry.path do |f|
2 .field
3 = f.label :title
4 = f.text_field :title
5 .field
6 = f.label :body
7 = f.text_area :body
8 .field
9 = f.label :slug
10 = f.text_field :slug
11 = f.submit
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml new file mode 100644 index 0000000..a2c2d95 --- /dev/null +++ b/app/views/layouts/admin.html.haml
@@ -0,0 +1,27 @@
1!!! 5
2%html
3 %head
4 %title Thoughts - Admin
5 = csrf_meta_tags
6 = stylesheet_link_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload'
7 = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
8 %body
9 #banner= link_to "Thoughts", root_url
10 #container
11 %ul#sidebar
12 %li{major_sidebar_attrs("dashboard")}
13 = link_to "Dashboard", admin_url, class: "major-link"
14 %li{major_sidebar_attrs("blogs")}
15 = link_to "Blogs", admin_blogs_url, class: "major-link"
16 %ul.minors
17 %li.minor= link_to "New blog", new_admin_blog_url
18 #main
19 - if flash[:alert]
20 #flash.flash-alert
21 %span.flash-tag ERROR:
22 = flash.alert
23 - if flash[:notice]
24 #flash.flash-notice
25 %span.flash-tag NOTICE:
26 = flash.notice
27 = yield
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 2a9e2eb..5148df4 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml
@@ -21,6 +21,7 @@
21 - if not user_signed_in? 21 - if not user_signed_in?
22 %li= link_to "Log in", new_user_session_path 22 %li= link_to "Log in", new_user_session_path
23 - if user_signed_in? 23 - if user_signed_in?
24 %li= link_to "Admin", admin_url
24 %li= link_to "Log out", destroy_user_session_path, method: :delete 25 %li= link_to "Log out", destroy_user_session_path, method: :delete
25 #main 26 #main
26 %header#banner= link_to "feffernoo.se", root_url 27 %header#banner= link_to "feffernoo.se", root_url