Skip to content

Commit 11d8abd

Browse files
authored
Update show pages for dashboard content (#534)
* Update show pages for community_news, stories, resources, story_ideas, workshop/show_assocaitions (fix url) * Change text of 'featured' boolean display on quotes index (comments)
1 parent 3df7812 commit 11d8abd

File tree

8 files changed

+210
-178
lines changed

8 files changed

+210
-178
lines changed

app/controllers/workshop_logs_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def create
7272

7373
def show
7474
@workshop_log = Report.find(params[:id]).decorate
75-
@workshop = @workshop_log.workshop.decorate
75+
@workshop = @workshop_log.workshop&.decorate
7676
@answers = @workshop_log.report_form_field_answers
7777

7878
if @workshop_log

app/frontend/stylesheets/application.tailwind.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@
7373
.readonly textarea {
7474
@apply bg-gray-100 text-gray-500 cursor-not-allowed border-gray-300;
7575
}
76+
77+
.rotate-180 {
78+
transform: rotate(180deg);
79+
}

app/views/community_news/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</div>
2020

2121
<!-- Header Row -->
22-
<div class="w-full">
22+
<div class="w-full bg-white rounded-lg shadow-md p-6 space-y-6">
2323
<div class="max-w-3xl mx-auto px-4 py-10 text-gray-800">
2424

2525
<!-- Title -->

app/views/quotes/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<!-- <span-->
4545
<!-- class="inline-flex items-center px-2 py-0.5 rounded-full-->
4646
<!-- text-xs font-medium bg-yellow-100 text-yellow-800 whitespace-nowrap">-->
47-
<!-- 🌟 Featured-->
47+
<!-- 🌟 Dashboard Feature -->
4848
<!-- </span>-->
4949
<%# end %>
5050
</div>

app/views/resources/show.html.erb

Lines changed: 104 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,126 @@
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>
39

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 %>
1514

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>
1620

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">
1923

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>
2428

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 %>
2844
</div>
29-
<% end %>
3045

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>
4446

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 %>
5470

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 %>
6582
<% end %>
66-
<% end %>
83+
</div>
6784
</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" %>
6895
</div>
6996
<% end %>
70-
</div>
7197

7298

73-
<!-- URL -->
74-
<% if @resource.url.present? %>
99+
<!-- Main Text -->
75100
<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 %>
79102
</div>
80-
<% end %>
81-
82103

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 %>
102119
<% end %>
103-
<% end %>
104-
</ul>
105-
</div>
106-
<% end %>
120+
</ul>
121+
</div>
122+
<% end %>
123+
</div>
107124
</div>
108125
</div>
109126
</div>

0 commit comments

Comments
 (0)