From 16df9ac38aa54c78ce3df071717fb1270a73a1f1 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 25 Nov 2014 18:09:53 +0800 Subject: [PATCH] added author for announcement widget and index --- app/controllers/announcements_controller.rb | 6 ++++++ config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 3 files changed, 8 insertions(+) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 0e0ba29..602834f 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -10,12 +10,14 @@ class AnnouncementsController < ApplicationController "status-class" => "status-#{status['classname']}" } end + author = User.find(a.create_user_id).member_profile.name rescue "" { "title" => a.title, "subtitle" => a.subtitle, "statuses" => statuses, "category" => a.category.title, "postdate" => a.postdate, + "author" => author, "link_to_show" => OrbitHelper.url_to_show(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_description" => a.image_description, @@ -30,6 +32,7 @@ class AnnouncementsController < ApplicationController "title-head" => t('announcement.table.title'), "date-head" => t('announcement.table.date'), "status-head" => t('announcement.table.status'), + "author-head" => t('announcement.table.author'), "subtitle-head" => t('announcement.table.sub_title'), "category-head" => t('announcement.table.category') }, @@ -47,6 +50,7 @@ class AnnouncementsController < ApplicationController "status" => status["name"], "status-class" => "status-#{status['classname']}" } + author = User.find(a.create_user_id).member_profile.name rescue "" end { "title" => a.title, @@ -54,6 +58,7 @@ class AnnouncementsController < ApplicationController "statuses" => statuses, "category" => a.category.title, "postdate" => a.postdate, + "author" => author, "link_to_show" => OrbitHelper.widget_item_url(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_description" => a.image_description @@ -65,6 +70,7 @@ class AnnouncementsController < ApplicationController "more_url"=>OrbitHelper.widget_more_url, "title-head" => t('announcement.table.title'), "date-head" => t('announcement.table.date'), + "author-head" => t('announcement.table.author'), "status-head" => t('announcement.table.status'), "subtitle-head" => t('announcement.table.sub_title'), "category-head" => t('announcement.table.category') diff --git a/config/locales/en.yml b/config/locales/en.yml index ab5c5ba..94e889f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -7,6 +7,7 @@ en: status : Status sub_title: Sub Title category: Category + author: Author add_new: Add New approve: Approve all_articles: All Articles diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 261d1ab..7616fc4 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -7,6 +7,7 @@ zh_tw: status : 標籤 sub_title: 副標題 category: 類別 + author: 張貼人 add_new: 新建 approve: 通過 all_articles: 文章列表