diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index b82497e2..5e8ed4a6 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -42,7 +42,8 @@ class MainController < ApplicationController @starred_pages = content_list.select { |page| page['favorite'] == 1 } @other_pages = content_list.select { |page| page['favorite'] == 0 } - + @page_type_counts = Hash.new(0) + content_list.each { |page| @page_type_counts[page['page_type']] += 1 } end def infostack diff --git a/app/views/main/table_of_contents.html.erb b/app/views/main/table_of_contents.html.erb index b06a0995..21ab5da5 100644 --- a/app/views/main/table_of_contents.html.erb +++ b/app/views/main/table_of_contents.html.erb @@ -20,9 +20,8 @@
@@ -31,51 +30,65 @@ -
-
-
-
-

Starred pages

-

- Star any page to keep it at the top of page lists. -

-
-
-
- <%= @starred_pages.inspect %> -
-
How do you make holy water?
-
You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat.
-
- -
-
How do you make holy water?
-
You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat.
-
- -
-
How do you make holy water?
-
You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat.
-
- -
-
How do you make holy water?
-
You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat.
-
-
+<% if @starred_pages.any? %> +
+
+
+
+

Starred pages

+

+ Star any page to keep it at the top of page lists. +

+
+
+
+ <% @starred_pages.each do |page| %> + <%= link_to polymorphic_path(page['page_type'].downcase, id: page['id']), class: 'block px-4 py-3 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border' do %> +
+ <%= content_class_from_name(page['page_type']).icon %> + <%= page['name'] %> +
+ + <% end %> + <% end %> +
+
-
+<% end %>
-
-

Other pages

-

- Everything else! +

+

All pages

+

+ Filter by page type...

+ +
    + <% @page_type_counts.each do |page_type, count| %> + <%= link_to '#' do %> +
  • +
    + <%= content_class_from_name(page_type).icon %> + <%= page_type.pluralize %> +
    +
    + + <%= count %> + +
    +
  • + <% end %> + <% end %> +
+
@@ -98,22 +111,24 @@
- - -
-
-
- <% if @universe_scope %> -

- <%= link_to @universe_scope.name, @universe_scope %> -

- <% end %> -

- Table of Contents +

+
+

Follow this universe

+

+ Stay connected and be notified as this world grows!

-

- All your pages and stuff (maybe make this a universe page, sharable?) +

+
+
+ + +
+ +
+
+

+ Your email address won't be shared with <%= @universe_scope.user.display_name %>.