aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-11 16:33:24 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-11 16:33:24 +0000
commitb8d7a7cf7e78fe384c6c6e8e6812a252084ce1f0 (patch)
tree5ef297ac23775afb1bcffb68265749d08f282297 /app/views
parent97201e0bca203b6b303789374ffd7e4228e062a7 (diff)
Adds first pdfresource model
Diffstat (limited to 'app/views')
-rw-r--r--app/views/pdfresources/_form.html.erb67
-rw-r--r--app/views/pdfresources/_pdfresource.html.erb56
-rw-r--r--app/views/pdfresources/_pdfresource.json.jbuilder14
-rw-r--r--app/views/pdfresources/edit.html.erb8
-rw-r--r--app/views/pdfresources/index.html.erb21
-rw-r--r--app/views/pdfresources/index.json.jbuilder1
-rw-r--r--app/views/pdfresources/new.html.erb7
-rw-r--r--app/views/pdfresources/show.html.erb15
-rw-r--r--app/views/pdfresources/show.json.jbuilder1
9 files changed, 190 insertions, 0 deletions
diff --git a/app/views/pdfresources/_form.html.erb b/app/views/pdfresources/_form.html.erb
new file mode 100644
index 0000000..a75121a
--- /dev/null
+++ b/app/views/pdfresources/_form.html.erb
@@ -0,0 +1,67 @@
+<%= form_with(model: pdfresource, class: "contents") do |form| %>
+ <% if pdfresource.errors.any? %>
+ <div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
+ <h2><%= pluralize(pdfresource.errors.count, "error") %> prohibited this pdfresource from being saved:</h2>
+
+ <ul>
+ <% pdfresource.errors.each do |error| %>
+ <li><%= error.full_message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="my-5">
+ <%= form.label :name %>
+ <%= form.text_field :name, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :stripe_product_id %>
+ <%= form.text_field :stripe_product_id, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :pdfs %>
+ <%= form.file_field :pdfs, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :thumbnails %>
+ <%= form.file_field :thumbnails, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :price %>
+ <%= form.text_field :price, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :age_range %>
+ <%= form.text_field :age_range, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :curriculum %>
+ <%= form.text_field :curriculum, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :feature_slot %>
+ <%= form.number_field :feature_slot, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :description %>
+ <%= form.textarea :description, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :card_description %>
+ <%= form.textarea :card_description, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="inline">
+ <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ </div>
+<% end %>
diff --git a/app/views/pdfresources/_pdfresource.html.erb b/app/views/pdfresources/_pdfresource.html.erb
new file mode 100644
index 0000000..d947dd1
--- /dev/null
+++ b/app/views/pdfresources/_pdfresource.html.erb
@@ -0,0 +1,56 @@
+<div id="<%= dom_id pdfresource %>">
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Name:</strong>
+ <%= pdfresource.name %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Stripe product:</strong>
+ <%= pdfresource.stripe_product_id %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Pdfs:</strong>
+ <% pdfresource.pdfs.each do |pdf| %>
+ <div><%= link_to pdf.filename, pdf %></div>
+ <% end %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Thumbnails:</strong>
+ <% pdfresource.thumbnails.each do |thumbnail| %>
+ <div><%= link_to thumbnail.filename, thumbnail %></div>
+ <% end %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Price:</strong>
+ <%= pdfresource.price %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Age range:</strong>
+ <%= pdfresource.age_range %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Curriculum:</strong>
+ <%= pdfresource.curriculum %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Feature slot:</strong>
+ <%= pdfresource.feature_slot %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Description:</strong>
+ <%= pdfresource.description %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Card description:</strong>
+ <%= pdfresource.card_description %>
+ </p>
+
+</div>
diff --git a/app/views/pdfresources/_pdfresource.json.jbuilder b/app/views/pdfresources/_pdfresource.json.jbuilder
new file mode 100644
index 0000000..6bb63a6
--- /dev/null
+++ b/app/views/pdfresources/_pdfresource.json.jbuilder
@@ -0,0 +1,14 @@
+json.extract! pdfresource, :id, :name, :stripe_product_id, :pdfs, :thumbnails, :price, :age_range, :curriculum, :feature_slot, :description, :card_description, :created_at, :updated_at
+json.url pdfresource_url(pdfresource, format: :json)
+json.pdfs do
+ json.array!(pdfresource.pdfs) do |pdf|
+ json.id pdf.id
+ json.url url_for(pdf)
+ end
+end
+json.thumbnails do
+ json.array!(pdfresource.thumbnails) do |thumbnail|
+ json.id thumbnail.id
+ json.url url_for(thumbnail)
+ end
+end
diff --git a/app/views/pdfresources/edit.html.erb b/app/views/pdfresources/edit.html.erb
new file mode 100644
index 0000000..6738cf1
--- /dev/null
+++ b/app/views/pdfresources/edit.html.erb
@@ -0,0 +1,8 @@
+<div class="mx-auto md:w-2/3 w-full">
+ <h1 class="font-bold text-4xl">Editing pdfresource</h1>
+
+ <%= render "form", pdfresource: @pdfresource %>
+
+ <%= link_to "Show this pdfresource", @pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+</div>
diff --git a/app/views/pdfresources/index.html.erb b/app/views/pdfresources/index.html.erb
new file mode 100644
index 0000000..ff29982
--- /dev/null
+++ b/app/views/pdfresources/index.html.erb
@@ -0,0 +1,21 @@
+<div class="w-full">
+ <% if notice.present? %>
+ <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
+ <% end %>
+
+ <% content_for :title, "Pdfresources" %>
+
+ <div class="flex justify-between items-center">
+ <h1 class="font-bold text-4xl">Pdfresources</h1>
+ <%= link_to "New pdfresource", new_pdfresource_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
+ </div>
+
+ <div id="pdfresources" class="min-w-full">
+ <% @pdfresources.each do |pdfresource| %>
+ <%= render pdfresource %>
+ <p>
+ <%= link_to "Show this pdfresource", pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ </p>
+ <% end %>
+ </div>
+</div>
diff --git a/app/views/pdfresources/index.json.jbuilder b/app/views/pdfresources/index.json.jbuilder
new file mode 100644
index 0000000..945d359
--- /dev/null
+++ b/app/views/pdfresources/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @pdfresources, partial: "pdfresources/pdfresource", as: :pdfresource
diff --git a/app/views/pdfresources/new.html.erb b/app/views/pdfresources/new.html.erb
new file mode 100644
index 0000000..5bd072b
--- /dev/null
+++ b/app/views/pdfresources/new.html.erb
@@ -0,0 +1,7 @@
+<div class="mx-auto md:w-2/3 w-full">
+ <h1 class="font-bold text-4xl">New pdfresource</h1>
+
+ <%= render "form", pdfresource: @pdfresource %>
+
+ <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+</div>
diff --git a/app/views/pdfresources/show.html.erb b/app/views/pdfresources/show.html.erb
new file mode 100644
index 0000000..3c4fe66
--- /dev/null
+++ b/app/views/pdfresources/show.html.erb
@@ -0,0 +1,15 @@
+<div class="mx-auto md:w-2/3 w-full flex">
+ <div class="mx-auto">
+ <% if notice.present? %>
+ <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
+ <% end %>
+
+ <%= render @pdfresource %>
+
+ <%= link_to "Edit this pdfresource", edit_pdfresource_path(@pdfresource), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <div class="inline-block ml-2">
+ <%= button_to "Destroy this pdfresource", @pdfresource, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
+ </div>
+ </div>
+</div>
diff --git a/app/views/pdfresources/show.json.jbuilder b/app/views/pdfresources/show.json.jbuilder
new file mode 100644
index 0000000..492dde3
--- /dev/null
+++ b/app/views/pdfresources/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "pdfresources/pdfresource", pdfresource: @pdfresource