From: Michael Neumann Date: 2005-02-02T05:44:34+09:00 Subject: [ANN] Wee 0.7.0 + Tutorial Videos Hi, Wee 0.7.0 is out! In addition, I've recorded three tutorial sessions (screen captures). You can download the MPEGs via BitTorrent here: http://rubyforge.org/frs/?group_id=427&release_id=1528 I'm open for suggestions and thankful for comments. If possible, please let you BitTorrent client open. The first tutorial is about installing Wee, creating an initial skeleton application, simple forms and explains briefly decorations. The second is about subcomponents and backtracking. The third is on using Wee together with Og and a Postgres database. == Philosophy/Features of Wee http://rubytalk.com/128432 == Download and Installation http://rubyforge.org/projects/wee gem install wee Have a look at the 'wee' command! == ChangeLog Major changes (compared to 0.5.0) are: * Added ERB-templating. Example: # file: ~/components/main.rb class Test < Wee::Component # use template '~/components/main.tpl' template :render # use template '~/components/main.tpl-buttons' template :render_buttons end This allows you to use ERB-templates instead of the render_XXX methods. You can also call render_XXX methods from ERB, back and forth. The template file is relative to the file from which the 'template :symbol' call is executed. The template method optionally takes the two hash-parameters :file and :property. * Added "Pageless" mode. In pageless mode, the URL displayed in your browser always looks like "/app". The session id is stored as cookie and there is no page_id, hence "pageless" mode. No backtracking is performed! Example: require 'wee/pageless' app = Wee::Utils.app_for(YourMainComponent, :session => Wee::PagelessSession, :application => Wee::PagelessApplication) Wee::WEBrickAdaptor. request_class(Wee::PagelessRequest). register('/app' => app). start * Added named callbacks. Example: r.anchor.named_callback('test') { ... } will use 'test' as callback_id instead of a generic one. * added 'wee' binary which generates a sample application and recommended directory structure for you (similar to the 'rails' command). * Wee::Request: Refactored a lot. Use =/ instead of @ as delimeter for the request_handler_id/page_id part ('@' looks ugly in Konqueror, as it is displayed as '%40') * Implemented a new OgScaffolder, which now is more like the Rails one. Changes that break compatibility: * Wee::LiteralMethodCallback and Component#call: Additional arguments are now prepended instead of appended. Example: call MessageBox.new('msg'), :confirm, 1 def confirm(one, msgbox_result) end * Methods ImageTag#src_for and GenericTagBrush#css_class_for no more prepend 'img.' or 'css.' in front of the property name. * Method Wee::Utils.app_for: Removed the id_seed option. Use id_gen instead, which expects a IdGenerator object (default is now the much more secure Md5IdGenerator). * SelectListTag (r.select_list): NON-backwards-compatible change!!! If it's NOT a multiple select list, then the callback is called with the choosen value (instead of an array of one element). Method #selected requires a single value in the same way. No changes if it's a multiple-select list! For the full list of changes see: http://www.ntecs.de/viewcvs/viewcvs/Wee/trunk/ChangeLog?view=auto == Hello World require 'wee' class HelloWorld < Wee::Component def click @clicks = (@clicks || 0) + 1 end def render r.h1.onclick_callback(:click).with("Hello World!") r.text "#{ @clicks || 'No' } clicks" end end # And start the WEBrick web-server require 'wee/utils' require 'wee/adaptors/webrick' app = Wee::Utils.app_for { HelloWorld.new.add_decoration(Wee::PageDecoration.new("Hello World")) } Wee::WEBrickAdaptor.register('/app' => app).start Make sure you run this application with the -rubygems option. Then point your browser to http://localhost:2000/app and click on the h1-header. Every time you click on it, you should see that the number of clicks increases. Have fun! == Future? I'd like improve the integration of models with Wee. Regards, Michael