mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
* Add breadcrumbs support across application Fixes #1896 * Potential fix for tests * Simplify breadcrumbs implementation Remove complex breadcrumbs logic from controllers and concern, replacing with a simpler default approach that sets a basic breadcrumb based on the current controller name * Refactor page header and breadcrumbs rendering Remove complex breadcrumbs helper method and update layout to use more flexible content_for approach for page headers and breadcrumbs * Add fallback breadcrumbs rendering to settings layout
36 lines
1.1 KiB
Ruby
36 lines
1.1 KiB
Ruby
class ApplicationController < ActionController::Base
|
|
include Onboardable, Localize, AutoSync, Authentication, Invitable, SelfHostable, StoreLocation, Impersonatable, Breadcrumbable
|
|
include Pagy::Backend
|
|
|
|
helper_method :require_upgrade?, :subscription_pending?
|
|
|
|
before_action :detect_os
|
|
|
|
private
|
|
def require_upgrade?
|
|
return false if self_hosted?
|
|
return false unless Current.session
|
|
return false if Current.family.subscribed?
|
|
return false if subscription_pending? || request.path == settings_billing_path
|
|
return false if Current.family.active_accounts_count <= 3
|
|
|
|
true
|
|
end
|
|
|
|
def subscription_pending?
|
|
subscribed_at = Current.session.subscribed_at
|
|
subscribed_at.present? && subscribed_at <= Time.current && subscribed_at > 1.hour.ago
|
|
end
|
|
|
|
def detect_os
|
|
user_agent = request.user_agent
|
|
@os = case user_agent
|
|
when /Windows/i then "windows"
|
|
when /Macintosh/i then "mac"
|
|
when /Linux/i then "linux"
|
|
when /Android/i then "android"
|
|
when /iPhone|iPad/i then "ios"
|
|
else ""
|
|
end
|
|
end
|
|
end
|