-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Favor class_attribute over constant
In Adventist, we're needing to override the constant's values. By making this a class_attribute we can more readily do the override via configuration instead of obliteration of a constant.
- Loading branch information
Showing
5 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/views/hyrax/admin/appearances/_default_colors_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<%= simple_form_for @form, url: admin_appearance_path do |f| %> | ||
<div class="panel-body defaultable-colors"> | ||
<% @form.class::DEFAULT_COLORS.each do |color_name, hex| %> | ||
<% @form.default_colors.each do |color_name, hex| %> | ||
<%= render 'color_input', f: f, color_name: color_name, hex: hex %> | ||
<% end %> | ||
</div> | ||
<div class="panel-footer"> | ||
<%= link_to 'Restore All Defaults', '#color', class: 'btn btn-default restore-all-default-colors' %> | ||
<%= f.submit class: 'btn btn-primary pull-right' %> | ||
</div> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe Hyrax::Forms::Admin::Appearance do | ||
describe '.default_fonts' do | ||
subject { described_class.default_fonts } | ||
|
||
it { is_expected.to be_a(Hash) } | ||
|
||
it "has the 'body_font' and 'headline_font' keys" do | ||
expect(subject.keys).to match_array(['body_font', 'headline_font']) | ||
end | ||
end | ||
|
||
describe '.default_colors' do | ||
subject { described_class.default_colors } | ||
|
||
it { is_expected.to be_a(Hash) } | ||
end | ||
end |