wee 0.10.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +127 -0
- data/Rakefile +11 -32
- data/doc/rdoc/classes/Array.html +28 -24
- data/doc/rdoc/classes/Hash.html +28 -24
- data/doc/rdoc/classes/Object.html +37 -84
- data/doc/rdoc/classes/String.html +89 -21
- data/doc/rdoc/classes/Struct.html +32 -82
- data/doc/rdoc/classes/Wee.html +285 -86
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +111 -48
- data/doc/rdoc/classes/Wee/{Context.html → AnswerDecoration/Answer.html} +61 -51
- data/doc/rdoc/classes/Wee/Application.html +161 -322
- data/doc/rdoc/classes/Wee/Application/SessionCache.html +162 -0
- data/doc/rdoc/classes/Wee/Brush.html +147 -62
- data/doc/rdoc/classes/{Enumerable.html → Wee/Brush/ActionInputTag.html} +68 -41
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +150 -100
- data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +132 -46
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +63 -41
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +184 -78
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +48 -65
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +83 -37
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +334 -310
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +74 -54
- data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +58 -43
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +64 -74
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +109 -86
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +205 -45
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +96 -34
- data/doc/rdoc/classes/Wee/Brush/Page.html +129 -67
- data/doc/rdoc/classes/Wee/{Utils/LRUCache.html → Brush/PasswordInputTag.html} +65 -38
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +132 -78
- data/doc/rdoc/classes/Wee/Brush/{RadioButtonTag/RadioGroup.html → RadioGroup.html} +91 -53
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +301 -127
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +96 -33
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +59 -44
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +94 -57
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +96 -33
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +181 -121
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +94 -32
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +257 -71
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +58 -43
- data/doc/rdoc/classes/Wee/CallAnswerMixin.html +289 -0
- data/doc/rdoc/classes/Wee/CallbackMixin.html +233 -0
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +179 -155
- data/doc/rdoc/classes/Wee/Callbacks.html +262 -0
- data/doc/rdoc/classes/Wee/Component.html +228 -779
- data/doc/rdoc/classes/Wee/Decoration.html +144 -159
- data/doc/rdoc/classes/Wee/DecorationMixin.html +340 -0
- data/doc/rdoc/classes/Wee/Delegate.html +119 -76
- data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +64 -47
- data/doc/rdoc/classes/Wee/ErrorResponse.html +59 -62
- data/doc/rdoc/classes/Wee/FormDecoration.html +51 -37
- data/doc/rdoc/classes/Wee/GenericResponse.html +60 -35
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +1000 -602
- data/doc/rdoc/classes/Wee/HtmlDocument.html +288 -0
- data/doc/rdoc/classes/Wee/HtmlWriter.html +227 -126
- data/doc/rdoc/classes/Wee/IdGenerator.html +60 -31
- data/doc/rdoc/classes/Wee/IdGenerator/Secure.html +282 -0
- data/doc/rdoc/classes/Wee/{SimpleIdGenerator.html → IdGenerator/Sequential.html} +76 -49
- data/doc/rdoc/classes/Wee/JQuery.html +221 -0
- data/doc/rdoc/classes/Wee/LRUCache.html +514 -0
- data/doc/rdoc/classes/Wee/LRUCache/Item.html +158 -0
- data/doc/rdoc/classes/Wee/ObjectSnapshotMixin.html +187 -0
- data/doc/rdoc/classes/Wee/PageDecoration.html +88 -59
- data/doc/rdoc/classes/Wee/Presenter.html +124 -704
- data/doc/rdoc/classes/Wee/RedirectResponse.html +64 -33
- data/doc/rdoc/classes/Wee/RefreshResponse.html +59 -44
- data/doc/rdoc/classes/Wee/Renderer.html +234 -54
- data/doc/rdoc/classes/Wee/Request.html +151 -286
- data/doc/rdoc/classes/Wee/Response.html +29 -212
- data/doc/rdoc/classes/Wee/Session.html +585 -360
- data/doc/rdoc/classes/Wee/{StateHolder.html → Session/AbortCallbackProcessing.html} +67 -40
- data/doc/rdoc/classes/Wee/Session/MutexSerializer.html +166 -0
- data/doc/rdoc/classes/{Cache/Strategy/LFU/Item.html → Wee/Session/Page.html} +26 -27
- data/doc/rdoc/classes/Wee/Session/ThreadSerializer.html +219 -0
- data/doc/rdoc/classes/Wee/State.html +307 -0
- data/doc/rdoc/classes/{Cache/Strategy/LRU/Item.html → Wee/State/Snapshot.html} +26 -27
- data/doc/rdoc/classes/{Cache/Strategy/Unbounded/Item.html → Wee/State/SnapshotIVars.html} +26 -27
- data/doc/rdoc/classes/Wee/StructSnapshotMixin.html +183 -0
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +101 -35
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +243 -0
- data/doc/rdoc/files/lib/wee/application_rb.html +22 -30
- data/doc/rdoc/files/lib/wee/{page_rb.html → call_answer_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/callback_rb.html +12 -29
- data/doc/rdoc/files/lib/wee/component_rb.html +22 -27
- data/doc/rdoc/files/lib/wee/decoration_rb.html +19 -20
- data/doc/rdoc/files/lib/wee/{idgen_rb.html → html_brushes_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/html_canvas_rb.html +15 -23
- data/doc/rdoc/files/lib/wee/{abstractsession_rb.html → html_document_rb.html} +17 -25
- data/doc/rdoc/files/lib/wee/html_writer_rb.html +15 -23
- data/doc/rdoc/files/lib/wee/{webrick_rb.html → id_generator_rb.html} +19 -25
- data/doc/rdoc/files/lib/wee/{core/page_rb.html → jquery/jquery_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/{state_registry_rb.html → jquery_rb.html} +17 -27
- data/doc/rdoc/files/lib/{cache/cache_rb.html → wee/lru_cache_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/presenter_rb.html +12 -34
- data/doc/rdoc/files/lib/wee/{holder_rb.html → renderer_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/request_rb.html +18 -32
- data/doc/rdoc/files/lib/wee/response_rb.html +17 -24
- data/doc/rdoc/files/lib/wee/session_rb.html +21 -23
- data/doc/rdoc/files/lib/wee/state_rb.html +90 -0
- data/doc/rdoc/files/lib/wee_rb.html +48 -40
- data/doc/rdoc/fr_class_index.html +111 -75
- data/doc/rdoc/fr_file_index.html +46 -76
- data/doc/rdoc/fr_method_index.html +473 -480
- data/doc/rdoc/index.html +6 -9
- data/doc/rdoc/rdoc-style.css +210 -119
- data/examples/ObjectSpaceBrowser.rb +33 -23
- data/examples/ajax.rb +71 -0
- data/examples/continuations.rb +28 -0
- data/examples/demo.rb +92 -36
- data/examples/demo/calculator.rb +63 -0
- data/examples/demo/calendar.rb +42 -55
- data/examples/demo/counter.rb +38 -0
- data/{lib/wee/examples → examples/demo}/editable_counter.rb +11 -6
- data/examples/demo/example.rb +28 -24
- data/examples/demo/file_upload.rb +19 -0
- data/{lib/wee/components → examples/demo}/messagebox.rb +3 -3
- data/examples/demo/radio.rb +33 -0
- data/{lib/wee/examples → examples/demo}/window.rb +15 -10
- data/examples/hw.rb +3 -4
- data/{lib/wee/components → examples}/pager.rb +14 -14
- data/lib/wee.rb +48 -25
- data/lib/wee/application.rb +69 -131
- data/lib/wee/call_answer.rb +118 -0
- data/lib/wee/callback.rb +88 -0
- data/lib/wee/component.rb +141 -0
- data/lib/wee/decoration.rb +242 -0
- data/lib/wee/html_brushes.rb +725 -0
- data/lib/wee/html_canvas.rb +241 -0
- data/lib/wee/html_document.rb +45 -0
- data/lib/wee/html_writer.rb +71 -0
- data/lib/wee/id_generator.rb +70 -0
- data/lib/wee/jquery.rb +1 -0
- data/lib/wee/jquery/jquery.rb +17 -0
- data/lib/wee/jquery/public/jquery-1.3.2.min.js +19 -0
- data/lib/wee/jquery/public/wee-jquery.js +19 -0
- data/lib/wee/lru_cache.rb +89 -0
- data/lib/wee/presenter.rb +43 -0
- data/lib/wee/renderer.rb +65 -0
- data/lib/wee/request.rb +37 -113
- data/lib/wee/response.rb +43 -70
- data/lib/wee/session.rb +304 -113
- data/lib/wee/state.rb +85 -0
- data/test/component_spec.rb +17 -0
- data/wee.gemspec +4 -3
- metadata +249 -452
- data/ChangeLog +0 -657
- data/INSTALL +0 -17
- data/README +0 -272
- data/TODO +0 -142
- data/benchmark/Centrino1300/result.2000.counter.action +0 -45
- data/benchmark/Centrino1300/result.2000.counter.render +0 -43
- data/benchmark/Centrino1300/result.2000.filehandler +0 -43
- data/benchmark/Centrino600/result.2000.counter.action +0 -47
- data/benchmark/Centrino600/result.2000.counter.render +0 -45
- data/benchmark/Centrino600/result.2000.filehandler +0 -43
- data/benchmark/Makefile +0 -53
- data/benchmark/counter.rb +0 -77
- data/benchmark/filehandler.rb +0 -6
- data/benchmark/report_req.rb +0 -12
- data/bin/wee +0 -100
- data/doc/rdoc/classes/ActionView.html +0 -107
- data/doc/rdoc/classes/ActionView/Base.html +0 -133
- data/doc/rdoc/classes/Cache.html +0 -126
- data/doc/rdoc/classes/Cache/StorageCache.html +0 -320
- data/doc/rdoc/classes/Cache/Strategy.html +0 -128
- data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +0 -269
- data/doc/rdoc/classes/Cache/Strategy/LFU.html +0 -238
- data/doc/rdoc/classes/Cache/Strategy/LRU.html +0 -238
- data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +0 -225
- data/doc/rdoc/classes/LiteralMethod.html +0 -196
- data/doc/rdoc/classes/Main.html +0 -289
- data/doc/rdoc/classes/OgApplication.html +0 -126
- data/doc/rdoc/classes/OgScaffolder.html +0 -827
- data/doc/rdoc/classes/OgScaffolder/Editor.html +0 -565
- data/doc/rdoc/classes/OgSession.html +0 -172
- data/doc/rdoc/classes/Recipe.html +0 -113
- data/doc/rdoc/classes/Wee/AbstractSession.html +0 -502
- data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +0 -148
- data/doc/rdoc/classes/Wee/Brush/ActionMixin.html +0 -146
- data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +0 -154
- data/doc/rdoc/classes/Wee/Brush/AssignMixin.html +0 -141
- data/doc/rdoc/classes/Wee/Brush/CallbackMixin.html +0 -141
- data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +0 -148
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +0 -158
- data/doc/rdoc/classes/Wee/Brush/ToCallback.html +0 -146
- data/doc/rdoc/classes/Wee/Callback.html +0 -231
- data/doc/rdoc/classes/Wee/CallbackStream.html +0 -227
- data/doc/rdoc/classes/Wee/Canvas.html +0 -235
- data/doc/rdoc/classes/Wee/CanvasMixin.html +0 -225
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +0 -153
- data/doc/rdoc/classes/Wee/ComponentDispatcher.html +0 -289
- data/doc/rdoc/classes/Wee/ComponentRunner.html +0 -321
- data/doc/rdoc/classes/Wee/ErrorPage.html +0 -175
- data/doc/rdoc/classes/Wee/Examples.html +0 -114
- data/doc/rdoc/classes/Wee/Examples/Calculator.html +0 -319
- data/doc/rdoc/classes/Wee/Examples/Counter.html +0 -289
- data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +0 -210
- data/doc/rdoc/classes/Wee/Examples/Window.html +0 -346
- data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +0 -227
- data/doc/rdoc/classes/Wee/Helper.html +0 -148
- data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +0 -1230
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +0 -198
- data/doc/rdoc/classes/Wee/LoginDecoration.html +0 -261
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +0 -181
- data/doc/rdoc/classes/Wee/MessageBox.html +0 -180
- data/doc/rdoc/classes/Wee/MethodCallback.html +0 -193
- data/doc/rdoc/classes/Wee/Nitro.html +0 -114
- data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +0 -192
- data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +0 -345
- data/doc/rdoc/classes/Wee/Nitro/FormTag.html +0 -155
- data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +0 -178
- data/doc/rdoc/classes/Wee/Page.html +0 -115
- data/doc/rdoc/classes/Wee/PagelessApplication.html +0 -154
- data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +0 -296
- data/doc/rdoc/classes/Wee/PagelessRequest.html +0 -208
- data/doc/rdoc/classes/Wee/PagelessSession.html +0 -359
- data/doc/rdoc/classes/Wee/Pager.html +0 -534
- data/doc/rdoc/classes/Wee/Rails.html +0 -114
- data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +0 -192
- data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +0 -342
- data/doc/rdoc/classes/Wee/Rails/FormTag.html +0 -155
- data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +0 -177
- data/doc/rdoc/classes/Wee/RenderingContext.html +0 -283
- data/doc/rdoc/classes/Wee/RequestHandler.html +0 -341
- data/doc/rdoc/classes/Wee/Snapshot.html +0 -211
- data/doc/rdoc/classes/Wee/StateRegistry.html +0 -434
- data/doc/rdoc/classes/Wee/StateRegistry/Snapshot.html +0 -320
- data/doc/rdoc/classes/Wee/StateRegistry/WithObject.html +0 -153
- data/doc/rdoc/classes/Wee/Utils.html +0 -300
- data/doc/rdoc/classes/Wee/ValueHolder.html +0 -220
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +0 -368
- data/doc/rdoc/files/INSTALL.html +0 -130
- data/doc/rdoc/files/README.html +0 -471
- data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/component_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/pager_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/context_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/continuation_rb.html +0 -116
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/core/component_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/core/componentrunner_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/core/context_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core/decoration_rb.html +0 -133
- data/doc/rdoc/files/lib/wee/core/idgen_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core/presenter_rb.html +0 -112
- data/doc/rdoc/files/lib/wee/core/renderer_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +0 -113
- data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/core_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core_rb.html +0 -124
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +0 -111
- data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/examples/counter_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/examples/window_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +0 -109
- data/doc/rdoc/files/lib/wee/pageless_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/rendering/html/brushes_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/rendering/html/canvas_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/rendering/html/writer_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/requesthandler_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +0 -111
- data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/snapshot_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/stuff_rb.html +0 -144
- data/doc/rdoc/files/lib/wee/template_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils/cache_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils_rb.html +0 -110
- data/examples/ajax/ajax.js +0 -444
- data/examples/ajax/ajax.rb +0 -31
- data/examples/cc.rb +0 -74
- data/examples/dispatcher.rb +0 -37
- data/examples/draw.rb +0 -94
- data/examples/live-update.rb +0 -45
- data/examples/nitro/run.rb +0 -42
- data/examples/og-test.rb +0 -60
- data/examples/radio.rb +0 -44
- data/examples/test.rb +0 -39
- data/install.rb +0 -14
- data/lib/cache/cache.rb +0 -167
- data/lib/wee/abstractsession.rb +0 -96
- data/lib/wee/adaptors/fastcgi.rb +0 -76
- data/lib/wee/adaptors/nitro.rb +0 -155
- data/lib/wee/adaptors/rails.rb +0 -154
- data/lib/wee/adaptors/webrick.rb +0 -89
- data/lib/wee/components.rb +0 -7
- data/lib/wee/components/component_dispatcher.rb +0 -46
- data/lib/wee/components/form_decoration.rb +0 -7
- data/lib/wee/components/login_decoration.rb +0 -35
- data/lib/wee/components/page_decoration.rb +0 -14
- data/lib/wee/components/wrapper_decoration.rb +0 -7
- data/lib/wee/continuation.rb +0 -5
- data/lib/wee/continuation/core/component.rb +0 -56
- data/lib/wee/continuation/session.rb +0 -64
- data/lib/wee/core.rb +0 -16
- data/lib/wee/core/callback.rb +0 -121
- data/lib/wee/core/component.rb +0 -356
- data/lib/wee/core/componentrunner.rb +0 -73
- data/lib/wee/core/context.rb +0 -27
- data/lib/wee/core/decoration.rb +0 -138
- data/lib/wee/core/idgen.rb +0 -5
- data/lib/wee/core/page.rb +0 -1
- data/lib/wee/core/presenter.rb +0 -100
- data/lib/wee/core/renderer.rb +0 -23
- data/lib/wee/core/snapshot.rb +0 -21
- data/lib/wee/core/valueholder.rb +0 -19
- data/lib/wee/core_ext.rb +0 -122
- data/lib/wee/databases/og.rb +0 -4
- data/lib/wee/databases/og/application.rb +0 -3
- data/lib/wee/databases/og/old_scaffolder.rb +0 -98
- data/lib/wee/databases/og/scaffolder.rb +0 -255
- data/lib/wee/databases/og/session.rb +0 -9
- data/lib/wee/examples/calculator.rb +0 -70
- data/lib/wee/examples/counter.rb +0 -33
- data/lib/wee/idgen/md5.rb +0 -21
- data/lib/wee/idgen/sequential.rb +0 -11
- data/lib/wee/pageless.rb +0 -3
- data/lib/wee/pageless/application.rb +0 -13
- data/lib/wee/pageless/request.rb +0 -27
- data/lib/wee/pageless/session.rb +0 -74
- data/lib/wee/renderer/html/brushes.rb +0 -667
- data/lib/wee/renderer/html/canvas.rb +0 -265
- data/lib/wee/renderer/html/writer.rb +0 -80
- data/lib/wee/requesthandler.rb +0 -81
- data/lib/wee/skeleton/og/README +0 -38
- data/lib/wee/skeleton/og/components/main.rb +0 -20
- data/lib/wee/skeleton/og/conf/db.rb +0 -8
- data/lib/wee/skeleton/og/models/recipe.rb +0 -5
- data/lib/wee/skeleton/og/run.rb +0 -23
- data/lib/wee/skeleton/simple/README +0 -32
- data/lib/wee/skeleton/simple/components/main.rb +0 -25
- data/lib/wee/skeleton/simple/run.rb +0 -12
- data/lib/wee/snapshot_ext.rb +0 -41
- data/lib/wee/template.rb +0 -42
- data/lib/wee/utils.rb +0 -5
- data/lib/wee/utils/autoreload.rb +0 -56
- data/lib/wee/utils/cache.rb +0 -7
- data/lib/wee/utils/helper.rb +0 -51
data/lib/wee/idgen/md5.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Returned ids might not be unique, but it should be very hard to guess the
|
2
|
-
# next id.
|
3
|
-
|
4
|
-
require 'digest/md5'
|
5
|
-
|
6
|
-
class Wee::Md5IdGenerator < Wee::IdGenerator
|
7
|
-
def initialize(salt='wee')
|
8
|
-
@salt = salt
|
9
|
-
end
|
10
|
-
|
11
|
-
def next
|
12
|
-
now = Time.now
|
13
|
-
md5 = Digest::MD5.new
|
14
|
-
md5.update(now.to_s)
|
15
|
-
md5.update(now.usec.to_s)
|
16
|
-
md5.update(rand(0).to_s)
|
17
|
-
md5.update($$.to_s)
|
18
|
-
md5.update(@salt.to_s)
|
19
|
-
md5.hexdigest
|
20
|
-
end
|
21
|
-
end
|
data/lib/wee/idgen/sequential.rb
DELETED
data/lib/wee/pageless.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'cgi'
|
2
|
-
|
3
|
-
class Wee::PagelessApplication < Wee::Application
|
4
|
-
def request_handler_expired(context)
|
5
|
-
context.response = Wee::RedirectResponse.new(context.request.build_url(
|
6
|
-
:request_handler_id => nil,
|
7
|
-
:page_id => nil))
|
8
|
-
|
9
|
-
cookie = CGI::Cookie.new('SID', '')
|
10
|
-
cookie.expires = Time.at(0)
|
11
|
-
context.response.cookies << cookie
|
12
|
-
end
|
13
|
-
end
|
data/lib/wee/pageless/request.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class Wee::PagelessRequest < Wee::Request
|
2
|
-
private
|
3
|
-
|
4
|
-
def pageless?
|
5
|
-
true
|
6
|
-
end
|
7
|
-
|
8
|
-
def make_request_path(request_handler_id, page_id)
|
9
|
-
""
|
10
|
-
end
|
11
|
-
|
12
|
-
def parse_path
|
13
|
-
if sid = @cookies.find {|c| c.name == 'SID'}
|
14
|
-
@request_handler_id = sid.value
|
15
|
-
end
|
16
|
-
|
17
|
-
full_app_path = @path
|
18
|
-
|
19
|
-
if full_app_path == @app_path
|
20
|
-
@info = nil
|
21
|
-
elsif full_app_path[0, @app_path.size] == @app_path and full_app_path[@app_path.size] == ?/
|
22
|
-
@info = full_app_path[@app_path.size+1..-1]
|
23
|
-
else
|
24
|
-
raise "dispatched to wrong handler"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/wee/pageless/session.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
require 'cgi'
|
3
|
-
|
4
|
-
# A session class, which does not have a page-store and as such cannot
|
5
|
-
# backtrack.
|
6
|
-
|
7
|
-
class Wee::PagelessSession < Wee::Session
|
8
|
-
undef page_store
|
9
|
-
|
10
|
-
attr_accessor :callbacks
|
11
|
-
alias current_callbacks callbacks
|
12
|
-
|
13
|
-
def setup(&block)
|
14
|
-
with_session do
|
15
|
-
block.call(self) if block
|
16
|
-
raise ArgumentError, "No component runner specified" if @component_runner.nil?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# The main routine where the request is processed.
|
21
|
-
|
22
|
-
def process_request
|
23
|
-
handle_existing_page
|
24
|
-
end
|
25
|
-
|
26
|
-
def handle_existing_page
|
27
|
-
p @context.request.fields if $DEBUG
|
28
|
-
|
29
|
-
if @context.request.render?
|
30
|
-
handle_render_phase
|
31
|
-
else
|
32
|
-
handle_callback_phase
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def handle_render_phase
|
37
|
-
new_callbacks = Wee::CallbackRegistry.new(Wee::SequentialIdGenerator.new)
|
38
|
-
respond(@context, new_callbacks) # render
|
39
|
-
self.callbacks = new_callbacks
|
40
|
-
end
|
41
|
-
|
42
|
-
def handle_callback_phase
|
43
|
-
# Actions/inputs were specified.
|
44
|
-
#
|
45
|
-
# We process the request and invoke actions/inputs. Then we generate a
|
46
|
-
# new page view.
|
47
|
-
|
48
|
-
callback_stream = Wee::CallbackStream.new(self.callbacks, @context.request.fields)
|
49
|
-
send_response = @component_runner.process_callbacks(callback_stream)
|
50
|
-
|
51
|
-
post_callbacks_hook()
|
52
|
-
|
53
|
-
if send_response
|
54
|
-
set_response(@context, send_response) # @context.response = send_response
|
55
|
-
else
|
56
|
-
handle_new_page_view(@context)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def handle_new_page_view(context)
|
63
|
-
redirect_url = context.request.build_url
|
64
|
-
set_response(context, Wee::RedirectResponse.new(redirect_url))
|
65
|
-
end
|
66
|
-
|
67
|
-
def set_response(context, response)
|
68
|
-
response.cookies << CGI::Cookie.new('SID', self.id)
|
69
|
-
response.header.delete('Expire')
|
70
|
-
response.header['Pragma'] = 'No-Cache'
|
71
|
-
super
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
@@ -1,667 +0,0 @@
|
|
1
|
-
module Wee
|
2
|
-
|
3
|
-
class Brush
|
4
|
-
attr_accessor :parent, :canvas
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@parent = @canvas = @closed = nil
|
8
|
-
end
|
9
|
-
|
10
|
-
def with(*args, &block)
|
11
|
-
raise "either args or block, but not both" if block and not args.empty?
|
12
|
-
|
13
|
-
@canvas.nest(&block) if block
|
14
|
-
@closed = true
|
15
|
-
end
|
16
|
-
|
17
|
-
def close
|
18
|
-
with unless @closed
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Brush
|
23
|
-
|
24
|
-
class GenericTextBrush < Brush
|
25
|
-
def initialize(text)
|
26
|
-
super()
|
27
|
-
@text = text
|
28
|
-
end
|
29
|
-
|
30
|
-
def with
|
31
|
-
doc = @canvas.document
|
32
|
-
doc << @text
|
33
|
-
super
|
34
|
-
nil
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class GenericEncodedTextBrush < Brush
|
39
|
-
def initialize(text)
|
40
|
-
super()
|
41
|
-
@text = text
|
42
|
-
end
|
43
|
-
|
44
|
-
def with
|
45
|
-
doc = @canvas.document
|
46
|
-
doc.encode_text(@text)
|
47
|
-
super
|
48
|
-
nil
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
class GenericTagBrush < Brush
|
53
|
-
|
54
|
-
class << self
|
55
|
-
private
|
56
|
-
|
57
|
-
def html_attr(attr, hash={})
|
58
|
-
name = hash[:html_name] || attr
|
59
|
-
|
60
|
-
case hash[:type]
|
61
|
-
when :bool
|
62
|
-
class_eval "
|
63
|
-
def #{ attr }(bool=true)
|
64
|
-
if bool
|
65
|
-
@attributes['#{ name }'] = nil
|
66
|
-
else
|
67
|
-
@attributes.delete('#{ name }')
|
68
|
-
end
|
69
|
-
self
|
70
|
-
end
|
71
|
-
"
|
72
|
-
else
|
73
|
-
class_eval "
|
74
|
-
def #{ attr }(value)
|
75
|
-
if value == nil
|
76
|
-
@attributes.delete('#{ name }')
|
77
|
-
else
|
78
|
-
@attributes['#{ name }'] = value.to_s
|
79
|
-
end
|
80
|
-
self
|
81
|
-
end
|
82
|
-
"
|
83
|
-
end
|
84
|
-
|
85
|
-
if hash[:aliases]
|
86
|
-
hash[:aliases].each do |a|
|
87
|
-
class_eval "alias #{ a } #{ attr }"
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
if hash[:shortcuts]
|
92
|
-
hash[:shortcuts].each_pair do |k,v|
|
93
|
-
class_eval "
|
94
|
-
def #{ k }() #{ attr }(#{ v.inspect }) end
|
95
|
-
"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
private
|
102
|
-
|
103
|
-
def html_attr(attr, value)
|
104
|
-
if value.nil?
|
105
|
-
@attributes.delete(attr)
|
106
|
-
else
|
107
|
-
@attributes[attr] = value.to_s
|
108
|
-
end
|
109
|
-
self
|
110
|
-
end
|
111
|
-
|
112
|
-
# Converts the arguments into a callable object.
|
113
|
-
#
|
114
|
-
def to_callback(symbol, args, block)
|
115
|
-
raise ArgumentError if symbol and block
|
116
|
-
if symbol.nil?
|
117
|
-
raise ArgumentError if not args.empty?
|
118
|
-
block
|
119
|
-
else
|
120
|
-
if symbol.is_a?(Symbol) or symbol.is_a?(String)
|
121
|
-
Wee::LiteralMethodCallback.new(@canvas.current_component, symbol, *args)
|
122
|
-
else
|
123
|
-
raise ArgumentError if not args.empty?
|
124
|
-
symbol
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
public
|
130
|
-
|
131
|
-
def __input_callback(symbol=nil, *args, &block)
|
132
|
-
name(@canvas.register_callback(:input, to_callback(symbol, args, block)))
|
133
|
-
end
|
134
|
-
|
135
|
-
def __action_callback(symbol=nil, *args, &block)
|
136
|
-
name(@canvas.register_callback(:action, to_callback(symbol, args, block)))
|
137
|
-
end
|
138
|
-
|
139
|
-
# The callback id is listed in the URL (not as a form-data field)
|
140
|
-
|
141
|
-
def __actionurl_callback(symbol=nil, *args, &block)
|
142
|
-
__set_url(@canvas.url_for_callback(to_callback(symbol, args, block)))
|
143
|
-
end
|
144
|
-
|
145
|
-
# The callback id is listed in the URL (not as a form-data field)
|
146
|
-
|
147
|
-
def __actionurl_named_callback(name, symbol=nil, *args, &block)
|
148
|
-
__set_url(@canvas.url_for_named_callback(name, to_callback(symbol, args, block)))
|
149
|
-
end
|
150
|
-
|
151
|
-
def method_missing(id, attr)
|
152
|
-
html_attr(id.to_s, attr)
|
153
|
-
end
|
154
|
-
|
155
|
-
def initialize(tag, is_single_tag=false)
|
156
|
-
super()
|
157
|
-
@tag, @is_single_tag = tag, is_single_tag
|
158
|
-
@attributes = Hash.new
|
159
|
-
end
|
160
|
-
|
161
|
-
html_attr 'type'
|
162
|
-
html_attr 'id'
|
163
|
-
html_attr 'css_class', :html_name => 'class'
|
164
|
-
|
165
|
-
def onclick_callback(symbol=nil, *args, &block)
|
166
|
-
raise ArgumentError if symbol and block
|
167
|
-
url = @canvas.url_for_callback(to_callback(symbol, args, block))
|
168
|
-
onclick("javascript: document.location.href='#{ url }';")
|
169
|
-
end
|
170
|
-
|
171
|
-
def onclick_update(update_id, symbol=nil, *args, &block)
|
172
|
-
raise ArgumentError if symbol and block
|
173
|
-
url = @canvas.url_for_callback(to_callback(symbol, args, block))
|
174
|
-
onclick("javascript: new Ajax.Updater('#{ update_id }', '#{ url }', {method:'get'}); return false;")
|
175
|
-
end
|
176
|
-
|
177
|
-
def with(text=nil, &block)
|
178
|
-
doc = @canvas.document
|
179
|
-
if @is_single_tag
|
180
|
-
raise ArgumentError if text or block
|
181
|
-
doc.single_tag(@tag, @attributes)
|
182
|
-
@closed = true
|
183
|
-
else
|
184
|
-
doc.start_tag(@tag, @attributes)
|
185
|
-
if text
|
186
|
-
doc.text(text)
|
187
|
-
super(text, &block)
|
188
|
-
else
|
189
|
-
super(&block)
|
190
|
-
end
|
191
|
-
doc.end_tag(@tag)
|
192
|
-
end
|
193
|
-
nil
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
class GenericSingleTagBrush < GenericTagBrush
|
198
|
-
def initialize(tag)
|
199
|
-
super(tag, true)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
class ImageTag < GenericSingleTagBrush
|
204
|
-
html_attr 'src'
|
205
|
-
|
206
|
-
def initialize
|
207
|
-
super('img')
|
208
|
-
end
|
209
|
-
|
210
|
-
def with
|
211
|
-
super
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
class JavascriptTag < GenericTagBrush
|
216
|
-
html_attr 'src'
|
217
|
-
html_attr 'type'
|
218
|
-
|
219
|
-
def initialize
|
220
|
-
super('script')
|
221
|
-
type('text/javascript')
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
class TableTag < GenericTagBrush
|
226
|
-
def initialize
|
227
|
-
super('table')
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
class TableRowTag < GenericTagBrush
|
232
|
-
def initialize
|
233
|
-
super('tr')
|
234
|
-
end
|
235
|
-
|
236
|
-
html_attr 'align', :shortcuts => {
|
237
|
-
:align_top => 'top',
|
238
|
-
:align_bottom => 'bottom'
|
239
|
-
}
|
240
|
-
|
241
|
-
def columns(*cols, &block)
|
242
|
-
with {
|
243
|
-
cols.each {|col|
|
244
|
-
@canvas.table_data.with {
|
245
|
-
if block
|
246
|
-
block.call(col)
|
247
|
-
else
|
248
|
-
@canvas.text(col)
|
249
|
-
end
|
250
|
-
}
|
251
|
-
}
|
252
|
-
}
|
253
|
-
end
|
254
|
-
|
255
|
-
def headings(*headers, &block)
|
256
|
-
with {
|
257
|
-
headers.each {|header|
|
258
|
-
@canvas.table_header.with {
|
259
|
-
if block
|
260
|
-
block.call(header)
|
261
|
-
else
|
262
|
-
@canvas.text(header)
|
263
|
-
end
|
264
|
-
}
|
265
|
-
}
|
266
|
-
}
|
267
|
-
end
|
268
|
-
|
269
|
-
def spanning_column(str, colspan)
|
270
|
-
with {
|
271
|
-
@canvas.table_data.col_span(colspan).with(str)
|
272
|
-
}
|
273
|
-
end
|
274
|
-
|
275
|
-
def spacer
|
276
|
-
with {
|
277
|
-
@canvas.table_data { @canvas.space }
|
278
|
-
}
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
class InputTag < GenericSingleTagBrush
|
283
|
-
def initialize
|
284
|
-
super('input')
|
285
|
-
end
|
286
|
-
|
287
|
-
html_attr 'type'
|
288
|
-
html_attr 'name'
|
289
|
-
html_attr 'value'
|
290
|
-
html_attr 'size'
|
291
|
-
html_attr 'maxlength'
|
292
|
-
html_attr 'src'
|
293
|
-
html_attr 'checked', :type => :bool
|
294
|
-
html_attr 'disabled', :type => :bool
|
295
|
-
html_attr 'readonly', :type => :bool
|
296
|
-
|
297
|
-
def with
|
298
|
-
super
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
class TextAreaTag < GenericTagBrush
|
303
|
-
def initialize
|
304
|
-
super('textarea')
|
305
|
-
end
|
306
|
-
|
307
|
-
alias callback __input_callback
|
308
|
-
|
309
|
-
html_attr 'name'
|
310
|
-
html_attr 'rows'
|
311
|
-
html_attr 'cols'
|
312
|
-
html_attr 'tabindex'
|
313
|
-
html_attr 'accesskey'
|
314
|
-
html_attr 'onfocus'
|
315
|
-
html_attr 'onblur'
|
316
|
-
html_attr 'onselect'
|
317
|
-
html_attr 'onchange'
|
318
|
-
html_attr 'disabled', :type => :bool
|
319
|
-
html_attr 'readonly', :type => :bool
|
320
|
-
|
321
|
-
def value(val)
|
322
|
-
@value = val
|
323
|
-
self
|
324
|
-
end
|
325
|
-
|
326
|
-
def with(*args, &block)
|
327
|
-
if @value
|
328
|
-
if block or !args.empty?
|
329
|
-
raise "please use either method 'value' or 'with'"
|
330
|
-
else
|
331
|
-
super(@value)
|
332
|
-
end
|
333
|
-
else
|
334
|
-
super
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
338
|
-
|
339
|
-
class SelectOptionTag < GenericTagBrush
|
340
|
-
def initialize
|
341
|
-
super('option')
|
342
|
-
end
|
343
|
-
|
344
|
-
html_attr 'selected', :type => :bool
|
345
|
-
end
|
346
|
-
|
347
|
-
class SelectListTag < GenericTagBrush
|
348
|
-
|
349
|
-
html_attr 'disabled', :type => :bool
|
350
|
-
html_attr 'readonly', :type => :bool
|
351
|
-
html_attr 'multiple', :type => :bool, :aliases => [:multi]
|
352
|
-
|
353
|
-
def initialize(items)
|
354
|
-
super('select')
|
355
|
-
@items = items
|
356
|
-
end
|
357
|
-
|
358
|
-
def items(arg)
|
359
|
-
@items = arg
|
360
|
-
self
|
361
|
-
end
|
362
|
-
|
363
|
-
def selected(arg=nil, &block)
|
364
|
-
raise if arg and block
|
365
|
-
@selected = block || arg
|
366
|
-
self
|
367
|
-
end
|
368
|
-
|
369
|
-
def labels(arg=nil, &block)
|
370
|
-
raise if arg and block
|
371
|
-
|
372
|
-
if block
|
373
|
-
@labels = proc{|i| block.call(@items[i])}
|
374
|
-
else
|
375
|
-
@labels = arg
|
376
|
-
end
|
377
|
-
self
|
378
|
-
end
|
379
|
-
|
380
|
-
def callback(symbol=nil, *args, &block)
|
381
|
-
@callback = to_callback(symbol, args, block)
|
382
|
-
self
|
383
|
-
end
|
384
|
-
|
385
|
-
class SelectListCallback < Struct.new(:callback, :items, :is_multiple)
|
386
|
-
def call(input)
|
387
|
-
choosen = input.list.map {|idx|
|
388
|
-
idx = Integer(idx)
|
389
|
-
raise "invalid index in select list" if idx < 0 or idx > items.size
|
390
|
-
items[idx]
|
391
|
-
}
|
392
|
-
if choosen.size > 1 and not is_multiple
|
393
|
-
raise "choosen more than one element from a non-multiple select list"
|
394
|
-
end
|
395
|
-
if is_multiple
|
396
|
-
callback.call(choosen)
|
397
|
-
else
|
398
|
-
callback.call(choosen.first)
|
399
|
-
end
|
400
|
-
end
|
401
|
-
end
|
402
|
-
|
403
|
-
def with
|
404
|
-
@labels ||= @items.collect { |i| i.to_s }
|
405
|
-
|
406
|
-
is_multiple = @attributes.has_key?('multiple')
|
407
|
-
|
408
|
-
if @callback
|
409
|
-
# A callback was specified. We have to wrap it inside a
|
410
|
-
# SelectListCallback object as we want to perform some
|
411
|
-
# additional actions.
|
412
|
-
__input_callback(SelectListCallback.new(@callback, @items, is_multiple))
|
413
|
-
end
|
414
|
-
|
415
|
-
super do
|
416
|
-
meth =
|
417
|
-
if is_multiple
|
418
|
-
@selected ||= Array.new
|
419
|
-
@selected.kind_of?(Proc) ? (:call) : (:include?)
|
420
|
-
else
|
421
|
-
@selected.kind_of?(Proc) ? (:call) : (:==)
|
422
|
-
end
|
423
|
-
|
424
|
-
@items.each_index {|i|
|
425
|
-
@canvas.option.value(i).selected(@selected.send(meth, @items[i])).with(@labels[i])
|
426
|
-
}
|
427
|
-
end
|
428
|
-
end
|
429
|
-
end
|
430
|
-
|
431
|
-
class HiddenInputTag < InputTag
|
432
|
-
def initialize
|
433
|
-
super
|
434
|
-
type('hidden')
|
435
|
-
end
|
436
|
-
|
437
|
-
alias callback __input_callback
|
438
|
-
end
|
439
|
-
|
440
|
-
class PasswordInputTag < InputTag
|
441
|
-
def initialize
|
442
|
-
super
|
443
|
-
type('password')
|
444
|
-
end
|
445
|
-
|
446
|
-
alias callback __input_callback
|
447
|
-
end
|
448
|
-
|
449
|
-
class TextInputTag < InputTag
|
450
|
-
def initialize
|
451
|
-
super
|
452
|
-
type('text')
|
453
|
-
end
|
454
|
-
|
455
|
-
alias callback __input_callback
|
456
|
-
end
|
457
|
-
|
458
|
-
class RadioButtonTag < InputTag
|
459
|
-
def initialize
|
460
|
-
super
|
461
|
-
type('radio')
|
462
|
-
end
|
463
|
-
|
464
|
-
class RadioGroup
|
465
|
-
def initialize(canvas)
|
466
|
-
@name = canvas.register_callback(:input, self)
|
467
|
-
@callbacks = {}
|
468
|
-
@ids = Wee::SequentialIdGenerator.new
|
469
|
-
end
|
470
|
-
|
471
|
-
def add_callback(callback)
|
472
|
-
value = @ids.next.to_s
|
473
|
-
@callbacks[value] = callback
|
474
|
-
return [@name, value]
|
475
|
-
end
|
476
|
-
|
477
|
-
def call(value)
|
478
|
-
if @callbacks.has_key?(value)
|
479
|
-
cb = @callbacks[value]
|
480
|
-
cb.call(value) if cb
|
481
|
-
else
|
482
|
-
raise "invalid radio button/group value"
|
483
|
-
end
|
484
|
-
end
|
485
|
-
end
|
486
|
-
|
487
|
-
def group(radio_group)
|
488
|
-
@group = radio_group
|
489
|
-
self
|
490
|
-
end
|
491
|
-
|
492
|
-
def callback(symbol=nil, *args, &block)
|
493
|
-
@callback = to_callback(symbol, args, block)
|
494
|
-
self
|
495
|
-
end
|
496
|
-
|
497
|
-
def with
|
498
|
-
if @group
|
499
|
-
n, v = @group.add_callback(@callback)
|
500
|
-
name(n)
|
501
|
-
value(v)
|
502
|
-
end
|
503
|
-
super
|
504
|
-
end
|
505
|
-
|
506
|
-
end
|
507
|
-
|
508
|
-
class CheckboxTag < InputTag
|
509
|
-
def initialize
|
510
|
-
super
|
511
|
-
type('checkbox')
|
512
|
-
end
|
513
|
-
alias callback __input_callback
|
514
|
-
end
|
515
|
-
|
516
|
-
class FileUploadTag < InputTag
|
517
|
-
def initialize
|
518
|
-
super
|
519
|
-
type('file')
|
520
|
-
end
|
521
|
-
|
522
|
-
alias callback __input_callback
|
523
|
-
end
|
524
|
-
|
525
|
-
class SubmitButtonTag < InputTag
|
526
|
-
def initialize
|
527
|
-
super
|
528
|
-
type('submit')
|
529
|
-
end
|
530
|
-
|
531
|
-
alias callback __action_callback
|
532
|
-
end
|
533
|
-
|
534
|
-
# NOTE: The form-fields returned by a image-button-tag is browser-specific.
|
535
|
-
# Most browsers do not send the "name" key together with the value specified by
|
536
|
-
# "value", only "name.x" and "name.y". This conforms to the standard. But
|
537
|
-
# Firefox also sends "name"="value". This is why I raise an exception from the
|
538
|
-
# #value method. Note that it's neccessary to parse the passed form-fields and
|
539
|
-
# generate a "name" fields in the request, to make this image-button work.
|
540
|
-
|
541
|
-
class ImageButtonTag < InputTag
|
542
|
-
def initialize
|
543
|
-
super
|
544
|
-
type('image')
|
545
|
-
end
|
546
|
-
|
547
|
-
alias callback __action_callback
|
548
|
-
|
549
|
-
def value(v)
|
550
|
-
raise "specified value will not be used in the request"
|
551
|
-
end
|
552
|
-
end
|
553
|
-
|
554
|
-
class TableDataTag < GenericTagBrush
|
555
|
-
def initialize
|
556
|
-
super('td')
|
557
|
-
end
|
558
|
-
|
559
|
-
html_attr 'align', :shortcuts => {
|
560
|
-
:align_top => 'top',
|
561
|
-
:align_bottom => 'bottom'
|
562
|
-
}
|
563
|
-
end
|
564
|
-
|
565
|
-
class TableHeaderTag < GenericTagBrush
|
566
|
-
def initialize
|
567
|
-
super('th')
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
|
-
class FormTag < GenericTagBrush
|
572
|
-
def initialize
|
573
|
-
super('form')
|
574
|
-
@attributes['method'] = 'POST'
|
575
|
-
end
|
576
|
-
|
577
|
-
html_attr 'action'
|
578
|
-
html_attr 'enctype'
|
579
|
-
|
580
|
-
alias __set_url action
|
581
|
-
alias callback __actionurl_callback
|
582
|
-
alias named_callback __actionurl_named_callback
|
583
|
-
|
584
|
-
def onsubmit_update(update_id, symbol=nil, *args, &block)
|
585
|
-
raise ArgumentError if symbol and block
|
586
|
-
url = @canvas.url_for_callback(to_callback(symbol, args, block), :live_update)
|
587
|
-
onsubmit("javascript: new Ajax.Updater('#{ update_id }', '#{ url }', {method:'get', parameters: Form.serialize(this)}); return false;")
|
588
|
-
end
|
589
|
-
|
590
|
-
def with(*args, &block)
|
591
|
-
# If no action was specified, use a dummy one.
|
592
|
-
unless @attributes.has_key?('action')
|
593
|
-
@attributes['action'] = @canvas.build_url
|
594
|
-
end
|
595
|
-
super
|
596
|
-
end
|
597
|
-
end
|
598
|
-
|
599
|
-
class AnchorTag < GenericTagBrush
|
600
|
-
def initialize
|
601
|
-
super('a')
|
602
|
-
end
|
603
|
-
|
604
|
-
html_attr 'href', :aliases => [:url]
|
605
|
-
html_attr 'title', :aliases => [:tooltip]
|
606
|
-
|
607
|
-
alias __set_url url
|
608
|
-
|
609
|
-
def info(info=nil)
|
610
|
-
@info = info
|
611
|
-
self
|
612
|
-
end
|
613
|
-
|
614
|
-
def callback(symbol=nil, *args, &block)
|
615
|
-
if @info
|
616
|
-
__set_url(@canvas.url_for_callback(to_callback(symbol, args, block), :action, :info => @info))
|
617
|
-
else
|
618
|
-
__set_url(@canvas.url_for_callback(to_callback(symbol, args, block)))
|
619
|
-
end
|
620
|
-
end
|
621
|
-
|
622
|
-
def named_callback(name, symbol=nil, *args, &block)
|
623
|
-
if @info
|
624
|
-
__set_url(@canvas.url_for_named_callback(name, to_callback(symbol, args, block), :info => @info))
|
625
|
-
else
|
626
|
-
__set_url(@canvas.url_for_named_callback(name, to_callback(symbol, args, block)))
|
627
|
-
end
|
628
|
-
end
|
629
|
-
|
630
|
-
end
|
631
|
-
|
632
|
-
class Page < Brush
|
633
|
-
def title(t)
|
634
|
-
@title = t
|
635
|
-
self
|
636
|
-
end
|
637
|
-
|
638
|
-
def with(text=nil, &block)
|
639
|
-
doc = @canvas.document
|
640
|
-
doc.start_tag("html")
|
641
|
-
|
642
|
-
if @title
|
643
|
-
doc.start_tag("head")
|
644
|
-
doc.start_tag("title")
|
645
|
-
doc.text(@title)
|
646
|
-
doc.end_tag("title")
|
647
|
-
doc.end_tag("head")
|
648
|
-
end
|
649
|
-
|
650
|
-
doc.start_tag("body")
|
651
|
-
|
652
|
-
if text
|
653
|
-
doc.text(text)
|
654
|
-
super(text, &block)
|
655
|
-
else
|
656
|
-
super(&block)
|
657
|
-
end
|
658
|
-
|
659
|
-
doc.end_tag("body")
|
660
|
-
doc.end_tag("html")
|
661
|
-
nil
|
662
|
-
end
|
663
|
-
end
|
664
|
-
|
665
|
-
end # class Brush
|
666
|
-
|
667
|
-
end # module Wee
|