\n"
if topic.category
- html << "#{e(topic.category.name)}\n"
+ html << "#{e(topic.category.name)}\n"
end
html << "#{e(topic.title)}\n"
html << ""
@@ -845,17 +849,31 @@ module CommunityLanding
size > 0 ? " style=\"font-size: #{size}px\"" : ""
end
+ # Render an icon element based on the chosen icon library
+ def icon_tag(name, extra_class = nil)
+ lib = (@s.icon_library rescue "none").to_s
+ cls = extra_class ? " #{extra_class}" : ""
+ case lib
+ when "fontawesome"
+ ""
+ when "google"
+ "#{e(name)}"
+ else
+ nil
+ end
+ end
+
def participation_stat(count, raw_label, default_svg)
- fa_enabled = (@s.fontawesome_enabled rescue false)
- # Parse "icon | Label" format — if present, use FA icon instead of default SVG
- if fa_enabled && raw_label.include?("|")
+ lib = (@s.icon_library rescue "none").to_s
+ # Parse "icon | Label" format — if present, use library icon instead of default SVG
+ if lib != "none" && raw_label.include?("|")
parts = raw_label.split("|", 2).map(&:strip)
left, right = parts
if left.match?(/\A[\w-]+\z/) && left.length < 30
- icon_html = ""
+ icon_html = icon_tag(left, "cl-participation-stat__icon")
label = right
elsif right.match?(/\A[\w-]+\z/) && right.length < 30
- icon_html = ""
+ icon_html = icon_tag(right, "cl-participation-stat__icon")
label = left
else
icon_html = default_svg
@@ -872,20 +890,15 @@ module CommunityLanding
end
def button_with_icon(raw_label)
- fa_enabled = (@s.fontawesome_enabled rescue false)
- return e(raw_label) unless fa_enabled && raw_label.include?("|")
+ lib = (@s.icon_library rescue "none").to_s
+ return e(raw_label) unless lib != "none" && raw_label.include?("|")
parts = raw_label.split("|", 2).map(&:strip)
- # Try to detect which side is the icon name (no spaces, short) vs label text
left, right = parts
if left.match?(/\A[\w-]+\z/) && left.length < 30
- # "iconname | Label" — icon before
- icon_html = ""
- "#{icon_html} #{e(right)}"
+ "#{icon_tag(left)} #{e(right)}"
elsif right.match?(/\A[\w-]+\z/) && right.length < 30
- # "Label | iconname" — icon after
- icon_html = ""
- "#{e(left)} #{icon_html}"
+ "#{e(left)} #{icon_tag(right)}"
else
e(raw_label)
end
diff --git a/lib/community_landing/style_builder.rb b/lib/community_landing/style_builder.rb
index d352a34..0b9f9fd 100644
--- a/lib/community_landing/style_builder.rb
+++ b/lib/community_landing/style_builder.rb
@@ -65,6 +65,8 @@ module CommunityLanding
cta_headline_light = safe_hex(:app_cta_headline_color_light)
cta_subtext_dark = safe_hex(:app_cta_subtext_color_dark)
cta_subtext_light = safe_hex(:app_cta_subtext_color_light)
+ footer_text_dark = safe_hex(:footer_text_color_dark)
+ footer_text_light = safe_hex(:footer_text_color_light)
orb_color = safe_hex(:orb_color)
orb_opacity = [[@s.orb_opacity.to_i, 0].max, 100].min rescue 50
@@ -101,6 +103,7 @@ module CommunityLanding
dark_extras << "\n --cl-video-btn-bg: #{video_btn_bg};"
dark_extras << "\n --cl-video-btn-glow: rgba(#{video_btn_rgb}, 0.35);"
end
+ dark_extras << "\n --cl-footer-text: #{footer_text_dark};" if footer_text_dark
light_extras = +""
light_extras << "\n --cl-navbar-signin-color: #{navbar_signin_light || navbar_signin_dark};" if navbar_signin_light || navbar_signin_dark
@@ -113,6 +116,7 @@ module CommunityLanding
light_extras << "\n --cl-video-btn-bg: #{video_btn_bg};"
light_extras << "\n --cl-video-btn-glow: rgba(#{video_btn_rgb}, 0.25);"
end
+ light_extras << "\n --cl-footer-text: #{footer_text_light || footer_text_dark};" if footer_text_light || footer_text_dark
"