diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 25f18107..68d86aaa 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -55,6 +55,7 @@ class ContentController < ApplicationController end @content = @content.sort_by {|x| [x.favorite? ? 0 : 1, x.name] } + @folders = [] @questioned_content = @content.sample @attribute_field_to_question = SerendipitousService.question_for(@questioned_content) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 75aef647..cfedbf1c 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -57,6 +57,7 @@ class DocumentsController < ApplicationController page_id: @documents.map(&:id) ).order(:tag) + @filtered_page_tags = [] if params.key?(:tag) @filtered_page_tags = @page_tags.where(slug: params[:tag]) @documents = @documents.to_a.select { |document| @filtered_page_tags.pluck(:page_id).include?(document.id) } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d03680a8..3cfd6d19 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,6 +4,9 @@ module ApplicationHelper # If we pass in a class (e.g. Character instead of "Character") by mistake, just return it return class_name if class_name.is_a?(Class) + # Extra whitelisting for some other classes we don't necessarily want in the content_types array + return Folder if class_name == Folder.name + Rails.application.config.content_types_by_name[class_name] end diff --git a/app/views/content/display/_tailwind_foldered_index.html.erb b/app/views/content/display/_tailwind_foldered_index.html.erb new file mode 100644 index 00000000..7b3847fc --- /dev/null +++ b/app/views/content/display/_tailwind_foldered_index.html.erb @@ -0,0 +1,693 @@ +<% + if mixed_content_types + content_counts_per_type = { content_type_name: content.count } + else + content_counts_per_type = Hash.new(0) + content.each { |page| content_counts_per_type[page.is_a?(ContentPage) ? page['page_type'] : page.class.name] += 1 } + end + + if @folders.any? + content_counts_per_type[Folder.name] = @folders.count + end +%> + + +
<%= folder.title %>
+16 documents
+| Name | +Title | +Status | +Role | ++ Edit + | +
|---|---|---|---|---|
|
+
+
+
+
+
+
+ Jane Cooper
+ jane.cooper@example.com
+ |
+
+ Regional Paradigm Technician
+ Optimization
+ |
+ + Active + | +Admin | ++ Edit + | +
<%= folder.title %>
+16 documents
+| Name | +Title | +Status | +Role | ++ Edit + | +
|---|---|---|---|---|
|
+
+
+
+
+
+
+ Jane Cooper
+ jane.cooper@example.com
+ |
+
+ Regional Paradigm Technician
+ Optimization
+ |
+ + Active + | +Admin | ++ Edit + | +