summaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-11-21 15:21:41 +0100
committerJochen Topf <jochen@topf.org>2010-11-21 15:21:41 +0100
commita3183f7250ad30653591073993c53ffc940a4f32 (patch)
tree03f9aaa683948d17ee6896a8a864af21aac05a8f /web/lib
parentaa43dcd92a2f83a6c32f29c2460b02964e6b1598 (diff)
downloadtaginfo-a3183f7250ad30653591073993c53ffc940a4f32.tar
taginfo-a3183f7250ad30653591073993c53ffc940a4f32.tar.gz
make javascript helpers more flexible
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/javascript.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/web/lib/javascript.rb b/web/lib/javascript.rb
index 7f43d44..f37646b 100644
--- a/web/lib/javascript.rb
+++ b/web/lib/javascript.rb
@@ -15,7 +15,7 @@ class Javascript
if file.nil?
c = ''
r = yield c
- @content = c + r
+ @content = (c == '' ? r : c)
else
@file = file
end
@@ -40,8 +40,10 @@ class JQuery
extend R18n::Helpers
def self.ready
+ page = ''
+ content = yield page
"jQuery(document).ready(function() {\n" +
- yield +
+ (page=='' ? content : page) +
"});\n"
end
@@ -77,7 +79,7 @@ class JS
#
def self.raw(code)
code.instance_eval do
- def to_json
+ def to_json(state=nil)
to_s
end
end