some updates for the widget

This commit is contained in:
Harry Bomrah 2014-11-04 16:11:05 +08:00
parent d83bd64c06
commit e3cf299843
2 changed files with 3 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class AnnouncementLinkWidgetsController < ApplicationController
} }
f = File.join(Rails.root, "public" , "announcement_link_widget.json") f = File.join(Rails.root, "public" , "announcement_link_widget.json")
if File.exists?(f) if File.exists?(f)
contents = File.read('public/announcement_link_widget.json') contents = File.read(f)
data = JSON.parse(contents) data = JSON.parse(contents)
end end
data data

View File

@ -63,7 +63,8 @@ namespace :announcement_link_widget do
"heading-links" => "Links" "heading-links" => "Links"
} }
} }
File.open("public/announcement_link_widget.json","w") do |f| file = File.join(Rails.root, "public" , "announcement_link_widget.json")
File.open(file,"w") do |f|
f.write(@data.to_json) f.write(@data.to_json)
end end
end end