Permalink
Browse files

Cleanup examples

  • Loading branch information...
1 parent bd190cf commit cea6367ec979bd2de1b32b94a01eac34be18a3a1 @mneumann mneumann committed Apr 6, 2009
Showing with 19 additions and 688 deletions.
  1. +18 −1 examples/ajax.rb
  2. +0 −444 examples/ajax/ajax.js
  3. +0 −31 examples/ajax/ajax.rb
  4. +1 −1 examples/continuations.rb
  5. +0 −37 examples/dispatcher.rb
  6. +0 −94 examples/draw.rb
  7. +0 −45 examples/live-update.rb
  8. +0 −35 examples/login_decoration.rb
View
@@ -16,7 +16,12 @@ def backtrack(state)
end
def render(r)
- r.div.oid.onclick_update_self_callback { @counter += 1 }.with(@counter.to_s)
+ r.once(self.class) {
+ r.css "div.wee-AjaxCounter a { border: 1px solid blue; padding: 5px; background-color: #ABABAB; };"
+ }
+ r.div.css_class('wee-AjaxCounter').oid.with {
+ r.anchor.onclick_update_self_callback { @counter += 1 }.with(@counter.to_s)
+ }
end
end
@@ -33,11 +38,20 @@ def render(r)
Wee::JQuery.javascript_includes(r)
}
r.body {
+ render_hello(r)
r.div.onclick_callback { p "refresh" }.with("Refresh")
@cs.each {|c| r.render(c); r.break}
}
}
end
+
+ def render_hello(r)
+ @hello ||= "Hello"
+ r.div.id("hello").onclick_update_callback {|r|
+ @hello.reverse!
+ render_hello(r)
+ }.with(@hello)
+ end
end
if __FILE__ == $0
@@ -50,5 +64,8 @@ def render(r)
}
end
end
+ puts
+ puts "Open your browser at: http://localhost:2000/ajax"
+ puts
Rack::Handler::WEBrick.run(app, :Port => 2000)
end
Oops, something went wrong.

0 comments on commit cea6367

Please sign in to comment.