Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Destaca pontos com horário alterado e horário original.

  • Loading branch information...
commit 7ddfbd1cfcdf360e0746573a3b8bad27441e486d 1 parent 0a48f9f
@bernardo bernardo authored
View
BIN  app/assets/images/icon_clock_green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/icon_clock_red.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/rails.png
Deleted file not rendered
View
4 app/models/punch.rb
@@ -32,5 +32,9 @@ def entrance?
def exit?
!entrance?
end
+
+ def altered?
+ (self.punched_at - self.created_at).abs > 15.minutes
+ end
end
View
7 app/views/application/_punch.erb
@@ -14,6 +14,13 @@
</div>
</td>
<td class="text"><%= punch.comment %></td>
+ <td class="kind">
+ <% if not punch.altered? %>
+ <%= image_tag "icon_clock_green.png", :title => "Ponto com Horário Original" %>
+ <% else %>
+ <%= image_tag "icon_clock_red.png", :title => "Ponto com Horário Alterado" %>
+ <% end %>
+ </td>
<td class="actions">
<%= f.submit "Alterar" %>
<%= link_to 'remover', punch, :confirm => 'Tem certeza?', :method => :delete, :remote => true %>
Please sign in to comment.
Something went wrong with that request. Please try again.