-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 @@ | ||
module BrandLogoHelper | ||
def render_brand_logo | ||
return unless should_render_logo? | ||
render 'application/brand_logo' | ||
end | ||
|
||
private | ||
|
||
def should_render_logo? | ||
current_organization&.id == branded_organization_id | ||
end | ||
|
||
def branded_organization_id | ||
Rails.application.config.branded_organization_id | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="container" style="margin-bottom: 30px"> | ||
<%= image_tag("redeira.png", class: 'organization-brand-logo img-responsive center-block') %> | ||
</div> |
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,7 @@ | ||
DEFAULT_BRANDED_ORG_ID = 246 | ||
|
||
Rails.application.config.branded_organization_id = nil | ||
|
||
unless Rails.env.test? | ||
Rails.application.config.branded_organization_id = (Redis.current.get('branded_organization_id') || DEFAULT_BRANDED_ORG_ID).to_i | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.feature 'sign in' do | ||
let(:user) do | ||
user = Fabricate( | ||
:user, | ||
email: '[email protected]', | ||
password: 'papapa22', | ||
terms_accepted_at: 1.day.from_now | ||
) | ||
|
||
user.add_to_organization(organization) | ||
|
||
user | ||
end | ||
|
||
let(:organization) { Fabricate(:organization) } | ||
|
||
context 'with a branded org id' do | ||
before do | ||
allow(Rails.application.config).to receive(:branded_organization_id).and_return(organization.id) | ||
sign_in_with(user.email, user.password) | ||
end | ||
|
||
it 'renders the logo' do | ||
expect(page).to have_css('.organization-brand-logo') | ||
end | ||
end | ||
|
||
context 'without a branded org id' do | ||
before do | ||
allow(Rails.application.config).to receive(:branded_organization_id).and_return(1234) | ||
sign_in_with(user.email, user.password) | ||
end | ||
|
||
it 'does not render the logo' do | ||
expect(page).to have_no_css('.organization-brand-logo') | ||
end | ||
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