Skip to content

Commit

Permalink
Restore colours for out-of-range BG
Browse files Browse the repository at this point in the history
  • Loading branch information
pikesley committed Jan 31, 2016
1 parent 06d5cf7 commit e318c24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions app/views/shared/_javascripts.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script>
$('.glucose-measurement-value').each(function() {
if($(this).text() > 8.0) {
$('.glucose-measurement-value .value').each(function() {
var value = $(this).text().trim().split(' ')[0]
if(value > 8.0) {
$(this).addClass('bg-high')
}
if($(this).text() < 4.0) {
if(value < 4.0) {
$(this).addClass('bg-low')
}
})
Expand Down
7 changes: 4 additions & 3 deletions app/views/welcome/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
<% count = 0 %>
<% class_name(value).fields.each do |field| %>
<td class='<%= "#{value.class.name.underscore.gsub('_', '-')}-#{field}" %>'>
<%= value.send(field) %>
<% if value.class.units[:applies_to] == field.to_sym %>
<span data-toggle='tooltip' data-placement='top' title='<%= value.send(field) %> <%= value.class.units[:full] %>'>
<%= value.class.units[:short] %>
<span class='value' data-toggle='tooltip' data-placement='top' title='<%= value.send(field) %> <%= value.class.units[:full] %>'>
<%= value.send(field) %> <%= value.class.units[:short] %>
</span>
<% else %>
<%= value.send(field) %>
<% end %>
</td>
<% count += 1 %>
Expand Down

0 comments on commit e318c24

Please sign in to comment.