-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from alphagov/iterate-branding
Iterate branding model
- Loading branch information
Showing
8 changed files
with
76 additions
and
25 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
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
25 changes: 25 additions & 0 deletions
25
lib/govuk_publishing_components/app_helpers/brand_helper.rb
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,25 @@ | ||
module GovukPublishingComponents | ||
module AppHelpers | ||
class BrandHelper | ||
def initialize(brand) | ||
@brand = brand if brand | ||
end | ||
|
||
# Apply government organisation branding to individual components, specifically | ||
# link colour and border colour | ||
# see https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md | ||
|
||
def brand_class | ||
"brand--#{@brand}" if @brand | ||
end | ||
|
||
def border_color_class | ||
"brand__border-color" if @brand | ||
end | ||
|
||
def color_class | ||
"brand__color" if @brand | ||
end | ||
end | ||
end | ||
end |
17 changes: 0 additions & 17 deletions
17
lib/govuk_publishing_components/presenters/brand_helper.rb
This file was deleted.
Oops, something went wrong.
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 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe GovukPublishingComponents::AppHelpers::BrandHelper do | ||
describe "Brand helper" do | ||
it "returns nothing if no brand is specified" do | ||
brand = GovukPublishingComponents::AppHelpers::BrandHelper.new(nil) | ||
|
||
expect(brand.brand_class).to eql(nil) | ||
expect(brand.border_color_class).to eql(nil) | ||
expect(brand.color_class).to eql(nil) | ||
end | ||
|
||
it "returns the expected brand" do | ||
brand = GovukPublishingComponents::AppHelpers::BrandHelper.new('attorney-generals-office') | ||
|
||
expect(brand.brand_class).to eql('brand--attorney-generals-office') | ||
expect(brand.border_color_class).to eql('brand__border-color') | ||
expect(brand.color_class).to eql('brand__color') | ||
end | ||
end | ||
end |