mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
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>
46 lines
1.4 KiB
Ruby
46 lines
1.4 KiB
Ruby
class CustomizationController < ApplicationController
|
|
before_action :authenticate_user!, except: [:content_types]
|
|
before_action :verify_content_type_can_be_toggled, only: [:toggle_content_type]
|
|
|
|
def content_types
|
|
@all_content_types = Rails.application.config.content_types[:all]
|
|
@premium_content_types = Rails.application.config.content_types[:premium]
|
|
@my_activators = user_signed_in? ? current_user.user_content_type_activators.pluck(:content_type) : []
|
|
|
|
@sidenav_expansion = 'worldbuilding'
|
|
@page_title = "Customize your notebook pages"
|
|
end
|
|
|
|
def toggle_content_type
|
|
current_activator = current_user
|
|
.user_content_type_activators
|
|
.where(content_type: toggle_content_type_params[:content_type])
|
|
|
|
if current_activator.any?
|
|
current_activator.destroy_all
|
|
else
|
|
current_user
|
|
.user_content_type_activators
|
|
.create(content_type: toggle_content_type_params[:content_type])
|
|
end
|
|
|
|
redirect_to customization_content_types_path
|
|
end
|
|
|
|
def verify_content_type_can_be_toggled
|
|
return false unless toggle_content_type_value_whitelist.include?(toggle_content_type_params[:content_type])
|
|
end
|
|
|
|
private
|
|
|
|
def toggle_content_type_params
|
|
params.permit(:content_type, :active)
|
|
end
|
|
|
|
def toggle_content_type_value_whitelist
|
|
(
|
|
Rails.application.config.content_types[:all] - Rails.application.config.content_types[:always_on]
|
|
).map(&:name)
|
|
end
|
|
end
|