Compare commits

..

1 Commits
master ... temp

Author SHA1 Message Date
JiangRu 0e32154d53 1.fix add news prompt
2.add is_hidden didn't show on son
2015-04-15 20:10:46 +08:00
9 changed files with 15 additions and 41 deletions

View File

@ -74,10 +74,8 @@ class Admin::NewsController < OrbitAdminController
if params["approved"] == "true"
news_bulletin.approved = true
news_bulletin.rejected = false
news_bulletin.reapproval = false
else
news_bulletin.rejected = true
news_bulletin.reapproval = false
news_bulletin.rejection_reason = params["reason"]
end
news_bulletin.save
@ -112,7 +110,6 @@ class Admin::NewsController < OrbitAdminController
end
news_bulletin.update_attributes(news_bulletin_params)
news_bulletin.reapproval = true if news_bulletin.rejected
news_bulletin.save
build_email(news_bulletin)
redirect_to params['referer_url']

View File

@ -19,6 +19,8 @@ class Admin::NewsbulletinsController < ApplicationController
end
bulletins = bulletins.where(:is_hot => params[:is_hot]) if !params[:is_hot].blank?
bulletins = bulletins.where(:is_hidden => false)
bulletins = bulletins.where(:category_id.in => params[:categories]) if !params[:categories].blank?
bulletins = bulletins.where(:tagged_ids.in => params[:tags]) if !params[:tags].blank?
bulletins = bulletins.where(:is_preview.in=>[false,nil])

View File

