Skip to content

Commit

Permalink
Modification to timer Issue alaashafaee#209
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Fadel authored and Mohamed Fadel committed Apr 22, 2014
1 parent a92b4cf commit ca250a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tutor/app/assets/javascripts/problems.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ timer = ->
digit++
if digit > 59
min++
document.getElementById("mins").innerHTML = min
$(".mins").html min
digit = 0
if digit <= 9
digit = "0" + digit
document.getElementById("secs").innerHTML = digit
$(".secs").html digit
$("#sec").val($(".secs").html())
$("#min").val($(".mins").html())

activate = ->
unless timer_is_on
Expand Down
4 changes: 3 additions & 1 deletion tutor/app/views/solutions/_new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

<!-- Timer that starts when problem is shown -->
<b>Time spent:</b>
<span id="mins">0</span>:<span id="secs">00</span>
<span id="mins" class="mins">0</span>:<span id="secs" class="secs">00</span>

<%= form_for :solution,
:url => { :controller => "solutions", :action => "create" },
:html => {:method => :post} do |f| %>
<%= @code = f.text_area :code, placeholder: "Write your code here and then click submit",
class: "editor" %>
<%= f.hidden_field :mins, id: "min", value: "" %>
<%= f.hidden_field :secs, id: "sec", value: "" %>
<%= f.hidden_field :problem_id, value: params[:id] %>
<br>
<table width='100%'>
Expand Down
Binary file modified tutor/db/development.sqlite3
Binary file not shown.

0 comments on commit ca250a2

Please sign in to comment.