added template json for title key author

This commit is contained in:
Harry Bomrah 2014-08-11 16:02:58 +08:00
parent 7dd2c25180
commit a1fb6ebd68
2 changed files with 14 additions and 5 deletions

View File

@ -5,11 +5,15 @@ class Admin::DesignsController < OrbitAdminController
@designs = [] @designs = []
Dir.glob("#{Rails.root}/app/templates/*").each do |template| Dir.glob("#{Rails.root}/app/templates/*").each do |template|
if template.split('/').last != "mobile" if template.split('/').last != "mobile"
@designs << { f = File.join("#{template}/template.json")
"key"=>template.split('/').last, if File.exists?f
"title"=>template.split('/').last.titleize, hash = JSON.parse(File.read(f)) rescue {}
"author"=>"Ray" @designs << {
} "key"=>hash["key"],
"title"=>hash["title"],
"author"=>hash["author"]
}
end
end end
end end

View File

@ -0,0 +1,5 @@
{
"title" : "Orbit Bootstrap",
"key" : "orbit_bootstrap",
"author" : "Ray"
}