|
1 | | -<div class="resource-detail py-6 min-h-screen"> |
2 | | - <div class="max-w-5xl mx-auto px-4"> |
| 1 | +<div class="min-h-screen py-8"> |
| 2 | + <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
| 3 | + <div class="bg-violet-50 border border-gray-200 rounded-xl shadow-md hover:shadow-lg transition-shadow duration-200 p-6"> |
| 4 | + <!-- Top Right Utility Buttons --> |
| 5 | + <div class="text-right mb-4 space-x-1"> |
| 6 | + <span class="inline-block text-md"> |
| 7 | + <%= render "bookmarks/editable_bookmark_button", resource: @resource.object %> |
| 8 | + </span> |
3 | 9 |
|
4 | | - <div class="flex justify-end mb-6"> |
5 | | - <% if current_user.super_user? %> |
6 | | - <%= link_to("Edit", edit_resource_path(@resource), class: "btn btn-primary-outline admin-only bg-blue-100") %> |
7 | | - <% end %> |
8 | | - |
9 | | - <%= link_to ("<span title='Download #{@resource.kind} image'>" + |
10 | | - " Download <span class='fa fa-download'></span></span>").html_safe, |
11 | | - resource_download_path(@resource), |
12 | | - class: "btn btn-utility" if @resource.download_attachment&.file&.attached? %> |
13 | | - <%= render "bookmarks/editable_bookmark_button", resource: @resource.object %> |
14 | | - </div> |
| 10 | + <% if current_user.super_user? %> |
| 11 | + <%= link_to("Edit", edit_resource_path(@resource), |
| 12 | + class: "admin-only bg-blue-100 btn btn-primary-outline") %> |
| 13 | + <% end %> |
15 | 14 |
|
| 15 | + <%= link_to ("<span title='Download #{@resource.kind} image'>" + |
| 16 | + " Download <span class='fa fa-download'></span></span>").html_safe, |
| 17 | + resource_download_path(@resource), |
| 18 | + class: "btn btn-utility" if @resource.download_attachment&.file&.attached? %> |
| 19 | + </div> |
16 | 20 |
|
17 | | - <!-- Resource Card --> |
18 | | - <div class="bg-white rounded-lg shadow-md p-6 space-y-6"> |
| 21 | + <!-- Resource Card --> |
| 22 | + <div class="bg-white rounded-lg shadow-md p-6 space-y-6"> |
19 | 23 |
|
20 | | - <!-- Title --> |
21 | | - <h2 class="text-3xl font-semibold text-gray-900"> |
22 | | - <%= @resource.display_title %> |
23 | | - </h2> |
| 24 | + <!-- Title --> |
| 25 | + <h2 class="text-3xl font-semibold text-gray-900 mb-2"> |
| 26 | + <%= @resource.display_title %> |
| 27 | + </h2> |
24 | 28 |
|
25 | | - <% if @resource.inactive? %> |
26 | | - <div class="text-red-500 mb-3"> |
27 | | - [HIDDEN] |
| 29 | + <div class="mb-3"> |
| 30 | + <% if @resource.featured %> |
| 31 | + <span |
| 32 | + class="inline-flex items-center px-2 py-0.5 rounded-full |
| 33 | + text-xs font-medium bg-yellow-100 text-yellow-800 whitespace-nowrap"> |
| 34 | + 🌟 Dashboard Feature |
| 35 | + </span> |
| 36 | + <% end %> |
| 37 | + <% if @resource.inactive? %> |
| 38 | + <span |
| 39 | + class="inline-flex items-center px-2 py-0.5 rounded-full |
| 40 | + text-xs font-medium bg-blue-100 text-gray-600 whitespace-nowrap"> |
| 41 | + <i class="fa-solid fa-eye-slash mr-1"></i> Hidden |
| 42 | + </span> |
| 43 | + <% end %> |
28 | 44 | </div> |
29 | | - <% end %> |
30 | 45 |
|
31 | | - <!-- Author and Date --> |
32 | | - <div class="flex flex-col gap-1"> |
33 | | - <% unless @resource.toolkit_and_form? %> |
34 | | - <div class="flex items-center text-gray-600 text-sm gap-2"> |
35 | | - <span><%= @resource.author %></span> |
36 | | - <% unless @resource.story? %> |
37 | | - <span class="<%= "border-l border-gray-400 pl-2" if @resource.author.present? %>"> |
38 | | - <%= @resource.display_date %> |
39 | | - </span> |
40 | | - <% end %> |
41 | | - </div> |
42 | | - <% end %> |
43 | | - </div> |
44 | 46 |
|
45 | | - <div class="images"> |
46 | | - <!-- Hero Image --> |
47 | | - <% if @resource.main_image&.file&.attached? %> |
48 | | - <div class="mb-8"> |
49 | | - <%= image_tag @resource.main_image.file, |
50 | | - class: "w-full rounded-lg shadow-sm border border-gray-200", |
51 | | - alt: @resource.title %> |
52 | | - </div> |
53 | | - <% end %> |
| 47 | + <!-- Author and Date --> |
| 48 | + <div class="flex flex-col gap-1"> |
| 49 | + <% unless @resource.toolkit_and_form? %> |
| 50 | + <div class="flex items-center text-gray-600 text-sm gap-2"> |
| 51 | + <span><%= @resource.author %></span> |
| 52 | + <% unless @resource.story? %> |
| 53 | + <span class="<%= "border-l border-gray-400 pl-2" if @resource.author.present? %>"> |
| 54 | + <%= @resource.display_date %> |
| 55 | + </span> |
| 56 | + <% end %> |
| 57 | + </div> |
| 58 | + <% end %> |
| 59 | + </div> |
| 60 | + |
| 61 | + <div class="images"> |
| 62 | + <!-- Hero Image --> |
| 63 | + <% if @resource.main_image&.file&.attached? %> |
| 64 | + <div class="mb-8"> |
| 65 | + <%= image_tag @resource.main_image.file, |
| 66 | + class: "w-full rounded-lg shadow-sm border border-gray-200", |
| 67 | + alt: @resource.title %> |
| 68 | + </div> |
| 69 | + <% end %> |
54 | 70 |
|
55 | | - <!-- Gallery Images --> |
56 | | - <% if @resource.gallery_images.any? { |img| img.persisted? && img.file.attached? } %> |
57 | | - <div class="resource-gallery single-resource-detail text-center mb-4"> |
58 | | - <div class="flex flex-wrap justify-center gap-4 mx-auto max-w-3xl"> |
59 | | - <% @resource.gallery_images.each_with_index do |gallery_image, idx| %> |
60 | | - <% if gallery_image.file&.attached? %> |
61 | | - <%= image_tag url_for(gallery_image.file), |
62 | | - alt: "Gallery Image #{idx + 1}", |
63 | | - data: { file_preview_target: "preview" }, |
64 | | - class: "w-32 h-32 object-cover border border-gray-300 shadow-sm" %> |
| 71 | + <!-- Gallery Images --> |
| 72 | + <% if @resource.gallery_images.any? { |img| img.persisted? && img.file.attached? } %> |
| 73 | + <div class="resource-gallery single-resource-detail text-center mb-4"> |
| 74 | + <div class="flex flex-wrap justify-center gap-4 mx-auto max-w-3xl"> |
| 75 | + <% @resource.gallery_images.each_with_index do |gallery_image, idx| %> |
| 76 | + <% if gallery_image.file&.attached? %> |
| 77 | + <%= image_tag url_for(gallery_image.file), |
| 78 | + alt: "Gallery Image #{idx + 1}", |
| 79 | + data: { file_preview_target: "preview" }, |
| 80 | + class: "w-32 h-32 object-cover border border-gray-300 shadow-sm" %> |
| 81 | + <% end %> |
65 | 82 | <% end %> |
66 | | - <% end %> |
| 83 | + </div> |
67 | 84 | </div> |
| 85 | + <% end %> |
| 86 | + </div> |
| 87 | + |
| 88 | + |
| 89 | + <!-- URL --> |
| 90 | + <% if @resource.url.present? %> |
| 91 | + <div class="prose mx-auto leading-relaxed text-gray-800 text-left"> |
| 92 | + <%= link_to @resource.url, @resource.url, target: "_blank", |
| 93 | + rel: "noopener noreferrer", |
| 94 | + class: "text-blue-600 hover:underline break-words" %> |
68 | 95 | </div> |
69 | 96 | <% end %> |
70 | | - </div> |
71 | 97 |
|
72 | 98 |
|
73 | | - <!-- URL --> |
74 | | - <% if @resource.url.present? %> |
| 99 | + <!-- Main Text --> |
75 | 100 | <div class="prose mx-auto leading-relaxed text-gray-800 text-left"> |
76 | | - <%= link_to @resource.url, @resource.url, target: "_blank", |
77 | | - rel: "noopener noreferrer", |
78 | | - class: "text-blue-600 hover:underline break-words" %> |
| 101 | + <%= @resource.display_text %> |
79 | 102 | </div> |
80 | | - <% end %> |
81 | | - |
82 | 103 |
|
83 | | - <!-- Main Text --> |
84 | | - <div class="prose mx-auto leading-relaxed text-gray-800 text-left"> |
85 | | - <%= @resource.display_text %> |
86 | | - </div> |
87 | | - |
88 | | - <!-- Attachments --> |
89 | | - <% if @resource.attachments.any? %> |
90 | | - <div class="mt-6"> |
91 | | - <p class="font-medium text-gray-700 mb-2">Attachment:</p> |
92 | | - <ul class="flex flex-wrap gap-2"> |
93 | | - <% @resource.attachments.each do |attachment| %> |
94 | | - <% if attachment.file&.attached? %> |
95 | | - <li> |
96 | | - <%= link_to ("<span title='Download #{@resource.kind}'>" + |
97 | | - " #{ attachment.file_file_name } <span class='fa fa-download'></span></span>").html_safe, |
98 | | - resource_download_path(@resource, |
99 | | - attachment_id: attachment.id), |
100 | | - class: "btn btn-utility" if attachment&.file&.attached? %> |
101 | | - </li> |
| 104 | + <!-- Attachments --> |
| 105 | + <% if @resource.attachments.any? %> |
| 106 | + <div class="mt-6"> |
| 107 | + <p class="font-medium text-gray-700 mb-2">Attachment:</p> |
| 108 | + <ul class="flex flex-wrap gap-2"> |
| 109 | + <% @resource.attachments.each do |attachment| %> |
| 110 | + <% if attachment.file&.attached? %> |
| 111 | + <li> |
| 112 | + <%= link_to ("<span title='Download #{@resource.kind}'>" + |
| 113 | + " #{ attachment.file_file_name } <span class='fa fa-download'></span></span>").html_safe, |
| 114 | + resource_download_path(@resource, |
| 115 | + attachment_id: attachment.id), |
| 116 | + class: "btn btn-utility" if attachment&.file&.attached? %> |
| 117 | + </li> |
| 118 | + <% end %> |
102 | 119 | <% end %> |
103 | | - <% end %> |
104 | | - </ul> |
105 | | - </div> |
106 | | - <% end %> |
| 120 | + </ul> |
| 121 | + </div> |
| 122 | + <% end %> |
| 123 | + </div> |
107 | 124 | </div> |
108 | 125 | </div> |
109 | 126 | </div> |
0 commit comments