Changeset 692
- Timestamp:
- 01/09/08 09:34:03 (6 months ago)
- Files:
-
- branches/rails2/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb (modified) (6 diffs)
- branches/rails2/lib/radiant/extension_loader.rb (modified) (4 diffs)
- branches/rails2/lib/radiant/initializer.rb (modified) (1 diff)
- branches/rails2/test/fixtures/extensions/01_basic/app/views/basic_extension_mailer/message.text.html.erb (moved) (moved from branches/rails2/test/fixtures/extensions/01_basic/app/views/basic_extension_mailer/message.html.erb)
- branches/rails2/test/functional/extension_initialization_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/rails2/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb
r691 r692 27 27 initialize_defaults(method_name) 28 28 __send__(method_name, *parameters) 29 29 30 30 # If an explicit, textual body has not been set, we check assumptions. 31 31 unless String === @body … … 35 35 # have not already been specified manually. 36 36 if @parts.empty? 37 # JWL: begin modifications37 # Radiant: begin modifications 38 38 full_path = full_template_path("#{mailer_name}/#{@template}") 39 39 templates = Dir.glob("#{full_path}.*") 40 # JWL: end modifications40 # Radiant: end modifications 41 41 templates.each do |path| 42 42 basename = File.basename(path) … … 45 45 template_name = basename 46 46 content_type = md.captures[1].gsub('.', '/') 47 @parts << Part.new(:content_type => content_type, 47 # Radiant: begin modifications 48 @parts << ActionMailer::Part.new(:content_type => content_type, 48 49 :disposition => "inline", :charset => charset, 49 50 :body => render_message(template_name, @body)) 51 # Radiant: end modifications 50 52 end 51 53 unless @parts.empty? … … 54 56 end 55 57 end 56 58 57 59 # Then, if there were such templates, we check to see if we ought to 58 60 # also render a "normal" template (without the content type). If a … … 62 64 template_exists ||= Dir.glob("#{template_path}/#{@template}.*").any? { |i| File.basename(i).split(".").length == 2 } 63 65 @body = render_message(@template, @body) if template_exists 64 66 65 67 # Finally, if there are other message parts and a textual body exists, 66 68 # we shift it onto the front of the parts and set the body to nil (so 67 69 # that create_mail doesn't try to render it in addition to the parts). 68 70 if !@parts.empty? && String === @body 69 @parts.unshift Part.new(:charset => charset, :body => @body) 71 # Radiant: begin modifications 72 @parts.unshift ActionMailer::Part.new(:charset => charset, :body => @body) 73 # Radiant: end modifications 70 74 @body = nil 71 75 end 72 76 end 73 77 74 78 # If this is a multipart e-mail add the mime_version if it is not 75 79 # already set. 76 80 @mime_version ||= "1.0" if !@parts.empty? 77 81 78 82 # build the mail object itself 79 83 @mail = create_mail … … 81 85 82 86 def initialize_template_class_with_view_paths(assigns) 83 full_path = File.dirname( full_template_path("#{mailer_name}/#{@template}"))84 ActionView::Base.new( full_path, assigns, self)87 full_path = File.dirname(File.dirname(full_template_path("#{mailer_name}/#{@template}"))) 88 ActionView::Base.new([full_path], assigns, self) 85 89 end 86 90 end branches/rails2/lib/radiant/extension_loader.rb
r691 r692 34 34 def run 35 35 DependenciesObserver.new(configuration).observe(Dependencies) 36 37 36 discover_extensions 38 37 activate_extensions … … 42 41 load_extension_roots.each do |ext_path| 43 42 configuration.load_paths.concat load_paths_for(ext_path) 44 # TODO: use Dependencies.load_paths instead of $LOAD_PATH45 43 $LOAD_PATH.concat load_paths_for(ext_path) 46 44 configuration.controller_paths << "#{ext_path}/app/controllers" … … 106 104 107 105 def select_extension_roots 108 # put in the paths for extensions into the array106 # put in the paths for extensions into the array 109 107 roots = configuration.extensions.map do |ext_name| 110 108 if :all === ext_name … … 118 116 end 119 117 end 120 # replace the :all symbol with any remaining paths118 # replace the :all symbol with any remaining paths 121 119 roots.map do |ext_path| 122 120 :all === ext_path ? all_extension_roots : ext_path branches/rails2/lib/radiant/initializer.rb
r691 r692 57 57 configuration.view_paths << view_path if view_path and not configuration.view_paths.include?(view_path) 58 58 view_paths = configuration.view_paths.reverse 59 ActionMailer::Base.view_paths = view_paths if configuration.frameworks.include?(:action_mailer)59 ActionMailer::Base.view_paths = view_paths if (defined?(ActionMailer) and defined?(ActionMailer::Base)) or configuration.frameworks.include?(:action_mailer) 60 60 ActionController::Base.view_paths = view_paths if configuration.frameworks.include?(:action_controller) 61 61 end branches/rails2/test/functional/extension_initialization_test.rb
r691 r692 47 47 assert_admin_tabs "Basic Extension Tab" 48 48 Radiant::ExtensionLoader.reactivate [] 49 assert Radiant::AdminUI.tabs.all? { |tab| tab.name != "Basic Extension Tab" }49 assert Radiant::AdminUI.tabs.all? { |tab| tab.name != "Basic Extension Tab" } 50 50 ensure 51 51 Radiant::ExtensionLoader.reactivate Radiant::Extension.descendants
