Class: ActionView::Base
- Inherits:
-
Object
- Object
- ActionView::Base
- Defined in:
- lib/ajax_scaffold_plugin.rb
Overview
:nodoc:
Instance Method Summary collapse
- #parse_partial_path(partial_path) ⇒ Object
-
#render(options = {}, old_local_assigns = {}, &block) ⇒ Object
Renders the template present at
template_path
(relative to the template_root).
Instance Method Details
#parse_partial_path(partial_path) ⇒ Object
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/ajax_scaffold_plugin.rb', line 488 def parse_partial_path(partial_path) path, partial_name = partial_pieces(partial_path) if partial_path.include?('/') unless (erb_template_exists?("#{path}/_#{partial_name}")) path, partial_name = partial_pieces(partial_name) partial_path = "#{path}/#{partial_name}" end end unless (erb_template_exists?("#{path}/_#{partial_name}")) partial_path = "ajax_scaffold/#{partial_name}" end partial_path end |
#render(options = {}, old_local_assigns = {}, &block) ⇒ Object
Renders the template present at template_path
(relative to the template_root). The hash in local_assigns
is made available as local variables.
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/ajax_scaffold_plugin.rb', line 465 def render( = {}, old_local_assigns = {}, &block) #:nodoc: if .is_a?(String) render_file(, true, old_local_assigns) elsif == :update update_page(&block) elsif .is_a?(Hash) [:locals] ||= {} [:use_full_path] = [:use_full_path].nil? ? true : [:use_full_path] if [:file] render_file([:file], [:use_full_path], [:locals]) elsif [:partial] && [:collection] partial = parse_partial_path([:partial]) render_partial_collection(partial, [:collection], [:spacer_template], [:locals]) elsif [:partial] partial = parse_partial_path([:partial]) render_partial(partial, ActionView::Base::ObjectWrapper.new([:object]), [:locals]) elsif [:inline] render_template([:type] || :rhtml, [:inline], nil, [:locals] || {}) end end end |