Modifications for image urls

Find and replace the urls by the file urls in DB, in the theme files and
layout.html file. Save a copy of those files under "file_orig".
This commit is contained in:
chris2tof committed 2011-09-01 19:08:45 +08:00
1 parent f78400c274
commit 9101a2921e
5 files changed
+100 -57

No files matched your search

+24 -11
View File
@@ -60,6 +60,7 @@ class Design
end
protected
def del_embedded_objects
[[self.layout],self.themes, self.javascripts, self.images].each do |objects|
objects.each do |object|
@@ -67,20 +68,32 @@ class Design
end
end
end
def procs_embedded_objects
[[self.layout],self.themes, self.javascripts, self.images].each do |objects|
[[self.layout], self.javascripts, self.images].each do |objects|
objects.each do |object|
if object.file.blank?
object.to_save = false
end
if object.to_save
object.to_save = false
object.save
end
if object.to_destroy
object.destroy
end
process_object(object)
end
end
self.layout.parse_urls
self.themes.each do |theme|
to_parse_url = theme.to_save ? true : false
process_object(theme)
theme.parse_urls if to_parse_url
end
end
def process_object(object)
if object.file.blank?
object.to_save = false
end
if object.to_save
object.to_save = false
object.save
end
if object.to_destroy
object.destroy
end
end
end