|
| 1 | +module AdminDashboardCardsHelper |
| 2 | + # ----------------------------- |
| 3 | + # SYSTEM / ADMIN CARDS |
| 4 | + # ----------------------------- |
| 5 | + def system_cards |
| 6 | + [ |
| 7 | + model_card(:banners, icon: "📣"), |
| 8 | + model_card(:community_news, icon: "📰"), |
| 9 | + model_card(:events, icon: "📆"), |
| 10 | + model_card(:faqs, icon: "❔", title: "FAQs"), |
| 11 | + model_card(:stories, icon: "🗣️"), |
| 12 | + custom_card("Tagging counts", taggings_matrix_path, icon: "🧮", color: :lime), |
| 13 | + model_card(:resources, icon: "📚"), |
| 14 | + model_card(:workshops, icon: "🎨"), |
| 15 | + model_card(:projects, icon: "🏫"), |
| 16 | + model_card(:facilitators, icon: "🧑🎨"), |
| 17 | + model_card(:users, icon: "👥", title: "User accounts") |
| 18 | + ] |
| 19 | + end |
| 20 | + |
| 21 | + # ----------------------------- |
| 22 | + # USER CONTENT CARDS |
| 23 | + # ----------------------------- |
| 24 | + def user_content_cards |
| 25 | + [ |
| 26 | + custom_card("Activity logs", dashboard_recent_activities_path, icon: "🧭"), |
| 27 | + custom_card("Bookmarks tally", tally_bookmarks_path, icon: "🔖"), |
| 28 | + model_card(:event_registrations, icon: "🎟️", intensity: 100, title: "Event Registrations"), |
| 29 | + model_card(:quotes, icon: "💬", intensity: 100), |
| 30 | + model_card(:story_ideas, icon: "✍️", intensity: 100), |
| 31 | + custom_card("Tags", tags_path, icon: "🏷️", color: :lime, intensity: 100), |
| 32 | + model_card(:workshop_variations, icon: "🔀", intensity: 100), |
| 33 | + model_card(:workshop_ideas, icon: "💡", intensity: 100), |
| 34 | + model_card(:workshop_logs, icon: "📝", intensity: 100), |
| 35 | + ] |
| 36 | + end |
| 37 | + |
| 38 | + # ----------------------------- |
| 39 | + # REFERENCE CARDS |
| 40 | + # ----------------------------- |
| 41 | + def reference_cards |
| 42 | + [ |
| 43 | + custom_card("Categories", authenticated_root_path, icon: "🗂️"), |
| 44 | + custom_card("Sectors", authenticated_root_path, icon: "🏭"), |
| 45 | + custom_card("Project Statuses", authenticated_root_path, icon: "🧮"), |
| 46 | + custom_card("Windows Types", windows_types_path, icon: "🪟"), |
| 47 | + ] |
| 48 | + end |
| 49 | + |
| 50 | + # ============================================================ |
| 51 | + # CARD BUILDERS |
| 52 | + # ============================================================ |
| 53 | + def model_card(key, title: nil, icon:, intensity: 50) |
| 54 | + { |
| 55 | + title: title || key.to_s.humanize, |
| 56 | + path: polymorphic_path(key.to_s.classify.constantize), |
| 57 | + icon: icon, |
| 58 | + bg_color: DomainTheme.bg_class_for(key, intensity: intensity), |
| 59 | + hover_bg_color: DomainTheme.bg_class_for(key, intensity: intensity == 50 ? 100 : intensity + 100, hover: true), |
| 60 | + text_color: "text-gray-800" |
| 61 | + } |
| 62 | + end |
| 63 | + |
| 64 | + def custom_card(title, path, icon:, color: :gray, intensity: 50) |
| 65 | + { |
| 66 | + title: title, |
| 67 | + path: path, |
| 68 | + icon: icon, |
| 69 | + bg_color: "bg-#{color}-#{intensity}", |
| 70 | + hover_bg_color: "hover:bg-#{color}-#{intensity == 50 ? 100 : intensity + 100}", |
| 71 | + text_color: "text-gray-800" |
| 72 | + } |
| 73 | + end |
| 74 | +end |
0 commit comments