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
13 changed files
with
106 additions
and
1 deletion.
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
16 changes: 16 additions & 0 deletions
16
app/assets/stylesheets/active_admin/components/_unsupported_browser.css.scss
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 @@ | ||
.unsupported_browser { | ||
padding: 10px 30px; | ||
color: #211e14; | ||
background-color: #fae692; | ||
@include gradient(#feefae, #fae692); | ||
border-bottom: 1px solid #b3a569; | ||
|
||
h1 { | ||
font-size: 13px; | ||
font-weight: bold; | ||
} | ||
|
||
p { | ||
margin-bottom: 0.5em; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -282,3 +282,7 @@ form { | |
} | ||
} | ||
} | ||
|
||
.unsupported_browser { | ||
display: none; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module ActiveAdmin | ||
module Views | ||
class UnsupportedBrowser < Component | ||
def build | ||
super() | ||
|
||
h1 I18n.t("active_admin.unsupported_browser.headline").html_safe | ||
para I18n.t("active_admin.unsupported_browser.recommendation").html_safe | ||
para I18n.t("active_admin.unsupported_browser.turn_off_compatibility_view").html_safe | ||
end | ||
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
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,48 @@ | ||
require 'rails_helper' | ||
|
||
describe ActiveAdmin::Views::UnsupportedBrowser do | ||
|
||
let(:helpers){ mock_action_view } | ||
let(:namespace) { double :namespace, unsupported_browser_matcher: /MSIE [1-8]\.0/ } | ||
let(:component) { double :unsupported_browser_component } | ||
let(:view_factory) { double :view_factory, unsupported_browser: component } | ||
let(:base) { ActiveAdmin::Views::Pages::Base.new } | ||
|
||
def build_panel | ||
render_arbre_component({}, helpers) do | ||
insert_tag ActiveAdmin::Views::UnsupportedBrowser | ||
end | ||
end | ||
|
||
it "should render the panel", focus: true do | ||
expect(ActiveAdmin::Views::UnsupportedBrowser::I18n).to receive(:t).and_return("headline", "recommendation" ,"turn_off_compatibility_view") | ||
|
||
expect(build_panel.content.gsub(/\s+/, "")).to eq "<h1>headline</h1><p>recommendation</p><p>turn_off_compatibility_view</p>" | ||
end | ||
|
||
describe "ActiveAdmin::Views::Pages::Base behavior" do | ||
context "when the reqex match" do | ||
|
||
it "should build the unsupported browser panel" do | ||
expect(base).to receive(:active_admin_namespace).and_return(namespace) | ||
expect(base).to receive(:env).and_return({ "HTTP_USER_AGENT" => "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0)" }) | ||
expect(base).to receive(:view_factory).and_return(view_factory) | ||
expect(base).to receive(:insert_tag).with(component) | ||
base.send(:build_unsupported_browser) | ||
end | ||
|
||
end | ||
|
||
context "when the reqex not match", focus: true do | ||
|
||
it "should not build the unsupported browser panel" do | ||
expect(base).to receive(:active_admin_namespace).and_return(namespace) | ||
expect(base).to receive(:env).and_return({ "HTTP_USER_AGENT" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)" }) | ||
expect(base).to receive(:insert_tag).never | ||
base.send(:build_unsupported_browser) | ||
end | ||
|
||
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