From c650bee03937bd0e741e701f1fe0bfe5cf8e040e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 12 Aug 2018 07:10:16 -0400 Subject: Add link entry type --- app/views/admin/links/_form.html.haml | 26 ++++++++++++++++++++++++++ app/views/admin/links/edit.html.haml | 3 +++ app/views/admin/links/index.html.haml | 14 ++++++++++++++ app/views/admin/links/new.html.haml | 3 +++ 4 files changed, 46 insertions(+) create mode 100644 app/views/admin/links/_form.html.haml create mode 100644 app/views/admin/links/edit.html.haml create mode 100644 app/views/admin/links/index.html.haml create mode 100644 app/views/admin/links/new.html.haml (limited to 'app/views/admin/links') diff --git a/app/views/admin/links/_form.html.haml b/app/views/admin/links/_form.html.haml new file mode 100644 index 0000000..c624a3d --- /dev/null +++ b/app/views/admin/links/_form.html.haml @@ -0,0 +1,26 @@ +%fieldset#content + .title-field + = f.label :title + = f.text_field :title, placeholder: "Title" + .url-field + = f.label :url + = f.text_field :url, placeholder: "URL" +%fieldset#details + - if f.object.errors.any? + #errors.details-module + %h3 Error! + %ul + - f.object.errors.full_messages.each do |error| + %li= error + .details-module + .tags-field + = f.label :tag_list, "Tags" + = f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",") + .details-module + = f.fields_for :records, Record.new do |builder| + .should-create-record-field + = builder.check_box :_destroy, {checked: false}, "0", "1" + = builder.label :_destroy, "Create record?" + .record-description-field + = builder.text_area :description, placeholder: "record text" + .details-module= f.submit diff --git a/app/views/admin/links/edit.html.haml b/app/views/admin/links/edit.html.haml new file mode 100644 index 0000000..1c6c529 --- /dev/null +++ b/app/views/admin/links/edit.html.haml @@ -0,0 +1,3 @@ +- title "Editing #{@link.title}" += form_for @link, url: admin_link_url(@link), html: { id: "entry-form" } do |f| + = render partial: "form", locals: { f: f } diff --git a/app/views/admin/links/index.html.haml b/app/views/admin/links/index.html.haml new file mode 100644 index 0000000..e66d9b7 --- /dev/null +++ b/app/views/admin/links/index.html.haml @@ -0,0 +1,14 @@ +- title "Links" +%table#entries + %tr + %th Title + %th Date created + %th + - @links.each do |link| + %tr{ class: cycle("even", "odd") } + %td= link.title + %td= link.created_at.strftime("%B %d, %Y, %l:%M%P") + %td + %ul.admin-actions + %li= link_to "Edit", edit_admin_link_url(link) + %li= link_to "Show", link.url diff --git a/app/views/admin/links/new.html.haml b/app/views/admin/links/new.html.haml new file mode 100644 index 0000000..accdfd9 --- /dev/null +++ b/app/views/admin/links/new.html.haml @@ -0,0 +1,3 @@ +- title "New link" += form_for @link, url: admin_links_url, html: { id: "entry-form" } do |f| + = render partial: "form", locals: { f: f } -- cgit 1.4.1