added parties
This commit is contained in:
42
app/views/parties/_form.html.erb
Normal file
42
app/views/parties/_form.html.erb
Normal file
@ -0,0 +1,42 @@
|
||||
<%= form_with(model: party, class: "contents") do |form| %>
|
||||
<% if party.errors.any? %>
|
||||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-md mt-3">
|
||||
<h2><%= pluralize(party.errors.count, "error") %> prohibited this party from being saved:</h2>
|
||||
|
||||
<ul class="list-disc ml-6">
|
||||
<% party.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :title %>
|
||||
<%= form.text_field :title, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": party.errors[:title].none?, "border-red-400 focus:outline-red-600": party.errors[:title].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :location %>
|
||||
<%= form.text_field :location, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": party.errors[:location].none?, "border-red-400 focus:outline-red-600": party.errors[:location].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :start_date %>
|
||||
<%= form.date_field :start_date, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": party.errors[:start_date].none?, "border-red-400 focus:outline-red-600": party.errors[:start_date].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :start_time %>
|
||||
<%= form.time_field :start_time, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": party.errors[:start_time].none?, "border-red-400 focus:outline-red-600": party.errors[:start_time].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :status %>
|
||||
<%= form.text_field :status, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": party.errors[:status].none?, "border-red-400 focus:outline-red-600": party.errors[:status].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
||||
</div>
|
||||
<% end %>
|
||||
22
app/views/parties/_party.html.erb
Normal file
22
app/views/parties/_party.html.erb
Normal file
@ -0,0 +1,22 @@
|
||||
<div id="<%= dom_id party %>" class="w-full sm:w-auto my-5 space-y-5">
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Title:</strong>
|
||||
<%= party.title %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Location:</strong>
|
||||
<%= party.location %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Start date:</strong>
|
||||
<%= party.start_date %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Start time:</strong>
|
||||
<%= party.start_time %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Status:</strong>
|
||||
<%= party.status %>
|
||||
</div>
|
||||
</div>
|
||||
10
app/views/parties/edit.html.erb
Normal file
10
app/views/parties/edit.html.erb
Normal file
@ -0,0 +1,10 @@
|
||||
<% content_for :title, "Editing party" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">Editing party</h1>
|
||||
|
||||
<%= render "form", party: @party %>
|
||||
|
||||
<%= link_to "Show this party", @party, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Back to parties", parties_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
</div>
|
||||
29
app/views/parties/index.html.erb
Normal file
29
app/views/parties/index.html.erb
Normal file
@ -0,0 +1,29 @@
|
||||
<% content_for :title, "Parties" %>
|
||||
|
||||
<div class="w-full">
|
||||
<% if notice.present? %>
|
||||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<div class="flex justify-between items-center">
|
||||
<h1 class="font-bold text-4xl">Parties</h1>
|
||||
<%= link_to "New party", new_party_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %>
|
||||
</div>
|
||||
|
||||
<div id="parties" class="min-w-full divide-y divide-gray-200 space-y-5">
|
||||
<% if @parties.any? %>
|
||||
<% @parties.each do |party| %>
|
||||
<div class="flex flex-col sm:flex-row justify-between items-center pb-5 sm:pb-0">
|
||||
<%= render party %>
|
||||
<div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
|
||||
<%= link_to "Show", party, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Edit", edit_party_path(party), class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= button_to "Destroy", party, method: :delete, class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="text-center my-10">No parties found.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
9
app/views/parties/new.html.erb
Normal file
9
app/views/parties/new.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<% content_for :title, "New party" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">New party</h1>
|
||||
|
||||
<%= render "form", party: @party %>
|
||||
|
||||
<%= link_to "Back to parties", parties_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
</div>
|
||||
15
app/views/parties/show.html.erb
Normal file
15
app/views/parties/show.html.erb
Normal file
@ -0,0 +1,15 @@
|
||||
<% content_for :title, "Showing party" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<% if notice.present? %>
|
||||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<h1 class="font-bold text-4xl">Showing party</h1>
|
||||
|
||||
<%= render @party %>
|
||||
|
||||
<%= link_to "Edit this party", edit_party_path(@party), class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Back to parties", parties_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= button_to "Destroy this party", @party, method: :delete, form_class: "sm:inline-block mt-2 sm:mt-0 sm:ml-2", class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user