Rende il CRM comodo da usare anche da cellulare.
Aggiunge navigazione mobile dedicata e trasforma le principali liste operative in layout più leggibili e facili da toccare. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,19 +6,23 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def btn_primary
|
||||
"btn-primary inline-flex items-center justify-center rounded-lg px-3.5 py-2 text-sm font-medium"
|
||||
"btn-primary inline-flex min-h-11 items-center justify-center rounded-lg px-3.5 py-2.5 text-sm font-medium"
|
||||
end
|
||||
|
||||
def btn_secondary
|
||||
"btn-secondary inline-flex items-center justify-center rounded-lg px-3.5 py-2 text-sm font-medium"
|
||||
"btn-secondary inline-flex min-h-11 items-center justify-center rounded-lg px-3.5 py-2.5 text-sm font-medium"
|
||||
end
|
||||
|
||||
def btn_danger
|
||||
"btn-danger inline-flex items-center justify-center rounded-lg px-3.5 py-2 text-sm font-medium"
|
||||
"btn-danger inline-flex min-h-11 items-center justify-center rounded-lg px-3.5 py-2.5 text-sm font-medium"
|
||||
end
|
||||
|
||||
def chip_action_class
|
||||
"inline-flex min-h-11 items-center justify-center rounded-lg border border-zinc-300 bg-zinc-50 px-3 py-2 text-sm font-medium text-zinc-800 hover:bg-zinc-100 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700"
|
||||
end
|
||||
|
||||
def input_class
|
||||
"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-zinc-400 focus:outline-none focus:ring-1 focus:ring-zinc-400 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:focus:border-zinc-500 dark:focus:ring-zinc-500"
|
||||
"w-full min-h-11 rounded-lg border border-zinc-200 bg-white px-3 py-2.5 text-base text-zinc-900 placeholder:text-zinc-400 focus:border-zinc-400 focus:outline-none focus:ring-1 focus:ring-zinc-400 md:text-sm dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:focus:border-zinc-500 dark:focus:ring-zinc-500"
|
||||
end
|
||||
|
||||
def mail_templates_picker_payload(templates)
|
||||
@@ -33,6 +37,46 @@ module ApplicationHelper
|
||||
"min-w-full text-sm text-zinc-900 dark:text-zinc-100"
|
||||
end
|
||||
|
||||
def table_wrap_class
|
||||
"overflow-x-auto overscroll-x-contain"
|
||||
end
|
||||
|
||||
def user_initials(user)
|
||||
"#{user.first_name.to_s[0]}#{user.last_name.to_s[0]}".upcase
|
||||
end
|
||||
|
||||
def tel_link(number, **options)
|
||||
return "—" if number.blank?
|
||||
|
||||
link_to number, "tel:#{number.to_s.gsub(/\s+/, '')}", **options
|
||||
end
|
||||
|
||||
def mailto_link(email, **options)
|
||||
return "—" if email.blank?
|
||||
|
||||
link_to email, "mailto:#{email}", **options
|
||||
end
|
||||
|
||||
def nav_item_active?(path, controllers: nil)
|
||||
return true if controllers&.include?(controller_name)
|
||||
|
||||
home = begin
|
||||
project_root_path
|
||||
rescue StandardError
|
||||
root_path
|
||||
end
|
||||
current_page?(path) || (path != home && request.fullpath.start_with?(path.split("?").first))
|
||||
end
|
||||
|
||||
def mobile_tab_class(path, controllers: nil)
|
||||
base = "flex min-h-12 min-w-0 flex-1 flex-col items-center justify-center gap-0.5 px-1 py-1 text-[11px] font-medium"
|
||||
if nav_item_active?(path, controllers: controllers)
|
||||
"#{base} text-zinc-900 dark:text-zinc-50"
|
||||
else
|
||||
"#{base} text-zinc-500 dark:text-zinc-400"
|
||||
end
|
||||
end
|
||||
|
||||
def status_badge(status)
|
||||
colors = {
|
||||
"prospect" => "bg-sky-100 text-sky-800",
|
||||
@@ -95,13 +139,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def nav_link(label, path, icon: nil)
|
||||
home = begin
|
||||
project_root_path
|
||||
rescue StandardError
|
||||
root_path
|
||||
end
|
||||
active = current_page?(path) || (path != home && request.fullpath.start_with?(path.split("?").first))
|
||||
classes = if active
|
||||
classes = if nav_item_active?(path)
|
||||
"bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900"
|
||||
else
|
||||
"text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-100"
|
||||
|
||||
Reference in New Issue
Block a user