Permalink
Browse files

reload projects using ajax to hide errors.

  • Loading branch information...
1 parent b7b536b commit 67d131d7fefc19f3542d6a7a6297df99991125c7 Stepan Filatov committed Oct 21, 2011
View
@@ -13,3 +13,5 @@ gem 'crack'
gem 'hashie'
gem 'rash'
gem 'configatron'
+gem 'therubyracer'
+gem 'barista'
View
@@ -29,24 +29,34 @@ GEM
activesupport (= 3.0.10)
activesupport (3.0.10)
arel (2.0.10)
+ barista (1.2.1)
+ coffee-script (~> 2.2)
builder (2.1.2)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.2)
configatron (2.8.3)
yamler (>= 0.1.0)
crack (0.3.1)
erubis (2.6.6)
abstract (>= 1.0.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
hashie (1.2.0)
i18n (0.5.0)
jquery-rails (1.0.16)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.1)
+ libv8 (3.3.10.2)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
+ multi_json (1.0.3)
polyglot (0.3.2)
rack (1.2.4)
rack-mount (0.6.14)
@@ -82,6 +92,8 @@ GEM
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
temple (0.3.4)
+ therubyracer (0.9.8)
+ libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
@@ -94,6 +106,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ barista
configatron
crack
hashie
@@ -104,3 +117,4 @@ DEPENDENCIES
slim
slim-rails
sqlite3-ruby
+ therubyracer
@@ -4,8 +4,12 @@
class DashboardController < ApplicationController
def index
- rss = Hashie::Rash.new Crack::XML.parse(fetch_rss)
+ rss = Hashie::Rash.new Crack::XML.parse(fetch_rss.body)
@projects = (rss.projects? && rss.projects.project ? rss.projects.project : []).sort{|x, y| x.name <=> y.name}
+
+ if params[:projects]
+ render :partial => 'projects', :layout => false
+ end
end
private
@@ -20,12 +24,8 @@ def fetch_rss
response = http.request(req)
case response
- when Net::HTTPSuccess
- response.body
- when Net::HTTPRedirection
- fetch(response['location'], limit - 1)
- else
- response.error!
+ when Net::HTTPSuccess then response
+ else response.error!
end
end
end
@@ -0,0 +1,6 @@
+ul.tiles
+ - @projects.each do |project|
+ li class="tile #{project.last_build_status == 'Success' ? 'green' : 'red'}"
+ div
+ h2 = l(DateTime.strptime(project.last_build_time), :format => :time)
+ h3 = project.name.humanize
@@ -1,15 +1,7 @@
= content_for :head do
- meta http-equiv="refresh" content="60"
+ coffee:
+ $ ->
+ reload = () -> $("#page_home").load('/?projects=true')
+ setTimeout reload, 6000
section#page_home.page.current
- ul.tiles
- li.tile.banner.transparent
- div
- h1
- | Fix It
- span.right
- = l(Time.now, :format => :time)
- - @projects.each do |project|
- li class="tile #{project.last_build_status == 'Success' ? 'green' : 'red'}"
- div
- h2 = l(DateTime.strptime(project.last_build_time), :format => :time)
- h3 = project.name.humanize
+ = render :partial => 'projects'

0 comments on commit 67d131d

Please sign in to comment.