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 = []
Dir.glob("#{Rails.root}/app/templates/*").each do |template|
if template.split('/').last != "mobile"
@designs << {
"key"=>template.split('/').last,
"title"=>template.split('/').last.titleize,
"author"=>"Ray"
}
f = File.join("#{template}/template.json")
if File.exists?f
hash = JSON.parse(File.read(f)) rescue {}
@designs << {
"key"=>hash["key"],
"title"=>hash["title"],
"author"=>hash["author"]
}
end
end
end

View File

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