C0 code coverage information
Generated on Tue Jun 09 17:50:05 +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 # -*- coding: utf-8 -*-
2 require 'nested_ajax'
3 4 module NestedAjax 5 module BaseHelper 6 7 def nested_ajax_pane(object_or_object_name = nil,
options = {}, &block)
8 pane = eval("cascading_nested_ajax_pane ||= nil",
Proc.new(&block).binding) 9 #
NestedAjax::Pane::AbstractPane.renderで描画されているブロック中
らば 10 #
ローカル変数 cascading_nested_ajax_pane
にPaneが設定されているはずです。 11 #
もしそれがなかったらここで用意します。 12 unless pane 13 object, object_name = nil, nil
14 if
object_or_object_name.is_a?(String) || object_or_object_name.is_a?(Symbol)
15 object_name =
object_or_object_name 16
object = self.instance_variable_get("@#{object_name}")
17 else 18 object = object_or_object_name
19 object_name =
object.class.name.underscore 20 end 21 options = { 22 :form_name => nested_ajax_options[:form_name],
23 :object_name =>
object_name, 24 #
現在実行中のコントローラ名をデフォルトで使用してる
ど、 25 :controller
=> self.controller_name 26 # :controller => object_name.to_s.singularize #
の方がいいかな?うーん微妙 27 } 28
logger.debug("nested_ajax_pane options => #{options.inspect}")
29 options.update(options
|| {}) 30 pane =
Pane::SinglePane.new(self, object, options) 31 end 32 yield(pane) if block_given?
33 end 34 35 def nested_ajax_options 36 @nested_ajax_options ||= params[:nested_ajax] ||
HashWithIndifferentAccess.new 37 end 38 39
40 41 FLASH_MESSAGE_COLORS = {
42 :notice =>
'green', 43 :warn =>
'#FF8C00', 44 :error
=> 'red', 45 }
46 47 FLASH_MESSAGE_ID_PREFIX =
"nested_ajax_flash_message" 48 49
# flashのメッセージを表示するための領域を出力します。
50 def
flash_message_for(*args) 51 options = args.extract_options! 52 tag_name = options.delete(:tag_name)
|| 'p' 53 tags = args.map
do |key| 54
options[:style] = "color: #{FLASH_MESSAGE_COLORS[key.to_sym]}" if
options.empty? 55
options.update(:id => "#{FLASH_MESSAGE_ID_PREFIX}_#{key.to_s}")
56 content_tag(tag_name,
flash[key] || ' ', options) 57 end 58 tags.join 59 end 60 61
def ajax_flash_message_for(*args) 62 options = args.extract_options! 63 effect = options[:effect]
64 update_page_tag do
|page| 65 args.each do
|key| 66
page.replace_html("#{FLASH_MESSAGE_ID_PREFIX}_#{key.to_s}",
flash[key]) 67 end
68 if effect 69 args.each do |key| 70 page.visual_effect(effect,
"#{FLASH_MESSAGE_ID_PREFIX}_#{key.to_s}") 71 end 72 if nested_ajax_options[:pane_id]
73
page.visual_effect(effect, nested_ajax_options[:pane_id]) 74 end 75 end 76 end 77 end 78 79 end 80 end
Generated using the rcov
code coverage analysis tool for Ruby version 0.8.1.2.