Permalink
Browse files

Make the javascripts and stylesheets linked

  • Loading branch information...
1 parent 2cecbc1 commit 7d427ada6b2a2de032b1731b9fa120048580f1c5 @pusewicz committed May 20, 2010
Showing with 8 additions and 33 deletions.
  1. +4 −29 lib/sonia/helpers.rb
  2. +4 −4 views/index.haml
View
@@ -32,8 +32,8 @@ def websocket_url
Sonia::Server.websocket_url
end
- def joined_system_javascript
- files = %w(
+ def system_javascripts
+ %w(
/vendor/swfobject.js
/vendor/console.js
/vendor/FABridge.js
@@ -51,39 +51,14 @@ def joined_system_javascript
/javascripts/dispatcher.js
/javascripts/widget.js
)
-
- joined_javascript files.map { |file| File.join(Sonia.root, "public", file) }
end
- def joined_system_css
- files = %w(
+ def system_stylesheets
+ %w(
/blueprint/reset.css
/blueprint/grid.css
/stylesheets/sonia.css
)
-
- joined_css files.map { |file| File.join(Sonia.root, "public", file) }
- end
-
- def joined_widget_javascript
- joined_javascript Dir[Sonia.root + "/widgets/*/*.js"]
- end
-
- def joined_widget_css
- joined_javascript Dir[Sonia.root + "/widgets/*/*.css"]
- end
-
- private
- def joined_javascript(files)
- javascript = ""
-
- files.each do |file|
- javascript += "/** #{file} **/\n"
- javascript += File.read(file)
- end
-
- javascript
end
- alias_method :joined_css, :joined_javascript
end
end
View
@@ -8,10 +8,10 @@
%body
%h1 project sonia
#widgets
- %style(type="text/css")= joined_system_css
- %style(type="text/css")= joined_widget_css
- %script(type="text/javascript")= joined_system_javascript
- %script(type="text/javascript")= joined_widget_javascript
+ - (system_stylesheets + widget_stylesheets).each do |stylesheet|
+ %link(href=stylesheet media="screen" rel="stylesheet" type="text/css")
+ - (system_javascripts + widget_javascripts).each do |javascript|
+ %script(type="text/javascript" src=javascript)
:javascript
WebSocket.__swfLocation = "WebSocketMain.swf";

0 comments on commit 7d427ad

Please sign in to comment.