C0 code coverage information
Generated on Tue Jun 09 17:50:06 +0900 2009 with
rcov 0.8.1.2
Code reported as executed by Ruby looks like
this... and this: this line is also marked as
covered. Lines considered as run by rcov, but
not reported by Ruby, look like this, and
this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not
executed.
1
require 'nested_ajax/pane' 2 3
module NestedAjax 4 module
Pane 5 class SinglePane
< AbstractPane 6
7 def initialize(*args,
&block) 8 super
9
logger.debug("SinglePane.initialize @form_name =>
#{@form_name}") 10
end 11 12 def belongs_to(association_name,
options = {}) 13 if form
14
form.fields_for(association_name, form.object) do |f| 15 pane =
Pane::BelongsToPane.new(template, f, association_name, 16 {:pane_id =>
"#{self.pane_id}_#{association_name}"}.update(options || {}))
17 pane.parent = self
18 yield(pane)
19 end 20 else 21 raise UsageError, "Unsupported
yet" 22 end
23 end 24 25 def has_many(association_name, options = {})
26 pane =
Pane::HasManyPane.new(template, object, association_name, options)
27 pane.parent = self
28 yield(pane)
29 end 30 31 def link_to_new_cancel(name, options = nil)
32 link_to_function(name,
"Element.remove('#{self.id}')", options) 33 end 34 35 def link_to_show(name, options = nil) 36 link_to_remote(name, { 37 :update => pane_id,
38 :method => :get,
39 :url =>
build_url(:show), 40 },
options) 41 end
42 alias_method
:link_to_edit_cancel, :link_to_show 43 44
def link_to_edit(name, options = nil) 45 link_to_remote(name, { 46 :update => pane_id,
47 :method => :get,
48 :url =>
build_url(:edit), 49 },
options) 50 end
51 52 def link_to_destroy(name, options =
{}) 53 url = {
54 :update =>
pane_id, 55 :method
=> :delete, 56 :url
=> build_url(:destroy), 57 } 58
url[:success] = options.delete(:effect) if options[:effect] 59 link_to_remote(name, url, options)
60 end 61 62 def build_url(action) 63 nested_ajax = { 64 :foreign_key => association_foreign_key ||
foreign_key, 65 :in_form
=> !form.nil?, 66
:pane_id => pane_id, 67
:form_name => form_name 68 } 69
result = {:controller => controller, :action => action, :id =>
object.id, :nested_ajax => nested_ajax} 70 yield(result) if block_given? 71 result 72 end 73 74 end 75 end 76 end
Generated using the rcov
code coverage analysis tool for Ruby version 0.8.1.2.