about summary refs log tree commit diff stats
path: root/app/views/admin/links
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-08-12 07:10:16 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-08-12 07:10:16 -0400
commitc650bee03937bd0e741e701f1fe0bfe5cf8e040e (patch)
treec0020572ceef21498da9b52851242b22dba7aafe /app/views/admin/links
parent77e849b66719f5e86762eff4ae23340dab1b32fa (diff)
downloadthoughts-c650bee03937bd0e741e701f1fe0bfe5cf8e040e.tar.gz
thoughts-c650bee03937bd0e741e701f1fe0bfe5cf8e040e.tar.bz2
thoughts-c650bee03937bd0e741e701f1fe0bfe5cf8e040e.zip
Add link entry type
Diffstat (limited to 'app/views/admin/links')
-rw-r--r--app/views/admin/links/_form.html.haml26
-rw-r--r--app/views/admin/links/edit.html.haml3
-rw-r--r--app/views/admin/links/index.html.haml14
-rw-r--r--app/views/admin/links/new.html.haml3
4 files changed, 46 insertions, 0 deletions
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 @@
1%fieldset#content
2 .title-field
3 = f.label :title
4 = f.text_field :title, placeholder: "Title"
5 .url-field
6 = f.label :url
7 = f.text_field :url, placeholder: "URL"
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 .tags-field
17 = f.label :tag_list, "Tags"
18 = f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",")
19 .details-module
20 = f.fields_for :records, Record.new do |builder|
21 .should-create-record-field
22 = builder.check_box :_destroy, {checked: false}, "0", "1"
23 = builder.label :_destroy, "Create record?"
24 .record-description-field
25 = builder.text_area :description, placeholder: "record text"
26 .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 @@
1- title "Editing #{@link.title}"
2= form_for @link, url: admin_link_url(@link), html: { id: "entry-form" } do |f|
3 = 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 @@
1- title "Links"
2%table#entries
3 %tr
4 %th Title
5 %th Date created
6 %th
7 - @links.each do |link|
8 %tr{ class: cycle("even", "odd") }
9 %td= link.title
10 %td= link.created_at.strftime("%B %d, %Y, %l:%M%P")
11 %td
12 %ul.admin-actions
13 %li= link_to "Edit", edit_admin_link_url(link)
14 %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 @@
1- title "New link"
2= form_for @link, url: admin_links_url, html: { id: "entry-form" } do |f|
3 = render partial: "form", locals: { f: f }