new output structure for view render
This commit is contained in:
parent
3847ed9a43
commit
b1585a5e4c
|
@ -2,28 +2,34 @@ class AnnouncementsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
announcements = Bulletin.all
|
announcements = Bulletin.all
|
||||||
announcements.collect do |a|
|
anns = announcements.collect do |a|
|
||||||
{
|
{
|
||||||
"title" => a.title,
|
"title" => a.title,
|
||||||
"body" => a.body,
|
"body" => a.body,
|
||||||
"link_to_show" => OrbitHelper.url_to_show(a.uid,a.title.parameterize),
|
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
|
||||||
"more" => "More"
|
"more" => "More",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
{
|
||||||
|
"data" => anns
|
||||||
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def widget
|
def widget
|
||||||
announcements = Bulletin.all
|
announcements = Bulletin.all
|
||||||
announcements.collect do |a|
|
anns = announcements.collect do |a|
|
||||||
{
|
{
|
||||||
"title" => a.title,
|
"title" => a.title,
|
||||||
"subtitle" => a.body,
|
"subtitle" => a.body,
|
||||||
"link_to_show" => OrbitHelper.url_to_show(a.uid,a.title.parameterize),
|
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
|
||||||
"more" => "More",
|
"more" => "More",
|
||||||
"link_to_index" => "index"
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
{
|
||||||
|
"extras" => {"link_to_index" => "index","name" => "Harry"},
|
||||||
|
"data" => anns
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,4 +41,5 @@ class AnnouncementsController < ApplicationController
|
||||||
"body" => announcement.body
|
"body" => announcement.body
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,10 +7,8 @@ class Bulletin
|
||||||
field :uid, type: String
|
field :uid, type: String
|
||||||
|
|
||||||
# include Slug
|
# include Slug
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
I18n.locale
|
self.title.gsub(/[ "'*@#$%^&()+=;:.,?>|\\<~_!]/,'-').gsub(/-{2,}/,'-')+'-'+self.uid
|
||||||
title.parameterize
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_param(input)
|
def self.find_by_param(input)
|
||||||
|
|
|
@ -4,6 +4,7 @@ module Announcement
|
||||||
OrbitApp.registration "Announcement", :type => "ModuleApp" do
|
OrbitApp.registration "Announcement", :type => "ModuleApp" do
|
||||||
module_label "announcement.announcement"
|
module_label "announcement.announcement"
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
widget_methods ["widget"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue