Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 74 additions & 74 deletions app/helpers/admin_dashboard_cards_helper.rb
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
module AdminDashboardCardsHelper
# -----------------------------
# SYSTEM / ADMIN CARDS
# -----------------------------
def system_cards
[
model_card(:banners, icon: "📣"),
model_card(:faqs, icon: "❔", title: "FAQs"),
model_card(:community_news, icon: "📰"),
model_card(:events, icon: "📆"),
model_card(:stories, icon: "🗣️"),
custom_card("Tagging counts", taggings_matrix_path, icon: "🧮", color: :lime),
model_card(:resources, icon: "📚"),
model_card(:workshops, icon: "🎨"),
model_card(:projects, icon: "🏫"),
model_card(:facilitators, icon: "🧑‍🎨"),
model_card(:users, icon: "👥", title: "User accounts")
]
end
# -----------------------------

Check failure on line 2 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
# SYSTEM / ADMIN CARDS

Check failure on line 3 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
# -----------------------------

Check failure on line 4 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
def system_cards

Check failure on line 5 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
[

Check failure on line 6 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
model_card(:banners, icon: "📣"),

Check failure on line 7 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
model_card(:faqs, icon: "❔", title: "FAQs"),

Check failure on line 8 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
model_card(:community_news, icon: "📰"),

Check failure on line 9 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
model_card(:events, icon: "📆"),

Check failure on line 10 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
model_card(:stories, icon: "🗣️"),

Check failure on line 11 in app/helpers/admin_dashboard_cards_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/IndentationStyle: Tab detected in indentation.
custom_card("Tagging counts", taggings_matrix_path, icon: "🧮", color: :lime),
model_card(:resources, icon: "📚"),
model_card(:workshops, icon: "🎨"),
model_card(:projects, icon: "🏫"),
model_card(:facilitators, icon: "🧑‍🎨"),
model_card(:users, icon: "👥", title: "User accounts")
]
end

# -----------------------------
# USER CONTENT CARDS
# -----------------------------
def user_content_cards
[
custom_card("Activity logs", dashboard_recent_activities_path, icon: "🧭"),
custom_card("Analytics dashboard", admin_analytics_path, icon: "📊"),
custom_card("Bookmarks tally", tally_bookmarks_path, icon: "🔖"),
model_card(:event_registrations, icon: "🎟️", intensity: 100),
model_card(:story_ideas, icon: "✍️", intensity: 100),
custom_card("Tags", tags_path, icon: "🏷️", color: :lime, intensity: 100),
model_card(:workshop_variations, icon: "🔀", intensity: 100),
model_card(:workshop_ideas, icon: "💡", intensity: 100),
model_card(:workshop_logs, icon: "📝", intensity: 100),
model_card(:quotes, icon: "💬", intensity: 100)
]
end
# -----------------------------
# USER CONTENT CARDS
# -----------------------------
def user_content_cards
[
custom_card("Activity logs", dashboard_recent_activities_path, icon: "🧭"),
custom_card("Analytics dashboard", admin_analytics_path, icon: "📊"),
custom_card("Bookmarks tally", tally_bookmarks_path, icon: "🔖"),
model_card(:event_registrations, icon: "🎟️", intensity: 100),
model_card(:story_ideas, icon: "✍️", intensity: 100),
custom_card("Tags", tags_path, icon: "🏷️", color: :lime, intensity: 100),
model_card(:workshop_variations, icon: "🔀", intensity: 100),
model_card(:workshop_ideas, icon: "💡", intensity: 100),
model_card(:workshop_logs, icon: "📝", intensity: 100),
model_card(:quotes, icon: "💬", intensity: 100),
]
end

# -----------------------------
# REFERENCE CARDS
# -----------------------------
def reference_cards
[
model_card(:categories, icon: "🗂️",
intensity: 100,
params: { published_search: true }),
model_card(:sectors, icon: "🏭",
intensity: 100,
title: "Service populations",
params: { published_search: true }),
custom_card("Project statuses", authenticated_root_path, icon: "🧮", color: :emerald, intensity: 100),
custom_card("Windows types", windows_types_path, icon: "🪟")
]
end
# -----------------------------
# REFERENCE CARDS
# -----------------------------
def reference_cards
[
model_card(:categories, icon: "🗂️",
intensity: 100,
params: { published_search: true }),
model_card(:sectors, icon: "🏭",
intensity: 100,
title: "Service populations",
params: { published_search: true }),
custom_card("Project statuses", authenticated_root_path, icon: "🧮", color: :emerald, intensity: 100),
custom_card("Windows types", windows_types_path, icon: "🪟"),
]
end

# ============================================================
# CARD BUILDERS
# ============================================================
def model_card(key, title: nil, icon:, intensity: 50, params: {})
{
title: title || key.to_s.humanize,
path: polymorphic_path(key.to_s.classify.constantize, params),
icon: icon,
bg_color: DomainTheme.bg_class_for(key, intensity: intensity),
hover_bg_color: DomainTheme.bg_class_for(key, intensity: intensity == 50 ? 100 : intensity + 100, hover: true),
text_color: "text-gray-800"
}
end
# ============================================================
# CARD BUILDERS
# ============================================================
def model_card(key, title: nil, icon:, intensity: 50, params: {})
{
title: title || key.to_s.humanize,
path: polymorphic_path(key.to_s.classify.constantize, params),
icon: icon,
bg_color: DomainTheme.bg_class_for(key, intensity: intensity),
hover_bg_color: DomainTheme.bg_class_for(key, intensity: intensity == 50 ? 100 : intensity + 100, hover: true),
text_color: "text-gray-800"
}
end

def custom_card(title, path, icon:, color: :gray, intensity: 50)
{
title: title,
path: path,
icon: icon,
bg_color: "bg-#{color}-#{intensity}",
hover_bg_color: "hover:bg-#{color}-#{intensity == 50 ? 100 : intensity + 100}",
text_color: "text-gray-800"
}
end
def custom_card(title, path, icon:, color: :gray, intensity: 50)
{
title: title,
path: path,
icon: icon,
bg_color: "bg-#{color}-#{intensity}",
hover_bg_color: "hover:bg-#{color}-#{intensity == 50 ? 100 : intensity + 100}",
text_color: "text-gray-800"
}
end
end
1 change: 0 additions & 1 deletion app/views/admin/analytics/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
color: :events
%>


<%= render "admin/analytics/popular_list",
title: "Workshop variations",
records: @most_viewed_workshop_variations,
Expand Down