|
1 | 1 | <%= form_with(model: [:admin, event]) do |form| %> |
2 | 2 | <% if event.errors.any? %> |
3 | | - <div style="color: red"> |
4 | | - <h2><%= pluralize(event.errors.count, "error") %> |
5 | | - prohibited this event from being saved:</h2> |
6 | | - |
7 | | - <ul> |
8 | | - <% event.errors.each do |error| %> |
9 | | - <li><%= error.full_message %></li> |
10 | | - <% end %> |
11 | | - </ul> |
| 3 | + <div class="rounded-lg bg-red-50 p-4 mb-6"> |
| 4 | + <div class="flex"> |
| 5 | + <div class="flex-shrink-0"> |
| 6 | + <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor"> |
| 7 | + <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" /> |
| 8 | + </svg> |
| 9 | + </div> |
| 10 | + <div class="ml-3"> |
| 11 | + <h3 class="text-sm font-medium text-red-800"> |
| 12 | + <%= pluralize(event.errors.count, "error") %> prohibited this event from being saved: |
| 13 | + </h3> |
| 14 | + <div class="mt-2 text-sm text-red-700"> |
| 15 | + <ul class="list-disc list-inside space-y-1"> |
| 16 | + <% event.errors.each do |error| %> |
| 17 | + <li><%= error.full_message %></li> |
| 18 | + <% end %> |
| 19 | + </ul> |
| 20 | + </div> |
| 21 | + </div> |
| 22 | + </div> |
12 | 23 | </div> |
13 | 24 | <% end %> |
14 | 25 |
|
15 | | - <div class='flex flex-col'> |
16 | | - <%= form.label :name %> |
17 | | - <%= form.text_field :name, required: true %> |
18 | | - <%= form.label :location %> |
19 | | - <%= form.rich_text_area :location, required: true %> |
20 | | - <%= form.label :rsvp_link %> |
21 | | - <%= form.text_field :rsvp_link, required: true %> |
22 | | - <%= form.label :description %> |
23 | | - <%= form.rich_text_area :description %> |
24 | | - <%= form.label :sponsor %> |
25 | | - <%= form.text_field :sponsor %> |
26 | | - <%= form.label :sponsor_link %> |
27 | | - <%= form.text_field :sponsor_link %> |
28 | | - <%= form.label :sponsor_logo %> |
29 | | - <%= form.text_field :sponsor_logo %> |
30 | | - <%= form.label :start_at %> |
31 | | - <%= form.datetime_field :start_at, |
32 | | - include_seconds: false, |
33 | | - value: |
34 | | - event |
35 | | - &.start_at |
36 | | - &.in_time_zone("Eastern Time (US & Canada)") |
37 | | - .presence || |
38 | | - Time.zone.now.in_time_zone("Eastern Time (US & Canada)") %> |
39 | | - <%= form.label :status %> |
40 | | - <%= form.select :status, options_for_select(Event.statuses_for_select, event.status) %> |
41 | | - <%= form.submit %> |
| 26 | + <div class="space-y-6"> |
| 27 | + <!-- Basic Information --> |
| 28 | + <div class="card p-6"> |
| 29 | + <h3 class="text-lg font-semibold mb-4">Basic Information</h3> |
| 30 | + |
| 31 | + <div class="space-y-4"> |
| 32 | + <div> |
| 33 | + <%= form.label :name, class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 34 | + <%= form.text_field :name, required: true, class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors" %> |
| 35 | + </div> |
| 36 | + |
| 37 | + <div> |
| 38 | + <%= form.label :start_at, class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 39 | + <%= form.datetime_field :start_at, |
| 40 | + include_seconds: false, |
| 41 | + value: event&.start_at&.in_time_zone("Eastern Time (US & Canada)").presence || Time.zone.now.in_time_zone("Eastern Time (US & Canada)"), |
| 42 | + class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors" %> |
| 43 | + <p class="mt-1 text-sm text-gray-500">Eastern Time (US & Canada)</p> |
| 44 | + </div> |
| 45 | + |
| 46 | + <div> |
| 47 | + <%= form.label :status, class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 48 | + <%= form.select :status, |
| 49 | + options_for_select(Event.statuses_for_select, event.status), |
| 50 | + {}, |
| 51 | + class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors" %> |
| 52 | + </div> |
| 53 | + |
| 54 | + <div> |
| 55 | + <%= form.label :rsvp_link, "RSVP Link", class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 56 | + <%= form.text_field :rsvp_link, required: true, placeholder: "https://...", class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors placeholder-gray-400" %> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + |
| 61 | + <!-- Content --> |
| 62 | + <div class="card p-6"> |
| 63 | + <h3 class="text-lg font-semibold mb-4">Event Details</h3> |
| 64 | + |
| 65 | + <div class="space-y-4"> |
| 66 | + <div> |
| 67 | + <%= form.label :location, class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 68 | + <div class="prose-editor"> |
| 69 | + <%= form.rich_text_area :location, required: true, class: "block w-full" %> |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + |
| 73 | + <div> |
| 74 | + <%= form.label :description, "Agenda", class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 75 | + <div class="prose-editor"> |
| 76 | + <%= form.rich_text_area :description, class: "block w-full" %> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + |
| 82 | + <!-- Sponsor Information --> |
| 83 | + <div class="card p-6"> |
| 84 | + <h3 class="text-lg font-semibold mb-4">Sponsor Information</h3> |
| 85 | + <p class="text-sm text-gray-600 mb-4">Optional: Add sponsor details if this event has a sponsor</p> |
| 86 | + |
| 87 | + <div class="space-y-4"> |
| 88 | + <div> |
| 89 | + <%= form.label :sponsor, "Sponsor Name", class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 90 | + <%= form.text_field :sponsor, class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors" %> |
| 91 | + </div> |
| 92 | + |
| 93 | + <div> |
| 94 | + <%= form.label :sponsor_link, "Sponsor Website", class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 95 | + <%= form.text_field :sponsor_link, placeholder: "https://...", class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors placeholder-gray-400" %> |
| 96 | + </div> |
| 97 | + |
| 98 | + <div> |
| 99 | + <%= form.label :sponsor_logo, "Logo Filename", class: "block text-sm font-medium text-gray-700 mb-1" %> |
| 100 | + <%= form.text_field :sponsor_logo, placeholder: "company.png", class: "block w-full px-4 py-3 rounded-lg border border-gray-300 shadow-sm focus:border-ruby-500 focus:ring-1 focus:ring-ruby-500 transition-colors placeholder-gray-400" %> |
| 101 | + <p class="mt-1 text-sm text-gray-500">Logo should be placed in app/assets/images/sponsors/</p> |
| 102 | + </div> |
| 103 | + </div> |
| 104 | + </div> |
| 105 | + |
| 106 | + <!-- Form Actions --> |
| 107 | + <div class="flex items-center justify-end gap-4 pt-6"> |
| 108 | + <%= link_to "Cancel", admin_events_path, class: "btn-secondary" %> |
| 109 | + <%= form.submit class: "btn-primary" %> |
| 110 | + </div> |
42 | 111 | </div> |
43 | 112 | <% end %> |
| 113 | + |
| 114 | +<style> |
| 115 | + /* Rich text editor styling */ |
| 116 | + .prose-editor { |
| 117 | + @apply rounded-lg border border-gray-300 overflow-hidden shadow-sm; |
| 118 | + } |
| 119 | + |
| 120 | + .prose-editor:focus-within { |
| 121 | + @apply ring-1 ring-ruby-500 border-ruby-500; |
| 122 | + } |
| 123 | + |
| 124 | + .prose-editor trix-editor { |
| 125 | + @apply min-h-[150px] px-4 py-3; |
| 126 | + } |
| 127 | + |
| 128 | + .prose-editor trix-toolbar { |
| 129 | + @apply border-b border-gray-200 px-2; |
| 130 | + } |
| 131 | + |
| 132 | + /* Ensure trix editor has consistent padding */ |
| 133 | + .prose-editor trix-editor:empty:not(:focus)::before { |
| 134 | + @apply text-gray-400; |
| 135 | + } |
| 136 | +</style> |
0 commit comments