announcement-link-widget/app/controllers/announcement_link_widgets_c...

18 lines
416 B
Ruby

require 'json'
class AnnouncementLinkWidgetsController < ApplicationController
def widget
data = {
"tags" => [],
"extras" => {
"heading-announcements" => "Announcements",
"heading-links" => "Links"
}
}
f = File.join(Rails.root, "public" , "announcement_link_widget_#{I18n.locale.to_s}.json")
if File.exists?(f)
contents = File.read(f)
data = JSON.parse(contents)
end
data
end
end