starting with events, tied to profiles (not accounts)
This commit is contained in:
14
app/views/events/_form.html.haml
Normal file
14
app/views/events/_form.html.haml
Normal file
@ -0,0 +1,14 @@
|
||||
= simple_form_for @event do |f|
|
||||
= f.error_notification
|
||||
|
||||
= f.input :name
|
||||
= f.input :text
|
||||
.grid.grid-cols-2.gap-10
|
||||
= f.input :start_date
|
||||
= f.input :end_date
|
||||
= f.input :profile_id , as: :hidden
|
||||
= f.input :picture , as: :file
|
||||
%button.mt-6.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
= f.submit 'Save'
|
||||
%button.ml-20.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
= link_to 'Back', @story
|
6
app/views/events/edit.html.haml
Normal file
6
app/views/events/edit.html.haml
Normal file
@ -0,0 +1,6 @@
|
||||
.flex.justify-center
|
||||
.column
|
||||
.text-xl.m-4
|
||||
Editing event
|
||||
|
||||
= render 'form'
|
31
app/views/events/index.html.haml
Normal file
31
app/views/events/index.html.haml
Normal file
@ -0,0 +1,31 @@
|
||||
%h1 Listing events
|
||||
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Text
|
||||
%th Start date
|
||||
%th End date
|
||||
%th Profile
|
||||
%th Picture
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
|
||||
%tbody
|
||||
- @events.each do |event|
|
||||
%tr
|
||||
%td= event.name
|
||||
%td= event.text
|
||||
%td= event.start_date
|
||||
%td= event.end_date
|
||||
%td= event.profile
|
||||
%td= event.picture
|
||||
%td= link_to 'Show', event
|
||||
%td= link_to 'Edit', edit_event_path(event)
|
||||
%td= link_to 'Destroy', event, method: :delete, data: { confirm: 'Are you sure?' }
|
||||
|
||||
%br
|
||||
|
||||
= link_to 'New Event', new_event_path
|
6
app/views/events/new.html.haml
Normal file
6
app/views/events/new.html.haml
Normal file
@ -0,0 +1,6 @@
|
||||
.flex.justify-center
|
||||
.column
|
||||
.text-xl.m-4
|
||||
New event
|
||||
|
||||
= render 'form'
|
24
app/views/events/show.html.haml
Normal file
24
app/views/events/show.html.haml
Normal file
@ -0,0 +1,24 @@
|
||||
%p#notice= notice
|
||||
|
||||
%p
|
||||
%b Name:
|
||||
= @event.name
|
||||
%p
|
||||
%b Text:
|
||||
= @event.text
|
||||
%p
|
||||
%b Start date:
|
||||
= @event.start_date
|
||||
%p
|
||||
%b End date:
|
||||
= @event.end_date
|
||||
%p
|
||||
%b Profile:
|
||||
= @event.profile
|
||||
%p
|
||||
%b Picture:
|
||||
= @event.picture
|
||||
|
||||
= link_to 'Edit', edit_event_path(@event)
|
||||
\|
|
||||
= link_to 'Back', events_path
|
@ -1,11 +1,5 @@
|
||||
= form_for @member do |f|
|
||||
.flex.flex-col
|
||||
- if @member.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@member.errors.count, "error")} prohibited this member from being saved:"
|
||||
%ul
|
||||
- @member.errors.full_messages.each do |message|
|
||||
%li= message
|
||||
= simple_form_for @member do |f|
|
||||
= f.error_notification
|
||||
|
||||
.grid.grid-cols-2.m-20.gap-10
|
||||
.field
|
||||
|
@ -13,7 +13,7 @@
|
||||
.grid.grid-cols-2.mx-20
|
||||
.first
|
||||
- Profile.types.each do |kind|
|
||||
.grid.grid-cols-2
|
||||
.grid.grid-cols-3
|
||||
- if profile = @member.profile(kind)
|
||||
%div
|
||||
=profile.Kind
|
||||
@ -23,12 +23,17 @@
|
||||
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
Edit
|
||||
=profile.Kind
|
||||
|
||||
= link_to new_event_path(profile: profile.kind) do
|
||||
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
New #{profile.Kind} Event
|
||||
-else
|
||||
%div Create new #{kind.capitalize} profile as
|
||||
= link_to new_profile_path(kind: kind) do
|
||||
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
New
|
||||
= kind.capitalize
|
||||
%div Create profile first, then events
|
||||
|
||||
|
||||
.grid.grid-cols-6.gap-4.mt-10.mx-10
|
||||
|
Reference in New Issue
Block a user