@ -112,19 +112,6 @@ class NewsController < ApplicationController
page = Page.where(:module => "news").first rescue nil
ma = ModuleApp.find_by_key("news") rescue nil
current_categories = OrbitHelper.widget_categories
categories_for_url = ma.categories.enabled.collect do |cat|
if current_categories.include?(cat.id.to_s)
{
"name" => cat.title,
"category-link" => "/#{I18n.locale.to_s + page.url}/?category=#{cat.to_param}"
}
end
end
categories_for_url.delete(nil)
categories_for_url = {"name" => "ALL", "category-link" => "/#{I18n.locale.to_s + page.url}/"} if categories_for_url.count != 1
categories = ma.categories.enabled.collect do |cat|
{
"name" => cat.title,
@ -153,6 +140,8 @@ class NewsController < ApplicationController
elsif I18n.locale.to_s == 'en'
subtitle = a.subtitle.truncate(200)
end
{
"title" => HTMLEntities.new.encode(a.title),
@ -168,7 +157,6 @@ class NewsController < ApplicationController
{
"news" => anns,
"categories" => categories,
"categories_for_url" => categories_for_url,
"extras" => {
"more_url"=>OrbitHelper.widget_more_url,
"title-head" => t('news.table.title'),
@ -207,10 +195,6 @@ class NewsController < ApplicationController
links = news.news_bulletin_links.collect{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
update_user = news.update_user.member_profile.name rescue ""
department = news.department rescue ""
request = OrbitHelper.request
meta_desc = news.subtitle.nil? || news.subtitle == "" ? news.text[0..200] : news.subtitle
OrbitHelper.render_meta_tags([{"property" => "og:title", "content" => news.title},{"property" => "og:site_name", "content" => Site.first.title},{"property" => "og:url", "content" => request.original_url},{"property" => "og:description", "content" => meta_desc},{"property" => "og:image", "content" => "#{request.base_url}#{news.image.url}"},{"property" => "og:type", "content" => "Article"}])
{
"tags" => tags,
"news_bulletin_files" => files,

View File

@ -22,7 +22,6 @@ class NewsBulletin
field :rss2_sn
field :approved, :type => Boolean, :default => false
field :rejected, :type => Boolean, :default => false
field :reapproval, :type => Boolean, :default => false
field :rejection_reason
field :is_preview, :type => Boolean, :default => false
field :image_description, localize: true

View File

@ -151,13 +151,16 @@
<div class="fileupload-alert alert alert-danger text-center" role="alert"></div>
<div class="image_note" style="color:red; font-size:14px;">
<br />
<%= t("ad.widget_info_for_ad_image_size", :best_size=> "( 400px x 200px )") %>
此區塊圖片尺寸使用比例為2:1(圖片寬:高)寬度最低400px亦即最小尺寸為400px*200px。
<br />
※<%= t("news.image_size_limit")%>
<br />
※上傳圖片格式僅支援.gif、.jpg、.png
<br />
※<%= t("news.image_note")%>
<br />
<a href="http://itservice.nccu.edu.tw/nccuweb/%E5%A6%82%E4%BD%95%E8%A3%81%E5%89%AA%E6%96%B0%E8%81%9E%E5%B0%81%E9%9D%A2%E5%9C%96%E7%89%87.pdf" target="_blank" style="color:red;">※如何裁剪新聞封面圖片</a>
※欲知「如何裁剪新聞封面圖片」,請點選
<a href="http://itservice.nccu.edu.tw/nccuweb/%E5%A6%82%E4%BD%95%E8%A3%81%E5%89%AA%E6%96%B0%E8%81%9E%E5%B0%81%E9%9D%A2%E5%9C%96%E7%89%87.pdf" target="_blank" style="color:red;"><此處></a>。
</div>
</div>
<div class="controls pull-left">
@ -224,11 +227,12 @@
<div class="image_note" style="color:red; font-size:14px;">
<span style="font-weight: bolder;">※建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。</span>
<br />
※內文裡單一圖片大小為1MB以下
※內文裡單一圖片大小為1MB以下
<br />
※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
<br />
<a href="http://itservice.nccu.edu.tw/nccuweb/%E5%A6%82%E4%BD%95%E8%A3%81%E5%89%AA%E6%96%B0%E8%81%9E%E5%9C%96%E7%89%87.pdf" target="_blank" style="color:red;">※如何剪裁新聞圖片。</a>
※欲知「如何裁剪新聞圖片」,請點選
<a href="http://itservice.nccu.edu.tw/nccuweb/%E5%A6%82%E4%BD%95%E8%A3%81%E5%89%AA%E6%96%B0%E8%81%9E%E5%9C%96%E7%89%87.pdf" target="_blank" style="color:red;"><此處></a>。
</div>
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>

View File

@ -34,14 +34,6 @@
<%= b.title_translations["en"] %> <span class='label'><%= t(:expired) %></span>
<% end %>
<% end %>
<% elsif b.rejected && b.reapproval %>
<% url = page_for_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a> <span class='label'><%= t("news.reapproval") %> : <%= t(:pending) %></span><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a> <span class='label'><%= t("news.reapproval") %> : <%= t(:pending) %></span>
<% end %>
<% elsif b.rejected %>
<% url = page_for_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
@ -75,7 +67,7 @@
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% elsif is_user_sub_manager? %>
<% if b.rejected && !b.approved %>
<% if !b.rejected && !b.approved %>
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<% end %>
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
@ -87,7 +79,7 @@
<% end %>
<% if (!b.rejected && !b.approved && user_can_approve? && !b.expired?) || (b.rejected && !b.approved && user_can_approve? && !b.expired? && b.reapproval) %>
<% if !b.rejected && !b.approved && user_can_approve? && !b.expired? %>
<li><a href="#" class="appoval_button" data-approve-link="<%= "/#{I18n.locale.to_s}/news/#{b.to_param}" %>" data-id="<%= b.id.to_s %>"><%= t("news.approve") %></a></li>
<% end %>
<% end %>

View File

@ -15,7 +15,6 @@ en:
category: Category
add_new: Add New
approve: Approve
reapproval: Re-approval
all_articles: All Articles
news: News
approval_setting: Approval Setting

View File

@ -32,7 +32,6 @@ zh_tw:
all: 全部類別
news: 新聞
approve: 審核
reapproval: 重新審核
admins: 單位設定
append_note: 以下之附加連結與檔案,為使前台顯示名稱,建議您輸入註解。
approval_setting: 審核設定
@ -64,7 +63,7 @@ zh_tw:
search_result: 搜尋結果頁
index_by_unit: index_by_unit
image: 封面圖片
image_note: 此處上傳的圖片不會在公告內文出現
image_note: 此處上傳的圖片不會在內文出現
image_size_limit: 圖片大小為1MB以下
link_name: 連結名稱
new_news_bulletin_category: 新增新聞類別

View File

@ -6,9 +6,7 @@ module News
base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget"]
widget_settings [{"data_count"=>12}]
models_to_cache [:news_bulletin]
# taggable "NewsBulletin"
models_to_cache [:news_bulletin]
categorizable
authorizable
frontend_enabled