lib/apotomo/rails/view_helper.rb in apotomo-0.1.4 vs lib/apotomo/rails/view_helper.rb in apotomo-1.0.0.beta1

- old
+ new

@@ -20,18 +20,10 @@ # will trigger the event <tt>:mouseAlarm</tt> when moving the mouse over the cheese image. def trigger_event(type, options={}) js_generator.xhr(url_for_event(type, options)) end - # Creates a link that triggers an event via AJAX. - # This link will <em>only</em> work in JavaScript-able browsers. - # - # Note that the link is created using #link_to_remote. - def link_to_event(title, type, options={}, html_options={}) - link_to_remote(title, {:url => url_for_event(type, options)}, html_options) - end - # Creates a form tag that triggers an event via AJAX when submitted. # See StatefulWidget::address_for_event for options. # # The values of form elements are available via StatefulWidget#param. def form_to_event(type, options={}, html_options={}, &block) @@ -47,11 +39,11 @@ def multipart_form_to_event(type, options={}, html_options={}, &block) options.reverse_merge! :apotomo_iframe => true html_options.reverse_merge! :target => :apotomo_iframe, :multipart => true # i hate rails: - concat('<iframe id="apotomo_iframe" name="apotomo_iframe" style="display: none;"></iframe>') << form_tag(url_for_event(type, options), html_options, &block) + concat('<iframe id="apotomo_iframe" name="apotomo_iframe" style="display: none;"></iframe>'.html_safe) << form_tag(url_for_event(type, options), html_options, &block) end # Returns the url to trigger a +type+ event from the currently rendered widget. # The source can be changed with +:source+. Additional +options+ will be appended to the query string. # @@ -60,21 +52,21 @@ # Example: # url_for_event(:paginate, :page => 2) # #=> http://apotomo.de/mouse/process_event_request?type=paginate&source=mouse&page=2 def url_for_event(type, options={}) options.reverse_merge! :source => widget_id - controller.url_for_event(type, options) + @cell.url_for_event(type, options) # FIXME: don't access @parent_controller but @cell. end ### TODO: test me. def update_url(fragment) 'SWFAddress.setValue("' + fragment + '");' end ### TODO: test me. ### DISCUSS: rename to rendered_children ? def content - @rendered_children.collect{|e| e.last}.join("\n") + @rendered_children.collect{|e| e.last}.join("\n").html_safe end # needs: suppress_javascript def widget_javascript(*args, &block) return if @suppress_js ### FIXME: implement with ActiveHelper and :locals.