notebook/app/controllers/notifications_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

26 lines
865 B
Ruby

class NotificationsController < ApplicationController
before_action :authenticate_user!
def index
@notifications = current_user.notifications.order('happened_at DESC').limit(100)
end
def show
notification = Notification.find_by(id: params[:id])
return redirect_to root_path unless notification.present?
return redirect_to root_path unless user_signed_in? && notification.user == current_user
# Mark this notification as read
notification.update(viewed_at: DateTime.current) unless notification.viewed_at?
# Redirect to the notification's link
redirect_to notification.passthrough_link
end
def mark_all_read
current_user.notifications.where(viewed_at: nil).update_all(viewed_at: DateTime.current)
redirect_back(fallback_location: root_path, notice: "Your notifications have all been marked read.")
end
end