Skip to content

Commit 80d3062

Browse files
authored
Documentation page improvements (#420)
* Added status frontmatter to documentation pages * Added status to resource card component For displaing the state of a page, saving end users a click and frustration/assumption the site is empty * Added status to frameworks page * Displaying core techologies at the top of the documentation page * Added missing status to frameworks without page content * Update resource_card_component.html.erb
1 parent e1450ea commit 80d3062

20 files changed

Lines changed: 40 additions & 5 deletions

app/components/page/resource_card_component.html.erb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
<%= image_tag image_path(image) %>
44
<% end %>
55
<% else %>
6-
<%= link_to @resource.request_path, class: "p-6 h-24 flex items-center justify-center bg-gray-950 hover:bg-gray-900 border border-gray-700 rounded-lg w-full font-bold text-2xl text-center" do %>
7-
<%= @resource.data.fetch("title") %>
6+
<%= link_to @resource.request_path, class: "p-6 h-48 flex flex-col space-y-2 items-center justify-center bg-gray-950 hover:bg-gray-900 border border-gray-700 rounded-lg w-full" do %>
7+
<span class="font-bold text-2xl text-center"><%= @resource.data.fetch("title") %></span>
8+
9+
<% status = @resource.data.dig("status") %>
10+
<% if status == "missing" %>
11+
<span class="bg-yellow-500 text-black py-0.5 px-1.5 rounded-lg text-xs">Coming soon</span>
12+
<% end %>
813
<% end %>
914
<% end %>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
class DocumentationModel < Sitepress::Model
22
collection glob: "**/documentation/*.html*"
33
data :title
4+
5+
def self.core_technologies
6+
all.filter { |page| page.data["core"] == true }.sort_by(&:title)
7+
end
8+
9+
def self.third_party_technologies
10+
all.filter { |page| page.data["core"] != true }.sort_by(&:title)
11+
end
412
end

app/content/models/framework_model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class FrameworkModel < Sitepress::Model
22
collection glob: "**/frameworks/*.html*"
3-
data :title, :framework, :language, :description, :icon_class, :image
3+
data :title, :framework, :language, :description, :icon_class, :image, :status
44

55
def self.grouped_by_language
66
all.sort_by(&:title).group_by(&:language).sort_by { |language, _| (language == "Ruby") ? "" : language }

app/content/pages/documentation.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ title: Documentation
55
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
66
<% page.with_title(title: current_page.data.fetch("title")) %>
77

8-
<% pages = DocumentationModel.all.sort_by(&:title) %>
9-
<%= render Page::CardSectionComponent.new(resources: pages) %>
8+
<%= render Page::CardSectionComponent.new(resources: DocumentationModel.core_technologies) %>
9+
<%= render Page::CardSectionComponent.new(resources: DocumentationModel.third_party_technologies) %>
1010
<% end %>

app/content/pages/documentation/formulus.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Formulus
3+
status: missing
34
---
45

56
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>

app/content/pages/documentation/stimulus-use.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Stimulus Use
3+
status: missing
34
---
45

56
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>

app/content/pages/documentation/stimulus.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
title: Stimulus
3+
status: done
4+
core: true
35
---
46

57
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>

app/content/pages/documentation/strada.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
title: Strada
3+
status: done
4+
core: true
35
---
46

57
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>

app/content/pages/documentation/turbo-boost.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Turbo Boost
3+
status: missing
34
---
45

56
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>

app/content/pages/documentation/turbo-morph.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Turbo Morph
3+
status: missing
34
---
45

56
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>

0 commit comments

Comments
 (0)