From 20f2479b33bc548c4736cdc1ceffde6e3af3a31d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 21 Oct 2023 22:52:41 -0400 Subject: Added quote editing --- app/views/admin/quotes/_form.html.haml | 27 +++++++++++++++++++++++++++ app/views/admin/quotes/edit.html.haml | 3 +++ app/views/admin/quotes/index.html.haml | 1 + app/views/admin/quotes/pending.html.haml | 1 + 4 files changed, 32 insertions(+) create mode 100644 app/views/admin/quotes/_form.html.haml create mode 100644 app/views/admin/quotes/edit.html.haml (limited to 'app/views/admin/quotes') diff --git a/app/views/admin/quotes/_form.html.haml b/app/views/admin/quotes/_form.html.haml new file mode 100644 index 0000000..920835b --- /dev/null +++ b/app/views/admin/quotes/_form.html.haml @@ -0,0 +1,27 @@ +%fieldset#content + %h2 Quote ##{f.object.id} + .halfbody-field + = f.label :content + = f.text_area :content + %h3 Notes + .halfbody-field + = f.label :notes + = f.text_area :notes +%fieldset#details + - if f.object.errors.any? + #errors.details-module + %h3 Error! + %ul + - f.object.errors.full_messages.each do |error| + %li= error + - unless f.object.new_record? + #entry-preview-link.details-module= link_to "View quote", quote_url(f.object.id), target: "entry-preview" + .details-module + .tags-field + = f.label :tag_list, "Tags" + = f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",") + .details-module + .published-field + = f.label :state + = f.select :state, Quote.state.options + .details-module= f.submit diff --git a/app/views/admin/quotes/edit.html.haml b/app/views/admin/quotes/edit.html.haml new file mode 100644 index 0000000..47ff2d1 --- /dev/null +++ b/app/views/admin/quotes/edit.html.haml @@ -0,0 +1,3 @@ +- title "Editing Quote \##{@quote.id}" += form_for @quote, url: admin_quote_url(@quote.id), html: { id: "entry-form" } do |f| + = render partial: "form", locals: { f: f } diff --git a/app/views/admin/quotes/index.html.haml b/app/views/admin/quotes/index.html.haml index afe2c20..c1a4866 100644 --- a/app/views/admin/quotes/index.html.haml +++ b/app/views/admin/quotes/index.html.haml @@ -16,5 +16,6 @@ %td %ul.admin-actions %li= link_to "View", quote + %li= link_to "Edit", edit_admin_quote_url(quote) %li= link_to "Delete", admin_quote_url(quote), method: :delete, data: { confirm: "Are you sure?" } = will_paginate @quotes diff --git a/app/views/admin/quotes/pending.html.haml b/app/views/admin/quotes/pending.html.haml index 14d6cf8..ef52099 100644 --- a/app/views/admin/quotes/pending.html.haml +++ b/app/views/admin/quotes/pending.html.haml @@ -15,6 +15,7 @@ %td= quote.created_at.strftime("%B %d, %Y, %l:%M%P") %td %ul.admin-actions + %li= link_to "Edit", edit_admin_quote_url(quote) %li= link_to "Accept", accept_admin_quote_url(quote), method: :post, data: { confirm: "Are you sure you want to accept this quote?" } %li= link_to "Reject", admin_quote_url(quote), method: :delete, data: { confirm: "Are you sure you want to reject this quote?" } = will_paginate @quotes -- cgit 1.4.1