tweaking celebration counter in the home

Esse commit está contido em:
Diogo Biazus
2013-08-30 18:58:49 -03:00
commit 15f530de93
6 arquivos alterados com 36 adições e 2 exclusões
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 268 KiB

+25 -1
Ver Arquivo
@@ -14,6 +14,11 @@ App.addChild('Counter', {
this.initial = parseFloat(this.$el.data('initial'));
this.rate = parseFloat(this.$el.data('rate'));
this.current = this.initial;
if(this.current >= this.max){
$('.counter_panel.dynamic').hide();
$('.counter_panel.static').fadeIn(5000);
return;
}
var that = this;
var currentDigits = lpad(this.current.toString(), "0", this.max.toString().length);
@@ -37,7 +42,26 @@ App.addChild('Counter', {
this.timer = window.setInterval(function(){ that.incrementCounter() }, 1000);
},
changeBanner: function(){
$('.counter_panel.dynamic').fadeOut('slow', function(){
$('.counter_panel.static').fadeIn('slow');
});
},
fetchCounter: function(){
var that = this;
$.get("/pt/projects/total_backed").success(function(data){
var value = parseInt(data);
if(value >= that.max){
window.clearTimeout(that.timer);
var delta = that.max - that.current;
that.incrementDigit((that.digits.length - 1), delta);
that.digits.each(function(){
that.select($(this));
});
window.setTimeout(that.changeBanner, 3500);
}
});
},
incrementCounter: function(){
@@ -62,7 +86,7 @@ App.addChild('Counter', {
if(digitIndex < 0){
console.log('out of digits');
}
if(delta == 0){
if(delta <= 0){
return;
}
var digit = $(this.digits[digitIndex]);
@@ -6,6 +6,10 @@
overflow: hidden
+border-radius(4px)
&.static
background: image-url('flipclock/bg_rewards.jpg') left top no-repeat
display: none
.counter_title
text-transform: uppercase
font-size: 15px
+4
Ver Arquivo
@@ -19,6 +19,10 @@ class ProjectsController < ApplicationController
)
end
def total_backed
render json: backer_stats["sum"]
end
def index
index! do |format|
format.html do
+2 -1
Ver Arquivo
@@ -1,4 +1,5 @@
.counter_panel
.counter_panel.static
.counter_panel.dynamic
.counter_title
| Apoie&nbsp;&nbsp;um&nbsp;&nbsp;projeto&nbsp;&nbsp;e&nbsp;&nbsp;vamos&nbsp;&nbsp;juntos&nbsp;&nbsp;aos&nbsp;&nbsp;R$&nbsp;10&nbsp;&nbsp;milhões&nbsp;&nbsp;arrecadados!
.counter[data-max="10000000" data-initial="#{backer_stats['sum'].to_i}" data-rate="#{backer_stats['rate'] || 1.07851851851851851852}"]
+1
Ver Arquivo
@@ -90,6 +90,7 @@ Catarse::Application.routes.draw do
end
collection do
get 'video'
get 'total_backed'
end
member do
put 'pay'