Skip to content

Commit

Permalink
detect template string ondersteuning
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Apr 7, 2016
1 parent 8e96f5c commit 201a44d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
7 changes: 7 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require vendor
//= require bootstrap
//= require_self
//= require_directory .
//= require judge/utils.js
//= require judge/diff.js
//= require judge/feedbackTable.js

$(function () {
if (!Modernizr.templatestrings) {
$(".messages").append("<div class='alert alert-warning'>Sorry, je browser lijkt niet alle nodige JavaScript features te ondersteunen. Met een recente versie van Google Chrome of Firefox zou alles moeten werken.</div>")
}
});
18 changes: 10 additions & 8 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<![endif]-->

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag :modernizr %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
Expand All @@ -37,15 +38,16 @@
</div>
</nav>
<div class="container">

<% flash.each do |key, value| %>
<% unless value.nil? %>
<%= content_tag(:div, value, :class => "alert alert-info") if key == "notice" %>
<%= content_tag(:div, raw("<strong>Oh snap!</strong> ")+value, :class => "alert alert-danger") if key == "error" %>
<%= content_tag(:div, raw("<strong>Opgepast!</strong> ")+value, :class => "alert alert-warning") if key == "alert" %>
<%= content_tag(:div, value, :class => "alert alert-success") if key == "success" %>
<div class="messages">
<% flash.each do |key, value| %>
<% unless value.nil? %>
<%= content_tag(:div, value, :class => "alert alert-info") if key == "notice" %>
<%= content_tag(:div, raw("<strong>Oh snap!</strong> ")+value, :class => "alert alert-danger") if key == "error" %>
<%= content_tag(:div, raw("<strong>Opgepast!</strong> ")+value, :class => "alert alert-warning") if key == "alert" %>
<%= content_tag(:div, value, :class => "alert alert-success") if key == "success" %>
<% end %>
<% end %>
<% end %>
</div>

<%= yield %>
</div>
Expand Down
3 changes: 3 additions & 0 deletions vendor/assets/javascripts/modernizr/modernizr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/assets/javascripts/vendor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require modernizr/modernizr.min.js

0 comments on commit 201a44d

Please sign in to comment.