Rebased and changes in countdown timer logic

This commit is contained in:
Gopesh Tulsyan 2014-05-28 11:10:05 +05:30
parent 25038a2c22
commit c567b0d0ab
2 changed files with 35 additions and 33 deletions

View file

@ -12,6 +12,9 @@
= @conference.call_for_papers.description = @conference.call_for_papers.description
%p Proposals will be accepted between #{ date_string(@conference.call_for_papers.start_date, @conference.call_for_papers.end_date) } %p Proposals will be accepted between #{ date_string(@conference.call_for_papers.start_date, @conference.call_for_papers.end_date) }
- if @conference.cfp_open? - if @conference.cfp_open?
- if @conference.call_for_papers.end_date.to_time < Time.now
%p Today is the last day. Hurry Up!
- else
%div.row.col-md-12.col-md-offset-2 %div.row.col-md-12.col-md-offset-2
%div.col-md-2 %div.col-md-2
%h2#days %h2#days
@ -27,18 +30,17 @@
%p Seconds %p Seconds
%p %p
= link_to "Submit Your Proposals Today", conference_proposal_index_path(@conference.short_title), class: 'btn btn-info', target: '_blank' = link_to "Submit Your Proposals Today", conference_proposal_index_path(@conference.short_title), class: 'btn btn-info', target: '_blank'
-else
%h3 Deadline has ended
:javascript :javascript
$( document ).ready(function(){ $( document ).ready(function(){
var target_date = new Date("#{@conference.call_for_papers.end_date}").getTime(); var target_date = new Date("#{@conference.call_for_papers.end_date}").getTime();
if(target_date > new Date().getTime())
var days, hours, minutes, seconds; var days, hours, minutes, seconds;
setInterval(function () { setInterval(function () {
var current_date = new Date().getTime(); var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000; var seconds_left = (target_date - current_date) / 1000;
days = parseInt(seconds_left / 86400); days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400; seconds_left = seconds_left % 86400;
@ -48,7 +50,7 @@
minutes = parseInt(seconds_left / 60); minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60); seconds = parseInt(seconds_left % 60);
$('#days').text(days) $('#days').text(days);
$('#hours').text(hours); $('#hours').text(hours);
$('#minutes').text(minutes); $('#minutes').text(minutes);
$('#seconds').text(seconds); $('#seconds').text(seconds);

View file

@ -9,7 +9,7 @@
= conference.title = conference.title
%small %small
%b %b
= conference_date_string(conference.start_date, conference.end_date) = conference_date_string(conference)
- if conference.venue.name and conference.venue.website and conference.venue.address - if conference.venue.name and conference.venue.website and conference.venue.address
%p %p
%small %small