From 678327686f0a12d3cb8716e558c8661b28a6e4b9 Mon Sep 17 00:00:00 2001 From: manson Date: Mon, 5 May 2014 16:30:18 +0800 Subject: [PATCH] Display tags,update_user,time in the frontend --- app/controllers/announcements_controller.rb | 4 ++++ lib/announcement/engine.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index fe41f70..baa00e7 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -36,14 +36,18 @@ class AnnouncementsController < ApplicationController params = OrbitHelper.params announcement = Bulletin.can_display.find_by(:uid=>params[:uid]) + tags = announcement.tags.map{|tag| { "tag" => tag.name } } files = announcement.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => file.title } } links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => link.title } } { + "tags" => tags, "bulletin_files" => files, "bulletin_links" => links, "data" => { "title" => announcement.title, + "update_user" => announcement.update_user.member_profile.name, + "updated_at" => announcement.updated_at.strftime('%Y-%m-%d %H:%M'), "body" =>announcement.text, "image" => announcement.image.url } diff --git a/lib/announcement/engine.rb b/lib/announcement/engine.rb index 7b424b6..f902bc0 100644 --- a/lib/announcement/engine.rb +++ b/lib/announcement/engine.rb @@ -18,12 +18,12 @@ module Announcement context_link 'announcement.all_articles', :link_path=>"admin_announcements_path" , :priority=>1, - :active_for_action=>{:bulletins=>:index}, + :active_for_action=>{'admin/announcement'=>'index'}, :available_for => [:all] context_link 'announcement.add_new', :link_path=>"new_admin_announcement_path" , :priority=>2, - :active_for_action=>{:bulletins=>:new}, + :active_for_action=>{'admin/announcement'=>'new'}, :available_for => [:sub_manager] # context_link 'announcement.categories', # :link_path=>"admin_announcement_path(get_module_app)" ,