***************************************
<script type="text/javascript">
var timerFunction = function(){
console.log(this.hour, this.minute);
var second = this.second++;
if(this.second == 60) {
this.second=0;
this.minute++;
}
if(this.minute == 60) {
this.minute=0;
this.hour++;
}
var currentTime = this.hour+':'+this.minute+':'+this.second;
this.field.set('text', currentTime);
}
window.addEvent('domready', function() {
$$('.timer_start').addEvent('click', function(){
var task_id = this.getParent('.task').get('rel');
var time = this.getParent('.task').getElement('.actual_time span').get('text');
// var myRequest = new Request({url: '{% url timer %}'}).send();
// console.log('dddd',this,task_id,time);
var x = time.split(':');
var hour = x[0].toInt();
var minute = x[1].toInt();
console.log(hour,minute);
var currentCounter = new Hash({
second: 0,
minute: minute,
hour: hour,
field: this.getParent('.task').getElement('.actual_time span')
});
var simpleTimer = timerFunction.periodical(1000, currentCounter);
// $clear(simpleTimer);
return false;
});
});
</script>
{% block content %}
<h3> PROJECT DETAILS </h3>
<h4> Proje Name: {{ project.name }}</h4>
Estinated Time : {{ project.estimated_time}}
<p>
<a href="{% url task_add project.id %}"> Add Task </a>
</p>
<h3> TASKS </h3>
{% for task in project.tasks %}
<div class="task" rel="{{ task.id }}">
<h4> Task : {{ task.task_name}} </h4>
<p> Estimated time: {{ task.estimated_time }} </p>
<p class="actual_time"> Actual Time: <span>{{ task.actual_time }}</span></p>
<p>
<a href="{% url task_edit task.project_id task.id %}">Edit</a>
<a href="{% url task_delete task.project_id task.id %}"> Delete </a>
<input type="submit" value="Start" class="timer_start" />
</p>
</div>
{% endfor %}
{% endblock %}
***************************************
No comments:
Post a Comment