Files
vault171/app/helpers/application_helper.rb
David Böhm 6f192274ab
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled
Big first commit
authentication-zero and first layout
2026-05-21 02:54:39 +02:00

37 lines
1.0 KiB
Ruby

module ApplicationHelper
def nav_link_class(target_controller)
base_classes = "flex items-center gap-3 px-3 py-2.5 text-sm font-medium rounded-lg transition-colors duration-200"
if controller_name == target_controller
"#{base_classes} bg-blue-50 text-blue-600 font-semibold"
else
"#{base_classes} text-gray-700 hover:bg-gray-50"
end
end
def parse_user_agent(user_agent_string)
ua = user_agent_string.to_s.downcase
# Browser-Erkennung via Case-Regex (nutzt === im Hintergrund)
browser = case ua
when /firefox/ then "Firefox"
when /chrome/ then "Chrome"
when /safari/ then "Safari"
when /edge/ then "Edge"
else "Unbekannter Browser"
end
# Betriebssystem-Erkennung via Case-Regex
os = case ua
when /windows/ then "Windows"
when /macintosh|mac os/ then "macOS"
when /iphone/ then "iPhone"
when /android/ then "Android"
when /linux/ then "Linux"
else "Betriebssystem"
end
"#{browser} auf #{os}"
end
end