Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

layout support for merge_mailer

  • Loading branch information...
commit 593a7489b2ffc77c598ccbc89ad229ecb45059e4 1 parent 605dacd
Roman rkononov authored
4 lib/iron_worker/base.rb
View
@@ -70,9 +70,11 @@ def merge_mailer(mailer, params={})
f2 = IronWorker::MergeHelper.check_for_file(mailer, @caller_file)
basename = File.basename(mailer, f2[:extname])
path_to_templates = params[:path_to_templates] || File.join(Rails.root, "app/views/#{basename}")
- @merged_mailers[basename] = {:name=>basename, :path_to_templates=>path_to_templates, :filename => f2[:path]}.merge!(params)
+ path_to_layouts = params[:path_to_layouts] || File.join(Rails.root, "app/views/layouts")
+ @merged_mailers[basename] = {:name => basename, :path_to_templates => path_to_templates, :path_to_layouts => path_to_layouts, :filename => f2[:path]}.merge!(params)
end
+
def merge_folder(path)
files = []
#puts "caller_file=" + caller_file
2  lib/iron_worker/config.rb
View
@@ -88,7 +88,7 @@ def auto_merge=(b)
c2.models = models
models.each { |model| c2.merge(model) }
mailers_path = File.join(Rails.root, 'app/mailers/*.rb')
- Dir.glob(mailers_path).collect { |m| c2.mailers[File.basename(m)] = {:filename=>m, :name => File.basename(m), :path_to_templates=>File.join(Rails.root, "app/views/#{File.basename(m, File.extname(m))}")} }
+ Dir.glob(mailers_path).collect { |m| c2.mailers[File.basename(m)] = {:filename=>m, :name => File.basename(m), :path_to_layouts => File.join(Rails.root, "app/views/layouts"), :path_to_templates=>File.join(Rails.root, "app/views/#{File.basename(m, File.extname(m))}")} }
c2.extra_requires += ['active_support/core_ext', 'action_mailer']
#puts 'DB FILE=' + File.join(Rails.root, 'config', 'database.yml').to_s
if defined?(ActiveRecord) && File.exist?(File.join(Rails.root, 'config', 'database.yml'))
5 lib/iron_worker/service.rb
View
@@ -401,6 +401,11 @@ def self.env
zdest = "templates/#{mailer[:name]}/#{file.sub(path+'/', '')}"
f.add(zdest, file)
end
+ path = mailer[:path_to_layouts]
+ Dir["#{path}/**/**"].each do |file|
+ zdest = "templates/layouts/#{file.sub(path+'/', '')}"
+ f.add(zdest, file)
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.