notebook/app/controllers/universes_controller.rb
Andrew Brown fe9bcf5cc4 Complete MaterializeCSS to TailwindCSS migration cleanup
This commit finalizes the transition from MaterializeCSS to TailwindCSS by:

**Layout & Controller Changes:**
- Consolidated layouts/tailwind.html.erb into layouts/application.html.erb
- Removed `layout 'tailwind'` declarations from 21 controllers
- Removed MaterializeCSS CDN link while preserving Material Icons

**Asset Cleanup:**
- Deleted materialize.min.js (76KB) and materialize-overrides.scss
- Removed tailwind.html.erb (no longer needed)
- Cleaned up MaterializeCSS-specific JavaScript files

**JavaScript Modernization:**
- Removed MaterializeCSS initialization and select components
- Updated autosave.js and timeline-editor.js to remove M.toast() calls
- Deprecated unused React component with MaterializeCSS dependencies

**Result:**
- Unified TailwindCSS layout system across entire application
- Complete removal of MaterializeCSS dependencies
- Preserved all functionality through Alpine.js implementations
- Clean codebase ready for production

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-27 19:39:15 -07:00

41 lines
1.3 KiB
Ruby

class UniversesController < ContentController
def hub
@universes = @current_user_content.fetch('Universe', []).sort_by(&:name)
end
# TODO: pull list of content types out from some centralized list somewhere
(Rails.application.config.content_types[:all_non_universe] + [Timeline]).each do |content_type|
content_type_name = content_type.name.downcase.pluralize.to_sym
define_method content_type_name do
@content_type = content_type_name.to_s.singularize.capitalize.constantize
@universe = Universe.find_by(id: params[:id])
return redirect_to(root_path, notice: "That universe doesn't exist!", status: :not_found) unless @universe.present?
@content_list = @universe.send(content_type_name)
# todo just use current_user.can_view?(@universe) and/or individual filtering
unless user_signed_in? && (current_user == @universe.user || Contributor.exists?(user_id: current_user.id, universe_id: @universe.id))
@content_list = @content_list.is_public
end
@content_list = @content_list.order(:name)
render :content_list
end
end
private
def content_param_list
[
:user_id,
:name, :description, :genre,
:laws_of_physics, :magic_system, :technology,
:history,
:privacy,
:notes, :private_notes,
custom_attribute_values: [:name, :value],
]
end
end