Skip to content

Commit b4d330c

Browse files
committed
Show warning in browsers that don't support needed features
Summary: Use modernizr to detect needed features and display the warning if any are missing. Test Plan: - Build assets - Open a page in Madison - If you have a crappy browser around use it - Otherwise edit one of the classes on the `<html>` element to be be `no-<name>` - Ensure the warning pops up Reviewers: sethetter Reviewed By: sethetter Maniphest Tasks: T277 Differential Revision: https://phabricator.opengovfoundation.org/D172
1 parent 51fb70e commit b4d330c

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ elixir((mix) => {
2222
'node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js',
2323
'node_modules/select2/dist/js/select2.min.js',
2424
'resources/assets/vendor/js/annotator-full.min.js',
25+
'resources/assets/vendor/js/modernizr-custom.js',
2526
],
2627
'public/js/vendor.js'
2728
)

resources/assets/sass/global.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ footer.nav {
9292
box-shadow: 0 0 5px 0 rgba(0,0,0,0.9);
9393
}
9494

95+
.no-flexbox,
96+
.no-cssvhunit,
97+
.no-cssvwunit {
98+
.alert.browser-support {
99+
display: block !important;
100+
}
101+
}
102+
95103
#content {
96104
background-color: white;
97105
position: relative;

resources/assets/vendor/js/modernizr-custom.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/lang/en/messages.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
'relevance_ordering_warning' => 'Ordering by relevance only works with a search query, default order has been used.',
4848
'manage' => 'Manage',
4949

50+
'browser_support_banner' => 'Your browser does not support needed features for Madison to function properly. Please upgrade to a modern browser.',
51+
5052
// Authentication Stuff
5153
'password' => 'Password',
5254
'confirm_password' => 'Confirm Password',

resources/views/layouts/app.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@
164164

165165
<div id="content">
166166
<div class="container">
167+
<div class="alert alert-warning alert-important browser-support hidden" role="alert">
168+
@lang('messages.browser_support_banner')
169+
</div>
170+
167171
@if (Auth::check() && Auth::user()->token)
168172
<div class="alert alert-info alert-important" role="alert">
169173
@php ($resendLink = route('users.resend_email_verification', Auth::user()))

tests/Browser/SponsorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public function testEnsuresAtLeastOneOwner()
327327
->with('tr#user-' . $owner->id, function ($userRow) use ($originalRole, $newRole) {
328328
$userRow->select('role', $newRole);
329329
})
330-
->assertSeeIn('.alert', trans('messages.sponsor_member.need_owner'))
330+
->assertSeeIn('.alert:not(.browser-support)', trans('messages.sponsor_member.need_owner'))
331331
->assertSeeIn('tr#user-' . $owner->id, trans('messages.sponsor_member.roles.' . $originalRole))
332332
;
333333
});

0 commit comments

Comments
 (0)