Skip to content

Commit

Permalink
🧹Make appearance defaults overrideable
Browse files Browse the repository at this point in the history
  • Loading branch information
laritakr committed Oct 2, 2023
1 parent 1e1d5f4 commit deec7e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/forms/hyrax/forms/admin/appearance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class Appearance
'facet_panel_text_color' => '#333333'
}.freeze

DEFAULT_VALUES = DEFAULT_FONTS.merge(DEFAULT_COLORS).freeze

# @param [Hash] attributes the list of parameters from the form
def initialize(attributes = {})
@attributes = attributes
Expand Down Expand Up @@ -430,8 +428,12 @@ def convert_to_rgba(hex_color, alpha = 0.5)
"rgba(#{rgb[0]}, #{rgb[1]}, #{rgb[2]}, #{alpha})"
end

def default_values
@default_values ||= DEFAULT_FONTS.merge(DEFAULT_COLORS)
end

def block_for(name, dynamic_default = nil)
ContentBlock.block_for(name: name, fallback_value: DEFAULT_VALUES[name] || dynamic_default)
ContentBlock.block_for(name: name, fallback_value: default_values[name] || dynamic_default)
end

# Persist a key/value tuple as a ContentBlock
Expand Down

0 comments on commit deec7e2

Please sign in to comment.