Merge branch 'nccu_master' into demo_site
Conflicts: Gemfile app/assets/javascripts/tinymce_orbit.js.erb app/assets/stylesheets/style.css.erb app/controllers/admin/assets_controller.rb app/controllers/admin/module_apps_new_interface_controller.rb app/controllers/admin/page_parts_controller.rb app/jobs/sync_db.rb app/models/page.rb app/models/page_part.rb app/models/user/user.rb app/uploaders/image_uploader.rb app/views/admin/assets/create.js.erb app/views/admin/module_apps/reload_frontend_pages.js.erb app/views/layouts/_orbit_bar.html.erb app/views/layouts/_side_bar.html.erb app/views/layouts/_users_checkbox_ary.html.erb app/views/shared/_privilege_user.html.erb config/mongoid.yml lib/parsers/parser_common.rb vendor/built_in_modules/announcement/announcement.json vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
This commit is contained in:
commit
7d5531bf01
432 files changed
+8773
-17035
No files matched your search
@@ -11,6 +11,7 @@
|
||||
"index":["1","2","3","4","5"],
|
||||
"bulletins_and_web_links":[]
|
||||
},
|
||||
"category": ["BulletinCategory"],
|
||||
"widget_fields":["title","category","postdate"],
|
||||
"enable_frontend": true
|
||||
}
|
||||
+21
-12
@@ -7,14 +7,23 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||
@bulletin = Bulletin.find params[:bulletin_id]
|
||||
end
|
||||
|
||||
# def approve
|
||||
#
|
||||
# end
|
||||
def approve
|
||||
notice = ""
|
||||
@bulletin = Bulletin.find params[:bulletin_id]
|
||||
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
|
||||
@bulletin.de_pending
|
||||
if @bulletin.save
|
||||
notice = t('bulletin.approve_bulletin_success')
|
||||
else
|
||||
notice = t('bulletin.approve_bulletin_fail')
|
||||
end
|
||||
redirect_to(panel_announcement_back_end_bulletins_url,:notice => notice)
|
||||
end
|
||||
|
||||
def setting
|
||||
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
|
||||
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.title,bc.id] }
|
||||
if params.has_key? :category
|
||||
@bulletin_category = BulletinCategory.find params[:category][:id]
|
||||
else
|
||||
@@ -51,12 +60,12 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||
object_auth
|
||||
end
|
||||
|
||||
def get_categorys(id = nil)
|
||||
@bulletin_categorys = []
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
end
|
||||
end
|
||||
# def get_categorys(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
# end
|
||||
# end
|
||||
end
|
||||
+16
-9
@@ -1,11 +1,11 @@
|
||||
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
|
||||
|
||||
|
||||
def index
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
@bulletin_categorys = get_categories_for_index("BulletinCategory")
|
||||
#TODO 需要做 manager ,admin 才可以 all. 其他 available就好
|
||||
@bulletin_category = BulletinCategory.new(:display => 'List')
|
||||
|
||||
@url = panel_announcement_back_end_bulletin_categorys_path
|
||||
|
||||
respond_to do |format|
|
||||
@@ -108,12 +108,19 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
|
||||
# DELETE /bulletins/1.xml
|
||||
def destroy
|
||||
@bulletin_category = BulletinCategory.find(params[:id])
|
||||
@bulletin_category.destroy
|
||||
@bulletin_category.disable = @bulletin_category.disable ? false : true
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
if @bulletin_category.save!
|
||||
respond_to do |format|
|
||||
flash[:notice] = t("bulletin_category.update_success")
|
||||
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("bulletin_category.update_failed")
|
||||
format.html { render :action => "index" }
|
||||
end
|
||||
end
|
||||
end
|
||||
+90
-81
@@ -1,14 +1,21 @@
|
||||
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
layout 'new_admin'
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
|
||||
controller.get_categorys('BulletinCategory')
|
||||
end
|
||||
# before_filter :for_admin_only,:only => [:]
|
||||
# before_filter :for_app_manager,:only => [:index,:show,]
|
||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
|
||||
def index
|
||||
# @bulletins = Bulletin.all
|
||||
# @bulletins = Bulletin.desc("postdate desc")
|
||||
get_categorys(params[:bulletin_category_id])
|
||||
get_tags
|
||||
get_categorys('BulletinCategory',params[:bulletin_category_id])
|
||||
get_tags
|
||||
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
@@ -27,15 +34,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||
end
|
||||
|
||||
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
|
||||
|
||||
# @bulletins = Bulletin.search(params[:search], params[:category_id])
|
||||
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
||||
@bulletin_categories = get_categories_for_index("BulletinCategory")
|
||||
@bulletin_category_ids = @bulletin_categories.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
|
||||
# @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
|
||||
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin") : get_viewable("bulletin")
|
||||
@bulletin_categories = BulletinCategory.all
|
||||
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin",:bulletin_category_id.in => @bulletin_category_ids) : get_viewable("bulletin",:bulletin_category_id.in => @bulletin_category_ids)
|
||||
|
||||
@bulletin_link = BulletinLink.new
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
@@ -54,16 +56,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# GET /bulletins/1.xml
|
||||
def show
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
get_tags
|
||||
# get_categorys
|
||||
|
||||
# @bulletin_categorys = BulletinCategory.where("_id" => params[:id])
|
||||
|
||||
# if params[:id]
|
||||
# @bulletins = Bulletin.where("bulletin_category_id" => params[:id])
|
||||
# else
|
||||
# @bulletins = Bulletin.desc("postdate desc")
|
||||
# end
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
@@ -74,22 +67,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# GET /bulletins/new
|
||||
# GET /bulletins/new.xml
|
||||
def new
|
||||
@bulletin = Bulletin.new
|
||||
@bulletin = Bulletin.new(:postdate => DateTime.now)
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
|
||||
# @bulletin.bulletin_files.build
|
||||
# @bulletin.bulletin_files.new
|
||||
|
||||
if get_categorys.empty?
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_tags
|
||||
respond_to do |format|
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
get_tags
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @bulletin }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,7 +87,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
||||
|
||||
get_categorys
|
||||
get_tags
|
||||
end
|
||||
end
|
||||
@@ -111,7 +94,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# POST /bulletins
|
||||
# POST /bulletins.xml
|
||||
def create
|
||||
|
||||
get_tags
|
||||
if params[:bulletin_link]
|
||||
|
||||
@bulletin_link = BulletinLink.new(params[:bulletin_link])
|
||||
@@ -128,22 +111,25 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_file.save
|
||||
format.js { render 'create_bulletin_file' }
|
||||
format.js { render 'create_bulletin_file' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@bulletin = Bulletin.new(params[:bulletin])
|
||||
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||
|
||||
@bulletin.create_user_id = current_user.id
|
||||
@bulletin.update_user_id = current_user.id
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin.de_pending
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin.save
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('announcement.create_bulletin_success')) }
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
||||
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.create_bulletin_success')) }
|
||||
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||
format.js
|
||||
else
|
||||
@@ -156,13 +142,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
end
|
||||
|
||||
def link_quick_add
|
||||
# debugger
|
||||
|
||||
def link_quick_add
|
||||
@bulletin_link = BulletinLink.new
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
|
||||
@bulletin_link.bulletin_id = params[:bulletin_id]
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
@bulletin_link.bulletin_id = params[:bulletin_id]
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
@@ -171,29 +154,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def link_quick_edit
|
||||
# debugger
|
||||
@bulletin_link = BulletinLink.find(params[:bulletin_id])
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||
|
||||
# @bulletin = Bulletin.find(params[:bulletin_id])
|
||||
|
||||
# @link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def file_quick_add
|
||||
# debugger
|
||||
|
||||
def file_quick_add
|
||||
@bulletin_file = BulletinFile.new
|
||||
@file_url = panel_announcement_back_end_bulletins_path
|
||||
|
||||
@bulletin_file.bulletin_id = params[:bulletin_id]
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
@@ -201,11 +172,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def file_quick_edit
|
||||
# debugger
|
||||
@bulletin_file = BulletinFile.find(params[:bulletin_id])
|
||||
|
||||
@file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
@@ -213,15 +181,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
# PUT /bulletins/1
|
||||
# PUT /bulletins/1.xml
|
||||
|
||||
def update
|
||||
|
||||
if params[:bulletin_link]
|
||||
if params[:bulletin_link]
|
||||
|
||||
@bulletin_link = BulletinLink.find(params[:id])
|
||||
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @bulletin_link.update_attributes(params[:bulletin_link])
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js { render 'update_bulletin_link' }
|
||||
@@ -235,6 +204,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
@file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @bulletin_file.update_attributes(params[:bulletin_file])
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js { render 'update_bulletin_file' }
|
||||
@@ -244,9 +214,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
else
|
||||
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||
|
||||
@bulletin.update_user_id = current_user.id
|
||||
|
||||
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'
|
||||
# if params[:bulletin][:image_del] == '1'
|
||||
@@ -255,22 +222,37 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# params[:bulletin][:image_del] = nil
|
||||
# end
|
||||
|
||||
|
||||
delete_out_invalid_date_from_params
|
||||
respond_to do |format|
|
||||
|
||||
if @bulletin.update_attributes(params[:bulletin])
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin.is_checked = true
|
||||
@bulletin.is_rejected = false
|
||||
@bulletin.de_pending!
|
||||
end
|
||||
# if (params[:bulletin][:is_checked] == "false")
|
||||
# @bulletin.is_rejected = true
|
||||
# @bulletin.save!
|
||||
# end
|
||||
# if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||
# @bulletin.deadline = nil
|
||||
# @bulletin.update_user_id = current_user.id
|
||||
# @bulletin.save!
|
||||
# end
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) }
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||
format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
get_tags
|
||||
get_categorys
|
||||
get_tags
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# DELETE /bulletins/1
|
||||
@@ -281,6 +263,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
@bulletin.destroy
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
@@ -302,12 +285,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
@type = params[:type]
|
||||
@bulletin_categories = BulletinCategory.all
|
||||
#TODO 需要做 manager ,admin 才可以 all. 其他 available就好
|
||||
|
||||
get_tags
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:to_delete]
|
||||
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
|
||||
if params[:ids]
|
||||
bulletins = Bulletin.any_in(:_id => params[:ids]).delete_all
|
||||
end
|
||||
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
@@ -315,15 +300,39 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys(id = nil)
|
||||
@bulletin_categorys = []
|
||||
#@unit_list_for_anc = UnitListForAnc.all
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit')
|
||||
end
|
||||
def delete_out_invalid_date_from_params
|
||||
if((params[:bulletin]["deadline(1i)"] && params[:bulletin]["deadline(1i)"].blank?) or (params[:bulletin]["deadline(2i)"] && params[:bulletin]["deadline(2i)"].blank?) or (params[:bulletin]["deadline(3i)"] && params[:bulletin]["deadline(3i)"].blank?))
|
||||
params[:bulletin].delete("deadline(1i)")
|
||||
params[:bulletin].delete("deadline(2i)")
|
||||
params[:bulletin].delete("deadline(3i)")
|
||||
params[:bulletin].delete("deadline(4i)")
|
||||
params[:bulletin].delete("deadline(5i)")
|
||||
@bulletin.deadline = nil
|
||||
end rescue nil
|
||||
end
|
||||
|
||||
# def get_categories_for_index(id = nil)
|
||||
# @bulletin_categories = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categories = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categories = BulletinCategory.all
|
||||
# end
|
||||
# @bulletin_categories
|
||||
# end
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categorys = BulletinCategory.all.authed_for_user(current_user,'submit')
|
||||
# end
|
||||
# if @bulletin_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
||||
|
||||
+54
-22
@@ -7,40 +7,72 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
|
||||
# GET /bulletins
|
||||
# GET /bulletins.xml
|
||||
|
||||
def index_bulletins_by_unit
|
||||
@page = Page.find(params[:page_id]) rescue nil
|
||||
@bulletins=Bulletin.all.available_for_lang(I18n.locale).can_display.where("cache_dept.#{I18n.locale.to_s.downcase}"=>params[:name]).page( params[:page_main]).per(15)
|
||||
render :index
|
||||
end
|
||||
|
||||
def index
|
||||
|
||||
@item = Page.find(params[:page_id])
|
||||
@item = Page.find(params[:page_id])
|
||||
|
||||
if @item.frontend_data_count
|
||||
@page_num = @item.frontend_data_count
|
||||
else
|
||||
@page_num = 10
|
||||
end
|
||||
|
||||
@page_num = @item.frontend_data_count
|
||||
else
|
||||
@page_num = 15
|
||||
end
|
||||
@frontend_style = @item.frontend_style
|
||||
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
|
||||
@page = Page.find(params[:page_id]) rescue nil
|
||||
if !params[:search_query].blank?
|
||||
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false}
|
||||
# search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||
@search = Bulletin.solr_search do
|
||||
fulltext params[:search_query]
|
||||
with(:frontend_search,true)
|
||||
#order_by(:average_rating)
|
||||
end
|
||||
search_result = @search.results.collect{|result| result.id}
|
||||
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:category_id].blank?
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
else
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
end
|
||||
impressionist(@tag) if @tag
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@page = Page.find(params[:page_id]) rescue nil
|
||||
if params[:preview] == "true"
|
||||
preview_content
|
||||
else
|
||||
@bulletin = Bulletin.can_display.where(_id: params[:id]).first
|
||||
impressionist(@bulletin)
|
||||
get_categorys
|
||||
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
|
||||
if !@bulletin.disable? and !@bulletin.is_rejected
|
||||
if @bulletin.enabled_for_lang(I18n.locale.to_s)
|
||||
impressionist(@bulletin)
|
||||
get_categorys
|
||||
else
|
||||
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => 403
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -53,7 +85,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@bulletin_categorys = BulletinCategory.excludes('disabled' => true)
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
end
|
||||
|
||||
end
|
||||
+18
-16
@@ -1,5 +1,4 @@
|
||||
class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'announcement'
|
||||
@@ -48,23 +47,23 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
|
||||
def bulletins_list_and_pic
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||
@bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
|
||||
else
|
||||
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
|
||||
end
|
||||
|
||||
get_categorys
|
||||
@@ -72,32 +71,35 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def bulletins_and_web_links
|
||||
@tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest'])
|
||||
@tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest']).asc(:order)
|
||||
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
|
||||
@bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||
@bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def reload_bulletins
|
||||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||
@bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||
@bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def reload_web_links
|
||||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def bulletins_side_bar
|
||||
@tags = AnnouncementTag.all
|
||||
@tags_and_class = AnnouncementTag.sorted_for_cloud
|
||||
get_categorys
|
||||
end
|
||||
|
||||
def bulletins_search_block
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@bulletin_categorys = BulletinCategory.excludes('disabled' => true)
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
+45
-2
@@ -1,9 +1,52 @@
|
||||
module Panel::Announcement::BackEnd::BulletinsHelper
|
||||
|
||||
def show_reject_reason(bulletin)
|
||||
by_bulletin = bulletin.is_rejected
|
||||
by_user = (((bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?)
|
||||
by_bulletin && by_user
|
||||
end
|
||||
|
||||
def show_form_status_field(bulletin)
|
||||
#by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?)
|
||||
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
|
||||
by_user
|
||||
end
|
||||
|
||||
def show_approval_link(bulletin)
|
||||
by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?)
|
||||
by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?)
|
||||
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
|
||||
by_bulletin and by_user
|
||||
end
|
||||
|
||||
def show_delete_link(bulletin)
|
||||
by_bulletin = (bulletin.create_user_id == current_user.id)
|
||||
by_user = (is_manager? or is_admin?)
|
||||
by_bulletin or by_user
|
||||
end
|
||||
|
||||
def show_bulletin_title_at_index (bulletin)
|
||||
if bulletin.is_checked?
|
||||
link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''
|
||||
else
|
||||
bulletin.title
|
||||
end
|
||||
end
|
||||
|
||||
def file_picture_preview_setting(file_path)
|
||||
res= ""
|
||||
ext = File.extname(file_path)
|
||||
unless file_path.nil?
|
||||
case ext
|
||||
when ".jpg",".jpeg",".png",".gif"
|
||||
#res = '<div class="for_preview" style="display:none;">'
|
||||
#res << image_tag(file_path, {:title => t(:view)})
|
||||
#res << '</div>'
|
||||
#res.html_safe
|
||||
{"data-content" => "#{image_tag file_path}" }
|
||||
else
|
||||
{"data-content" => t("sys.not_previewable") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,11 +1,15 @@
|
||||
class AnnouncementTag < Tag
|
||||
|
||||
has_and_belongs_to_many :bulletins
|
||||
field :order,:default => 0
|
||||
|
||||
|
||||
def get_visible_bulletins(sort = :name)
|
||||
def get_visible_bulletins(sort = :title)
|
||||
date_now = Time.now
|
||||
self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
|
||||
self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
|
||||
end
|
||||
|
||||
def bulletins
|
||||
Bulletin.all.any_in(:_id => bulletin_ids)
|
||||
end
|
||||
|
||||
end
|
||||
+94
-50
@@ -1,21 +1,32 @@
|
||||
# encoding: utf-8
|
||||
|
||||
# require "impressionist"
|
||||
class Bulletin
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
include Sunspot::Mongo
|
||||
include Impressionist::Impressionable
|
||||
|
||||
BelongsToCategory = :bulletin_category
|
||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
||||
|
||||
# include NccuSearch
|
||||
|
||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :title, localize: true
|
||||
field :subtitle, localize: true
|
||||
field :text, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "AnnouncementTag"
|
||||
|
||||
field :postdate , :type => DateTime
|
||||
field :deadline , :type => DateTime
|
||||
# field :url
|
||||
field :cache_dept,type: Hash
|
||||
|
||||
field :create_user_id
|
||||
field :update_user_id, :class_name => "User"
|
||||
|
||||
@@ -32,12 +43,13 @@ class Bulletin
|
||||
|
||||
field :public, :type => Boolean, :default => true
|
||||
|
||||
scope :can_display,where(is_checked: true)
|
||||
|
||||
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false)
|
||||
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :bulletin_category
|
||||
# belongs_to :unit_list_for_anc
|
||||
|
||||
# belongs_to :unit_list_for_anc
|
||||
|
||||
# embeds_many :bulletin_links, :cascade_callbacks => true
|
||||
# embeds_many :bulletin_files, :cascade_callbacks => true
|
||||
@@ -48,13 +60,59 @@ class Bulletin
|
||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
||||
|
||||
validates_presence_of :title
|
||||
|
||||
before_save :set_key, :update_status
|
||||
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
before_save :check_deadline, :update_avliable_language, :clean_tags
|
||||
|
||||
before_save :fetch_dept
|
||||
after_save :save_bulletin_links
|
||||
after_save :save_bulletin_files
|
||||
|
||||
|
||||
searchable do
|
||||
text :titles do
|
||||
title_translations.to_a.collect{|t| t[1]}
|
||||
end
|
||||
text :texts do
|
||||
text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text}
|
||||
end
|
||||
# text :text do
|
||||
# a = (title_translations["zh_tw"] + title_translations["en"])
|
||||
# a
|
||||
# end
|
||||
boolean :frontend_search do
|
||||
( !is_hidden && !is_pending && is_checked && !is_rejected )
|
||||
end
|
||||
|
||||
integer :view_count
|
||||
string :bulletin_category_id
|
||||
end
|
||||
|
||||
def proc_check(check,not_pass_info = "")
|
||||
self.is_checked = true
|
||||
if check =="true"
|
||||
self.is_rejected = false
|
||||
elsif check == "false"
|
||||
self.is_rejected = true
|
||||
self.not_checked_reason = not_pass_info
|
||||
end
|
||||
end
|
||||
|
||||
def de_pending
|
||||
self.is_pending = false
|
||||
end
|
||||
|
||||
def de_pending!
|
||||
de_pending
|
||||
self.save!
|
||||
end
|
||||
|
||||
def enabled_for_lang(lang)
|
||||
eval("self.available_for_#{lang}")
|
||||
end
|
||||
|
||||
def publish_month
|
||||
published_at.strftime("%B %Y")
|
||||
end
|
||||
|
||||
def self.search( search = nil, category_id = nil )
|
||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
||||
@@ -103,9 +161,9 @@ class Bulletin
|
||||
def is_hidden?
|
||||
self.is_hidden
|
||||
end
|
||||
|
||||
|
||||
def is_checked?
|
||||
self.is_checked
|
||||
!self.is_pending && self.is_checked && (self.is_rejected == false)
|
||||
end
|
||||
|
||||
def is_pending?
|
||||
@@ -113,7 +171,7 @@ class Bulletin
|
||||
end
|
||||
|
||||
def is_rejected?
|
||||
self.is_rejected
|
||||
!self.is_pending && self.is_rejected && (self.is_rejected == true)
|
||||
end
|
||||
|
||||
|
||||
@@ -132,19 +190,6 @@ class Bulletin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def title
|
||||
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def subtitle
|
||||
@subtitle ||= I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def text
|
||||
@text ||= I18nVariable.first(:conditions => {:key => 'text', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def self.filter(bulletins)
|
||||
bulletins.each do |bulletin|
|
||||
@@ -159,29 +204,28 @@ class Bulletin
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
if title && title.new_record?
|
||||
title.key = 'title'
|
||||
def check_deadline
|
||||
if(!self.deadline.nil? and (self.deadline < self.postdate ))
|
||||
self.deadline = nil
|
||||
end
|
||||
if subtitle && subtitle.new_record?
|
||||
subtitle.key = 'subtitle'
|
||||
end
|
||||
if text && text.new_record?
|
||||
text.key = 'text'
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
self["available_for_#{locale}".to_sym] = false
|
||||
else
|
||||
self["available_for_#{locale}".to_sym] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fetch_dept
|
||||
self.cache_dept = (User.find(self.create_user_id).cache_dept rescue nil) if self.new_record?
|
||||
end
|
||||
|
||||
def update_status
|
||||
if !self.is_pending && !self.is_checked
|
||||
self.is_pending = false
|
||||
self.is_rejected = true
|
||||
self.is_checked = false
|
||||
elsif self.is_checked
|
||||
self.is_pending = false
|
||||
self.is_rejected = false
|
||||
self.is_checked = true
|
||||
end
|
||||
def clean_tags
|
||||
self.tag_ids.delete('')
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4,26 +4,28 @@ class BulletinCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
include OrbitCoreLib::ObjectDisable
|
||||
|
||||
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||
AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys'
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
|
||||
PAYMENT_TYPES = [ "List", "Picture" ]
|
||||
APP_NAME = 'Announcement'
|
||||
field :key
|
||||
|
||||
field :disable, type: Boolean, :default => false
|
||||
field :display
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :key
|
||||
field :title, localize: true
|
||||
|
||||
has_many :bulletins
|
||||
|
||||
def pp_object
|
||||
i18n_variable[I18n.locale]
|
||||
title
|
||||
end
|
||||
|
||||
def self.from_id(id)
|
||||
BulletinCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -4,37 +4,11 @@ class BulletinFile
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
# field :filetitle
|
||||
# field :description
|
||||
has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
# field :to_save, :type => Boolean
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
field :description, localize: true
|
||||
field :should_destroy, :type => Boolean
|
||||
field :title, localize: true
|
||||
|
||||
belongs_to :bulletin
|
||||
# embedded_in :bulletin
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def filetitle
|
||||
@filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def description
|
||||
@description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
if filetitle && filetitle.new_record?
|
||||
filetitle.key = 'filetitle'
|
||||
end
|
||||
if description && description.new_record?
|
||||
description.key = 'description'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4,12 +4,22 @@ class BulletinLink
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :url
|
||||
# field :name
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :title, localize: true
|
||||
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
# embedded_in :bulletin
|
||||
belongs_to :bulletin
|
||||
|
||||
before_validation :add_http
|
||||
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
||||
self.url = 'http://' + self.url
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
class AnnouncementTag < Tag
|
||||
|
||||
has_and_belongs_to_many :bulletins
|
||||
|
||||
|
||||
def get_visible_bulletins(sort = :name)
|
||||
date_now = Time.now
|
||||
self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -5,8 +5,7 @@ class UnitListForAnc
|
||||
field :order
|
||||
field :ut_code
|
||||
field :up_ut_code
|
||||
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true
|
||||
field :title, localize: true
|
||||
|
||||
|
||||
end
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<ul class="list">
|
||||
<li><%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path if is_manager?%></li>
|
||||
<li><%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path if is_manager?%></li>
|
||||
<li><%= link_to t('bulletin.fact_check_for_manager'), panel_announcement_back_end_fact_checks_path if is_manager?%></li>
|
||||
|
||||
<li><%= link_to t('bulletin.my_announcement'), panel_announcement_back_end_list_mine_path if is_sub_manager? %></li>
|
||||
<li><%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path if is_sub_manager? %></li>
|
||||
|
||||
</ul>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<h1><%= bulletin_category.key %></h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('bulletin.status') %></th>
|
||||
<th><%= t('bulletin.category') %></th>
|
||||
<th><%= t('bulletin.title') %></th>
|
||||
<th><%= t('bulletin.postdate') %></th>
|
||||
<th><%= t('bulletin.deadline') %></th>
|
||||
<th><%= t('bulletin.action') %></th>
|
||||
</tr>
|
||||
|
||||
<% bulletin_category.bulletins.each do |post| %>
|
||||
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>false} %>
|
||||
<% end %>
|
||||
</table>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<% content_for :secondary do %>
|
||||
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<%= render :partial => "list_table", :collection => @bulletin_categorys ,:as => :bulletin_category%>
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'clear'} do |f| %>
|
||||
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
|
||||
+5
-6
@@ -4,18 +4,17 @@
|
||||
<%= bulletin_category.key %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to show_toggle_archive_btn(bulletin_category) , panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=> "archive_toggle" %></li>
|
||||
<% end %>
|
||||
<%if is_manager? || is_admin? %>
|
||||
<li><%= show_anc_cate_permission_link(bulletin_category) %></li>
|
||||
<% end %>
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
|
||||
<td><%= bulletin_category.title_translations[locale] rescue nil %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
+2
-2
@@ -10,12 +10,12 @@
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
+2
-2
@@ -7,12 +7,12 @@
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
$("#<%= dom_id @bulletin_category %>").remove();
|
||||
$("#<%= dom_id @bulletin_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@bulletin_category) %> ");
|
||||
+12
-10
@@ -28,10 +28,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td><%= bulletin.bulletin_category.title rescue nil %></td>
|
||||
<td>
|
||||
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
|
||||
|
||||
<%= show_bulletin_title_at_index bulletin%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
@@ -42,21 +41,24 @@
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
|
||||
<ul class="dropdown-menu" id="menu1">
|
||||
<li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li>
|
||||
<li><%= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
|
||||
<li><%#= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
|
||||
<li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li>
|
||||
<li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
|
||||
<li><%= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
|
||||
<li><%#= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
|
||||
<li><%#= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
|
||||
<% end %>
|
||||
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
|
||||
<% end -%>
|
||||
<% if show_delete_link(bulletin) %>
|
||||
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
<% if show_approval_link(bulletin) %>
|
||||
<li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
<% if show_reject_reason(bulletin)%>
|
||||
<li><%= link_to t('rejected_reason')+truncate(bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
+4
-4
@@ -13,23 +13,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.fields_for :filetitle, (@bulletin_file.new_record? ? @bulletin_file.build_filetitle : @bulletin_file.filetitle ) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<label for="file-<%= locale %>" class="control-label">Name <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@bulletin_file.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= f.fields_for :description, (@bulletin_file.new_record? ? @bulletin_file.build_description : @bulletin_file.description ) do |f| %>
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<label for="file-<%= locale %>" class="control-label">Description <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@bulletin_file.description_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
+2
-2
@@ -14,13 +14,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.fields_for :i18n_variable, (@bulletin_link.new_record? ? @bulletin_link.build_i18n_variable : @bulletin_link.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%#= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale %>
|
||||
<%= f.text_field locale, :class => 'control-label', :value => (@bulletin_link.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
||||
<%= f.file_field :file %>
|
||||
|
||||
<%= f.label :file_title %>
|
||||
<%= f.text_field :filetitle %>
|
||||
<%= f.text_field :title %>
|
||||
|
||||
<%= f.label :file_description %>
|
||||
<%= f.text_field :description %>
|
||||
|
||||
+1
-1
@@ -34,4 +34,4 @@
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "sort_header" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @bulletin_categories.each do |category| -%>
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<%= link_to category.title, panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
||||
Vendored
+32
-56
@@ -4,42 +4,6 @@
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div id="sub-wiget">
|
||||
<div id="widget-picture" class="widget-box">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
|
||||
<div class="widget-content clear">
|
||||
<div class="control-group">
|
||||
<!-- <img class="pull-left upload-picture" src="/assets/default-img.png" /> -->
|
||||
<div class="upload-picture">
|
||||
<!--請程式務必將圖片尺寸加入到行內裡-->
|
||||
<% if @bulletin.image %>
|
||||
<%= image_tag @bulletin.image rescue ''%>
|
||||
<% else %>
|
||||
<img class="pull-left upload-picture" src="/assets/default-img.png" />
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="controls file-upload input-prepend">
|
||||
<label class="control-label add-on btn" for="input-upload">
|
||||
<%= t(:browse) %>
|
||||
<%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
|
||||
</label>
|
||||
<span id='fu' class="file-name"></span>
|
||||
<br>
|
||||
<input name='fu' class="input-medium" type="text">
|
||||
<br>
|
||||
<% if @bulletin.image.file %>
|
||||
<%= f.check_box :remove_image %>
|
||||
<%= t('announcement.刪除已上傳檔案') %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="widget-date" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
@@ -61,7 +25,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% if show_form_status_field(@bulletin)%>
|
||||
<div id="widget-status" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Setting the announcement state" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
@@ -84,7 +49,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<% if @bulletin.is_rejected %>
|
||||
<div id="widget-rejected" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Rejected Report" class="icon-cog icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Approval Status</h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<%= @bulletin.not_checked_reason rescue t("rejected_reason_empty") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="widget-tags" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
|
||||
@@ -94,8 +70,9 @@
|
||||
<p>
|
||||
<% @tags.each do |tag| %>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %>
|
||||
<%= tag[I18n.locale] %>
|
||||
<%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
@@ -121,10 +98,10 @@
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<%#= f.label :unit_list_for_anc%>
|
||||
<%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
<%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<%= f.label :category %>
|
||||
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
<%= f.label :category,t('announcement.bulletin.category')%>
|
||||
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
||||
@@ -141,26 +118,19 @@
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<%= f.label :title ,t('announcement.bulletin.title')%>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@bulletin.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
<%= f.label :text ,t('announcement.bulletin.text')%>
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@bulletin.text_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -239,6 +209,8 @@
|
||||
<div id='add_bulletin_file' class="info_input bulletin_files_block">
|
||||
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
|
||||
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
|
||||
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
|
||||
<p><%= t("sys.preview_only_for_img") %></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -278,6 +250,8 @@
|
||||
<%= javascript_include_tag "bulletin_form" %>
|
||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#add_bulletin_link a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_bulletin_links", "g");
|
||||
@@ -290,5 +264,7 @@
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
|
||||
});
|
||||
$('.for_preview').popover({ html : true });
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
+7
-5
@@ -4,7 +4,8 @@
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
<%= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
<%#= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
<%= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_bulletin_file.file.url)) ) : '' %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -16,11 +17,11 @@
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :filetitle, (form_bulletin_file.new_record? ? form_bulletin_file.build_filetitle : form_bulletin_file.filetitle ) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_bulletin_file.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -40,11 +41,11 @@
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :description, (form_bulletin_file.new_record? ? form_bulletin_file.build_description : form_bulletin_file.description ) do |f| %>
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_bulletin_file.description_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -62,6 +63,7 @@
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= hidden_field_tag :tr, (dom_id form_bulletin_file) %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
|
||||
+4
-3
@@ -17,11 +17,11 @@
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :i18n_variable, (form_bulletin_link.new_record? ? form_bulletin_link.build_i18n_variable : form_bulletin_link.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge", :value => (form_bulletin_link.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -38,7 +38,8 @@
|
||||
<% if form_bulletin_link.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id, :id => 'tr', :class => 'tr' %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= hidden_field_tag :tr, (dom_id form_bulletin_link) %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
|
||||
+2
-4
@@ -1,7 +1,6 @@
|
||||
|
||||
<tr id="<%= dom_id list_bulletin_file %>">
|
||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %></td>
|
||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %></td>
|
||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.title_translations['zh_tw'], list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description_translations['zh_tw']} ) : list_bulletin_file.title_translations['zh_tw'] %></td>
|
||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.title_translations['en'], list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description_translations['en']} ) : list_bulletin_file.title_translations['zh_tw'] %></td>
|
||||
<td>
|
||||
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
@@ -14,7 +13,6 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<tr id="<%= dom_id list_bulletin_link %>">
|
||||
<td><%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_bulletin_link.title_translations['zh_tw'], list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_bulletin_link.title_translations['en'], list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td>
|
||||
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(list_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
|
||||
+17
-15
@@ -3,18 +3,18 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :bulletin_category_id, @bulletin_categories.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %>
|
||||
<%= f.select :bulletin_category_id, @bulletin_categories.collect {|t| [ t.title, t.id ]}, {}, :class => 'input-large' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :title, bulletin.title do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -25,27 +25,29 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:start) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :postdate, {}, :class => 'input-small' %>
|
||||
<%= f.datetime_select :postdate, { :use_month_numbers => true, :order => [:day, :month, :year] }, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:end) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :deadline, {}, :class => 'input-small' %>
|
||||
<%= f.datetime_select :deadline, { :use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="widget-status">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:status) %></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline"><%= f.check_box :is_hot %><%= t(:hot) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_top %><%= t(:top) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_hidden %><%= t(:hidden) %></label>
|
||||
<% if show_form_status_field(@bulletin)%>
|
||||
<div id="widget-status">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:status) %></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline"><%= f.check_box :is_hot %><%= t(:hot) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_top %><%= t(:top) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_hidden %><%= t(:hidden) %></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="widget-role">
|
||||
<% end -%>
|
||||
<!-- <div id="widget-role">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Role</label>
|
||||
<div class="controls">
|
||||
@@ -58,5 +60,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
+2
-1
@@ -4,9 +4,10 @@
|
||||
<div class="form-horizontal">
|
||||
<% @tags.each do |tag| %>
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, bulletin.tag_ids.include?(tag.id) %>
|
||||
<%= tag[I18n.locale] %>
|
||||
</label>
|
||||
<%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'bulletin.status'],
|
||||
<%= render_sort_bar(true, delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
||||
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'bulletin.status'],
|
||||
['category', 'bulletin_category', 'span1-2', 'bulletin.category'],
|
||||
['title', 'title','span7', 'bulletin.title'],
|
||||
['start_date', 'postdate', 'span1-2', 'bulletin.start_date'],
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'list_bulletin_file', :collection => [@bulletin_file] %>
|
||||
Vendored
+4
@@ -8,3 +8,7 @@
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "bulletin_form" %>
|
||||
<% end %>
|
||||
|
||||
Vendored
+11
-7
@@ -1,9 +1,7 @@
|
||||
<%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'bulletins' %>
|
||||
</table>
|
||||
<% end %>
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'bulletins' %>
|
||||
</table>
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' %>
|
||||
@@ -14,7 +12,13 @@
|
||||
|
||||
<div id="bulletin_link_qe">
|
||||
<div id="modal-link" class="modal fade">
|
||||
<%= render :partial => "bulletin_link_qe" %>
|
||||
<%#= render :partial => "bulletin_link_qe" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="news_bulletin_file_qe">
|
||||
<div id="modal-file" class="modal fade">
|
||||
<%#= render :partial => "bulletin_file_qe" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Vendored
+6
-6
@@ -1,7 +1,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<b><%= t('announcement.category') %></b>
|
||||
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %>
|
||||
<%= @bulletin.bulletin_category.title rescue nil %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.postdate') %></b>
|
||||
@@ -9,7 +9,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.title') %></b>
|
||||
<%= @bulletin.title[I18n.locale] %>
|
||||
<%= @bulletin.title %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
|
||||
@@ -17,23 +17,23 @@
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.subtitle') %></b>
|
||||
<%= @bulletin.subtitle[I18n.locale].html_safe %>
|
||||
<%= @bulletin.subtitle.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.text') %></b>
|
||||
<%= @bulletin.text[I18n.locale].html_safe %>
|
||||
<%= @bulletin.text.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<b><%= t('announcement.link') %></b>
|
||||
<% @bulletin.bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.file') %></b>
|
||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
||||
<% sys_users = User.all -%>
|
||||
<% sys_users.each do |user| -%>
|
||||
|
||||
<div class="checkblock">
|
||||
<% user.sub_roles.each do |sr| %>
|
||||
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
|
||||
<% end %>
|
||||
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.fact_check_setting_window_title'),:content => "#{user.sub_roles.collect{|sr| sr.key}.join(',')}"},:class=>"checkbox clear" do %>
|
||||
<div class="check-icon">
|
||||
</div>
|
||||
<div class='member-avatar'>
|
||||
<% if user.avatar? %>
|
||||
<%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
|
||||
<% else %>
|
||||
<%= image_tag "person.png",:class => "member-img" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
|
||||
<%= check_box_tag "[users][#{user.id}]", 'true',users.include?(user),:class => "check" -%>
|
||||
<%end -%>
|
||||
</div>
|
||||
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
Vendored
+32
-5
@@ -2,11 +2,7 @@
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<% if @current_category %>
|
||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] %></h1>
|
||||
<% else %>
|
||||
<h1 class="h1"><%= t('announcement.announcement') %></h1>
|
||||
<% end %>
|
||||
<h1 class="h1"><%= @page.title rescue nil %></h1>
|
||||
|
||||
<% if !@item.frontend_field.blank? %>
|
||||
|
||||
@@ -229,7 +225,38 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<%= content_tag (:th) do %>
|
||||
<%= t('announcement.bulletin.category') %>
|
||||
<% end if (!params[:search_query].blank? or params[:category_id].blank?)-%>
|
||||
<th><%= t('announcement.bulletin.title') %></th>
|
||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||
</tr>
|
||||
<% if !params[:name].blank?%>
|
||||
<%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
|
||||
<% end %>
|
||||
|
||||
<% if @bulletins.blank? and !params[:search_query].blank? %>
|
||||
<%=render :partial => 'shared/search_not_found' %>
|
||||
<% elsif !params[:search_query].blank? %>
|
||||
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@bulletins.count) unless (@bulletins.count == 30) %>
|
||||
<%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
|
||||
<% end %>
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<tr class=<%= cycle('odd', '') %>>
|
||||
<%= content_tag(:th) do%>
|
||||
<td><%= (post.bulletin_category.title rescue nil ) %></td>
|
||||
<% end if(!params[:search_query].blank? or params[:category_id].blank?) %>
|
||||
<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
||||
</td>
|
||||
<td class="date"><%= display_date_time(post.postdate) %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<% else %>
|
||||
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
xml.instruct! :xml, :version => "1.0"
|
||||
xml.rss :version => "2.0" do
|
||||
xml.channel do
|
||||
if @current_category
|
||||
xml.title @current_category.title_translations[I18n.locale.to_s]
|
||||
else
|
||||
xml.title t('announcement.announcement')
|
||||
end
|
||||
xml.link panel_announcement_front_end_bulletins_path(:rss)
|
||||
|
||||
for bulletin in @bulletins
|
||||
xml.item do
|
||||
xml.title bulletin.title_translations[I18n.locale.to_s]
|
||||
xml.pubDate bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_announcement_front_end_bulletin_path(bulletin, :rss)
|
||||
xml.guid panel_announcement_front_end_bulletin_path(bulletin, :rss)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Vendored
+8
-10
@@ -1,12 +1,11 @@
|
||||
<% # encoding: utf-8 %>
|
||||
<h1 class="h1"><%= @bulletin.title[I18n.locale] %></h1>
|
||||
<h1 class="h1"><%= @bulletin.title %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
||||
<% unit = User.find(@bulletin.create_user_id).sub_roles.collect{|t| t.key}.join(" ") rescue nil %>
|
||||
<%= " | " if unit %>
|
||||
<a href="" class="unit"><%= unit %></a>
|
||||
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
|
||||
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_image">
|
||||
@@ -14,7 +13,7 @@
|
||||
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
|
||||
</div>
|
||||
<div class="news_paragraph">
|
||||
<%= @bulletin.text[I18n.locale].html_safe %>
|
||||
<%= @bulletin.text.html_safe rescue '' %>
|
||||
</div>
|
||||
<div class="linkAndFile">
|
||||
<% if @bulletin.bulletin_links.size > 0 %>
|
||||
@@ -22,7 +21,7 @@
|
||||
<i class="icons-link"></i>
|
||||
<div class="showLink">
|
||||
<% @bulletin.bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,12 +31,11 @@
|
||||
<i class="icons-paperclip"></i>
|
||||
<div class="showFile">
|
||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fb">
|
||||
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35&appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
|
||||
</div>
|
||||
|
||||
<%= share_links(@bulletin, 'announcement') %>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
xml.instruct! :xml, :version => "1.0"
|
||||
xml.rss :version => "2.0" do
|
||||
xml.channel do
|
||||
if @current_category
|
||||
xml.title @current_category.title_translations[I18n.locale.to_s]
|
||||
else
|
||||
xml.title t('announcement.announcement')
|
||||
end
|
||||
xml.link panel_announcement_front_end_bulletins_path(:rss)
|
||||
|
||||
xml.item do
|
||||
xml.title @bulletin.title
|
||||
xml.description @bulletin.text
|
||||
xml.pubDate @bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_announcement_front_end_bulletin_path(@bulletin, :rss)
|
||||
xml.guid panel_announcement_front_end_bulletin_path(@bulletin, :rss)
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<% @bulletins.each do |bulletin| %>
|
||||
<li>
|
||||
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id) %>
|
||||
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :tag_id => @selected_tag.id ) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -256,4 +256,4 @@
|
||||
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<% @web_links.each do |web_link| %>
|
||||
<li>
|
||||
<%= link_to web_link.name[I18n.locale], web_link.url %>
|
||||
<%= link_to web_link.title, web_link.url %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
|
||||
<div class="news_block">
|
||||
<h3 class="news_title2"><%= t("announcement.bulletins") %></h3>
|
||||
<h3 class="news_title2"><%= link_to t("announcement.bulletins"), panel_announcement_front_end_bulletins_path, :class => 'more' %></h3>
|
||||
<ul id='bulletins_web_links_bulletins' class="news_list">
|
||||
<%= render 'bulletins' if @bulletins %>
|
||||
</ul>
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
<div class="news_next">next</div>
|
||||
<ul class="news_list">
|
||||
<% tag.bulletins.each do |post| %>
|
||||
<li><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %></li>
|
||||
<li><%= link_to post.title, panel_announcement_front_end_bulletin_path(post) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<%= form_tag panel_announcement_front_end_bulletins_path, method: :get do %>
|
||||
<%= hidden_field_tag :category_id, params[:category_id] %>
|
||||
<%= hidden_field_tag :tag_id, params[:tag_id] %>
|
||||
<p>
|
||||
<%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder=>t("announcement.search") }%>
|
||||
<%= submit_tag "Search", name: nil %>
|
||||
</p>
|
||||
<% end %>
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
<ul class="list">
|
||||
<% @bulletin_categorys.each do |category| %>
|
||||
<li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
|
||||
<%= link_to category.title, panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -12,8 +12,8 @@
|
||||
<div class="tag_cloud">
|
||||
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
|
||||
<div class="cloud">
|
||||
<% @tags.each do |tag| %>
|
||||
<%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id), :class => "hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil}" %>
|
||||
<% @tags_and_class.each do |tag| %>
|
||||
<%= link_to tag[0][I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag[0].id, :category_id => params[:category_id]), :class => "#{tag[1]} #{(tag[0].id.to_s.eql?(params[:tag_id]) || tag[0].key.eql?(params[:tag_id])) ? 'active' : nil} " %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+12
-1
@@ -35,6 +35,9 @@ en:
|
||||
passed: Passed
|
||||
pending: Pending
|
||||
rejected: Rejected
|
||||
rejected_reason: 'Reason:'
|
||||
rejected_reason_empty: "Approval rejected,no referencable information"
|
||||
|
||||
clear: Clear
|
||||
|
||||
hot: Hot
|
||||
@@ -62,6 +65,7 @@ en:
|
||||
categories: Categories
|
||||
error:
|
||||
no_avilb_cate_for_posting: You need a category to submit your post,please contact admin
|
||||
search: Search in announcement
|
||||
sure?: Sure?
|
||||
campus_news: Campus News
|
||||
more: more+
|
||||
@@ -85,7 +89,14 @@ en:
|
||||
cate_auth: Category Authorization
|
||||
submit_approval: Submit approval
|
||||
tag_cloud: Tag cloud
|
||||
|
||||
|
||||
bulletin_category:
|
||||
edit: Edit
|
||||
delete: Delete
|
||||
update_success: Bulletin Category Updated
|
||||
update_failed: Bulletin Category Failed
|
||||
disable_change_to_false: Toggle to archive
|
||||
disable_change_to_true: Put back from archive
|
||||
# admin:
|
||||
# action: Action
|
||||
# add_language: Add language
|
||||
|
||||
@@ -30,6 +30,8 @@ zh_tw:
|
||||
passed: 審核通過
|
||||
pending: 待審查
|
||||
rejected: 不通過
|
||||
rejected_reason_empty: 審核沒有通過,沒有相關訊息
|
||||
rejected_reason: '原因:'
|
||||
clear: 清除
|
||||
|
||||
quick_edit: 快速編輯
|
||||
@@ -42,6 +44,7 @@ zh_tw:
|
||||
no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類
|
||||
tags: 標籤
|
||||
categories: 分類
|
||||
search: 搜尋公告
|
||||
status: 狀態
|
||||
sure?: 確定嗎?
|
||||
campus_news: 校園新聞
|
||||
@@ -49,6 +52,7 @@ zh_tw:
|
||||
bulletins: 公告訊息
|
||||
related_links: 相關連結
|
||||
bulletin:
|
||||
text: 內文
|
||||
category: 分類
|
||||
submit_user_list: 張貼人
|
||||
list_lower: 列表
|
||||
@@ -78,6 +82,10 @@ zh_tw:
|
||||
fact_check: 公告審核
|
||||
delete: 刪除
|
||||
edit: 編輯
|
||||
update_bulletin_success: 成功更新公告
|
||||
create_bulletin_success: 成功新增公告
|
||||
approve_bulletin_success: 成功審核公告
|
||||
approve_bulletin_fail: 審核公告失敗
|
||||
# action: 行動
|
||||
# add_language: 新增語言
|
||||
# admin: 管理
|
||||
@@ -177,6 +185,8 @@ zh_tw:
|
||||
bulletin_category:
|
||||
edit: 修改
|
||||
delete: 刪除
|
||||
update_success: 分類更新成功
|
||||
update_failed: 分類更新失敗
|
||||
|
||||
# Chinese (Taiwan) translations for Ruby on Rails
|
||||
# by tsechingho (http://github.com/tsechingho)
|
||||
|
||||
+3
-1
@@ -15,7 +15,7 @@ Rails.application.routes.draw do
|
||||
get 'load_quick_edit'
|
||||
end
|
||||
collection do
|
||||
post 'delete'
|
||||
get 'delete'
|
||||
end
|
||||
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
||||
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||
@@ -34,6 +34,7 @@ Rails.application.routes.draw do
|
||||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
match "index_by_unit" => "bulletins#index_bulletins_by_unit",:as => :index_bulletins_by_unit
|
||||
resources :bulletins # do
|
||||
# match "preview" => "bulletins#preview_content",:as => :get_preview_content
|
||||
# end
|
||||
@@ -44,6 +45,7 @@ Rails.application.routes.draw do
|
||||
match "reload_bulletins" => "bulletins#reload_bulletins"
|
||||
match "reload_web_links" => "bulletins#reload_web_links"
|
||||
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
|
||||
match "bulletins_search_block" => "bulletins#bulletins_search_block"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Vendored
+13
-4
@@ -4,17 +4,26 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
|
||||
def preview_and_approve
|
||||
@news_bulletin = NewsBulletin.find params[:news_category][:id]
|
||||
@news_bulletin = NewsBulletin.find params[:news_bulletin_id]
|
||||
end
|
||||
|
||||
def approve
|
||||
|
||||
notice = ""
|
||||
@news_bulletin = NewsBulletin.find params[:news_bulletin_id]
|
||||
@news_bulletin.proc_check(params[:news_bulletin][:is_checked],params[:news_bulletin][:not_checked_reason])
|
||||
@news_bulletin.de_pending
|
||||
if @news_bulletin.save
|
||||
notice = t('news_bulletin.approve_bulletin_success')
|
||||
else
|
||||
notice = t('news_bulletin.approve_bulletin_fail')
|
||||
end
|
||||
redirect_to(panel_news_back_end_news_bulletins_url,:notice => notice)
|
||||
end
|
||||
|
||||
def setting
|
||||
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
@options_from_collection_for_select_news_bulletin_categorys = @news_bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
|
||||
@options_from_collection_for_select_news_bulletin_categorys = @news_bulletin_categorys.collect{|bc| [bc.title,bc.id] }
|
||||
if params.has_key? :news_category
|
||||
@news_bulletin_categorys = NewsBulletinCategory.find params[:news_category][:id]
|
||||
else
|
||||
@@ -54,7 +63,7 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
def get_categorys(id = nil)
|
||||
@news_bulletin_categorys = []
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.all)
|
||||
elsif is_sub_manager?
|
||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
end
|
||||
|
||||
+18
-7
@@ -1,10 +1,12 @@
|
||||
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
|
||||
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
|
||||
|
||||
def index
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
@news_bulletin_categorys = get_categories_for_index("NewsBulletinCategory")
|
||||
#TODO 需要做 manager ,admin 才可以 all. 其他 available就好
|
||||
|
||||
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
|
||||
|
||||
@url = panel_news_back_end_news_bulletin_categorys_path
|
||||
@@ -109,12 +111,21 @@ class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendContro
|
||||
# DELETE /news_bulletins/1.xml
|
||||
def destroy
|
||||
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
|
||||
@news_bulletin_category.destroy
|
||||
@news_bulletin_category.disable = @news_bulletin_category.disable ? false : true
|
||||
|
||||
if @news_bulletin_category.save!
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
respond_to do |format|
|
||||
flash[:notice] = t("bulletin_category.update_success")
|
||||
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||
format.html { redirect_to(panel_announcement_back_end_news_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("bulletin_category.update_failed")
|
||||
format.html { render :action => "index" }
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
Vendored
+76
-29
@@ -1,15 +1,20 @@
|
||||
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
before_filter :authenticate_user!
|
||||
|
||||
# before_filter :for_admin_only,:only => [:]
|
||||
# before_filter :for_app_manager,:only => [:index,:show,]
|
||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins]
|
||||
before_filter :only => [ :new,:edit,:update,:create] do |controller|
|
||||
controller.get_categorys('NewsBulletinCategory')
|
||||
controller.get_unit_list
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
# @news_bulletins = NewsBulletin.all
|
||||
# @news_bulletins = NewsBulletin.desc("postdate desc")
|
||||
get_categorys(params[:news_bulletin_category_id])
|
||||
get_categorys("NewsBulletinCategory",params[:news_bulletin_category_id])
|
||||
get_tags
|
||||
|
||||
@filter = params[:filter]
|
||||
@@ -36,8 +41,12 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
|
||||
# @news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_news_bulletins : NewsBulletin.all.page(params[:page]).per(10)
|
||||
@news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("news_bulletin") : get_viewable("news_bulletin")
|
||||
@news_bulletin_categories = NewsBulletinCategory.all
|
||||
|
||||
@news_bulletin_categories = get_categories_for_index("NewsBulletinCategory")
|
||||
@news_bulletin_category_ids = @news_bulletin_categories.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
|
||||
@news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("news_bulletin",:news_bulletin_category_id.in => @news_bulletin_category_ids) : get_viewable("news_bulletin",:news_bulletin_category_id.in => @news_bulletin_category_ids)
|
||||
|
||||
@news_bulletin_link = NewsBulletinLink.new
|
||||
@link_url = panel_news_back_end_news_bulletins_path
|
||||
@@ -76,21 +85,18 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
# GET /news_bulletins/new
|
||||
# GET /news_bulletins/new.xml
|
||||
def new
|
||||
|
||||
@news_bulletin = NewsBulletin.new
|
||||
|
||||
@link_url = panel_news_back_end_news_bulletins_path
|
||||
|
||||
# @news_bulletin.news_bulletin_files.build
|
||||
# @news_bulletin.news_bulletin_files.new
|
||||
if get_categorys.empty?
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
else
|
||||
|
||||
get_tags
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @news_bulletin }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,7 +110,6 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin)
|
||||
|
||||
get_categorys
|
||||
get_tags
|
||||
end
|
||||
end
|
||||
@@ -112,7 +117,8 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
# POST /news_bulletins
|
||||
# POST /news_bulletins.xml
|
||||
def create
|
||||
|
||||
get_tags
|
||||
|
||||
if params[:news_bulletin_link]
|
||||
|
||||
@news_bulletin_link = NewsBulletinLink.new(params[:news_bulletin_link])
|
||||
@@ -129,6 +135,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
respond_to do |format|
|
||||
if @news_bulletin_file.save
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
format.js { render 'create_news_bulletin_file' }
|
||||
end
|
||||
end
|
||||
@@ -136,15 +143,19 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
else
|
||||
|
||||
@news_bulletin = NewsBulletin.new(params[:news_bulletin])
|
||||
@news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil)
|
||||
@news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil)
|
||||
|
||||
@news_bulletin.create_user_id = current_user.id
|
||||
@news_bulletin.update_user_id = current_user.id
|
||||
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin.de_pending
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @news_bulletin.save
|
||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news.create_news_bulletin_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.create_news_bulletin_success')) }
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.create_news_bulletin_success')) }
|
||||
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
|
||||
format.js
|
||||
else
|
||||
@@ -215,7 +226,6 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
# PUT /news_bulletins/1
|
||||
# PUT /news_bulletins/1.xml
|
||||
def update
|
||||
|
||||
if params[:news_bulletin_link]
|
||||
|
||||
@news_bulletin_link = NewsBulletinLink.find(params[:id])
|
||||
@@ -224,6 +234,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
respond_to do |format|
|
||||
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
||||
format.js { render 'update_news_bulletin_link' }
|
||||
end
|
||||
@@ -237,6 +248,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
respond_to do |format|
|
||||
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
||||
format.js { render 'update_news_bulletin_file' }
|
||||
end
|
||||
@@ -245,7 +257,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
else
|
||||
|
||||
@news_bulletin = NewsBulletin.find(params[:id])
|
||||
@news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil)
|
||||
@news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil)
|
||||
|
||||
@news_bulletin.update_user_id = current_user.id
|
||||
|
||||
@@ -255,16 +267,22 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
# @news_bulletin.image_del = nil
|
||||
# params[:news_bulletin][:image_del] = nil
|
||||
# end
|
||||
|
||||
delete_out_invalid_date_from_params
|
||||
respond_to do |format|
|
||||
if @news_bulletin.update_attributes(params[:news_bulletin])
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin.is_checked = true
|
||||
@news_bulletin.is_rejected = false
|
||||
@news_bulletin.de_pending!
|
||||
end
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.update_news_bulletin_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.news_bulletin.update_success')) }
|
||||
format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
get_tags
|
||||
get_categorys
|
||||
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @news_bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
@@ -282,6 +300,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
@news_bulletin.destroy
|
||||
|
||||
respond_to do |format|
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
@@ -303,27 +322,55 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
@news_bulletin = NewsBulletin.find(params[:id])
|
||||
@type = params[:type]
|
||||
@news_bulletin_categories = NewsBulletinCategory.all
|
||||
#TODO 需要做 manager ,admin 才可以 all. 其他 available就好
|
||||
|
||||
get_tags
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:to_delete]
|
||||
news_bulletins = NewsBulletin.any_in(:_id => params[:to_delete]).delete_all
|
||||
if params[:ids]
|
||||
news_bulletins = NewsBulletin.any_in(:_id => params[:ids]).delete_all
|
||||
end
|
||||
redirect_to panel_news_back_end_news_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def delete_out_invalid_date_from_params
|
||||
if((params[:news_bulletin]["deadline(1i)"] && params[:news_bulletin]["deadline(1i)"].blank?) or (params[:news_bulletin]["deadline(2i)"] && params[:news_bulletin]["deadline(2i)"].blank?) or (params[:news_bulletin]["deadline(3i)"] && params[:news_bulletin]["deadline(3i)"].blank?))
|
||||
params[:news_bulletin].delete("deadline(1i)")
|
||||
params[:news_bulletin].delete("deadline(2i)")
|
||||
params[:news_bulletin].delete("deadline(3i)")
|
||||
@news_bulletin.deadline = nil
|
||||
end rescue nil
|
||||
end
|
||||
|
||||
def get_categorys(id = nil)
|
||||
@news_bulletin_categorys = []
|
||||
@unit_list_for_anc = UnitListForAnc.all
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit')
|
||||
end
|
||||
# def get_categories_for_index(id = nil)
|
||||
# @news_bulletin_categories = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @news_bulletin_categories = (id ? NewsBulletinCategory.admin_manager_all.find(id).to_a : NewsBulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @news_bulletin_categories = NewsBulletinCategory.all
|
||||
# end
|
||||
# @news_bulletin_categories
|
||||
# end
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @news_bulletin_categorys = []
|
||||
# @unit_list_for_anc = UnitListForAnc.all
|
||||
# if(is_manager? || is_admin?)
|
||||
# @news_bulletin_categorys = (id ? NewsBulletinCategory.admin_manager_all.find(id).to_a : NewsBulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @news_bulletin_categorys = NewsBulletinCategory.all.authed_for_user(current_user,'submit')
|
||||
# end
|
||||
# if @news_bulletin_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("news.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
def get_unit_list
|
||||
@unit_list_for_anc = UnitListForAnc.all
|
||||
end
|
||||
|
||||
def get_tags
|
||||
|
||||
Vendored
+51
-18
@@ -8,30 +8,63 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||
# GET /news_bulletins
|
||||
# GET /news_bulletins.xml
|
||||
|
||||
def index
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10)
|
||||
elsif !params[:tag_id].blank?
|
||||
tmp = NewsTag.find(params[:tag_id]) rescue nil
|
||||
tmp = NewsTag.where(key: params[:tag_id])[0] unless tmp
|
||||
@news_bulletins = tmp.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) rescue nil
|
||||
else
|
||||
@news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10)
|
||||
end
|
||||
def index_news_bulletins_by_unit
|
||||
@page = Page.find(params[:page_id]) rescue nil
|
||||
@news_bulletins=NewsBulletin.all.available_for_lang(I18n.locale).can_display.where("unit_list_for_anc_id"=>params[:name]).page( params[:page_main]).per(15).page( params[:page_main]).per(10)
|
||||
render :index
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
def index
|
||||
@page = Page.find(params[:page_id]) rescue nil
|
||||
if !params[:search_query].blank?
|
||||
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
|
||||
# search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||
|
||||
@search = NewsBulletin.solr_search do
|
||||
fulltext params[:search_query]
|
||||
with(:frontend_search,true)
|
||||
#order_by(:average_rating)
|
||||
end
|
||||
search_result = @search.results.collect{|result| result.id}
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||
else
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
|
||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:category_id].blank?
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
|
||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
|
||||
else
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
|
||||
end
|
||||
impressionist(@tag) if @tag
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
if params[:preview] == "true"
|
||||
preview_content
|
||||
else
|
||||
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
|
||||
impressionist(@news_bulletin)
|
||||
get_categorys
|
||||
''
|
||||
@news_bulletin = NewsBulletin.all.can_display.where(_id: params[:id]).first
|
||||
if !@news_bulletin.disable? and !@news_bulletin.is_rejected
|
||||
if @news_bulletin.enabled_for_lang(I18n.locale.to_s)
|
||||
impressionist(@news_bulletin)
|
||||
get_categorys
|
||||
else
|
||||
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => 403
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +76,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@news_bulletin_categorys = NewsBulletinCategory.excludes('disabled' => true)
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
+17
-12
@@ -1,4 +1,5 @@
|
||||
class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||
# caches_page :home_banner
|
||||
|
||||
def initialize
|
||||
super
|
||||
@@ -12,14 +13,14 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5)
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5)
|
||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@news_bulletins = @tag.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) rescue nil
|
||||
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) rescue nil
|
||||
else
|
||||
@news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5)
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -27,32 +28,36 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||
def news_bulletins_and_web_links
|
||||
@tags = NewsTag.all
|
||||
@selected_tag = NewsTag.find(params[:id]) rescue @tags[0]
|
||||
@news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||
@news_bulletins = @selected_tag.get_visible_news_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def reload_news_bulletins
|
||||
@selected_tag = NewsTag.find(params[:tag_id])
|
||||
@news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||
@news_bulletins = @selected_tag.get_visible_news_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def reload_web_links
|
||||
@selected_tag = NewsTag.find(params[:tag_id])
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def news_bulletins_side_bar
|
||||
@tags = NewsTag.all
|
||||
@tags_and_class = NewsTag.sorted_for_cloud
|
||||
get_categorys
|
||||
end
|
||||
|
||||
def news_bulletins_search_block
|
||||
|
||||
end
|
||||
|
||||
def home_banner
|
||||
if !params[:category_id].blank?
|
||||
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||
elsif !params[:tag_id].blank?
|
||||
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil
|
||||
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.available_for_lang(I18n.locale).can_display.widget_datas.limit(9) rescue nil
|
||||
else
|
||||
@news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.widget_datas.limit(9)
|
||||
end
|
||||
get_categorys
|
||||
|
||||
@@ -62,7 +67,7 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@news_bulletin_categorys = NewsBulletinCategory.excludes('disabled' => true)
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
end
|
||||
|
||||
end
|
||||
+27
-3
@@ -1,9 +1,33 @@
|
||||
module Panel::News::BackEnd::NewsBulletinsHelper
|
||||
|
||||
def news_show_reject_reason(news_bulletin)
|
||||
by_news_bulletin = news_bulletin.is_rejected
|
||||
by_user = (((news_bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?)
|
||||
by_news_bulletin && by_user
|
||||
end
|
||||
def news_show_form_status_field(news_bulletin)
|
||||
#by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?)
|
||||
by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
|
||||
by_user
|
||||
end
|
||||
|
||||
def news_show_approval_link(news_bulletin)
|
||||
by_news_bulletin = (!news_bulletin.is_expired? and !news_bulletin.is_checked?)
|
||||
by_user = (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? or is_admin?)
|
||||
by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?)
|
||||
by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
|
||||
by_news_bulletin and by_user
|
||||
end
|
||||
|
||||
def news_show_delete_link(news_bulletin)
|
||||
by_news_bulletin = (news_bulletin.create_user_id == current_user.id)
|
||||
by_user = (is_manager? or is_admin?)
|
||||
by_news_bulletin or by_user
|
||||
end
|
||||
|
||||
def show_news_bulletin_title_at_index (news_bulletin)
|
||||
if news_bulletin.is_checked?
|
||||
link_to news_bulletin.title, panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''
|
||||
else
|
||||
news_bulletin.title
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
+133
-57
@@ -4,13 +4,24 @@ class NewsBulletin
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
include Sunspot::Mongo
|
||||
include Impressionist::Impressionable
|
||||
|
||||
BelongsToCategory = :news_bulletin_category
|
||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
||||
# include Tire::Model::Search
|
||||
# include Tire::Model::Callbacks
|
||||
# include Redis::Objects
|
||||
|
||||
|
||||
|
||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :title, localize: true
|
||||
field :subtitle, localize: true
|
||||
field :text, localize: true
|
||||
has_and_belongs_to_many :tags, :class_name => "NewsTag"
|
||||
|
||||
field :postdate , :type => DateTime
|
||||
@@ -32,11 +43,11 @@ class NewsBulletin
|
||||
|
||||
field :public, :type => Boolean, :default => true
|
||||
|
||||
scope :can_display,where(is_checked: true)
|
||||
|
||||
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false)
|
||||
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :news_bulletin_category
|
||||
belongs_to :unit_list_for_anc
|
||||
|
||||
# embeds_many :news_bulletin_links, :cascade_callbacks => true
|
||||
@@ -48,28 +59,87 @@ class NewsBulletin
|
||||
accepts_nested_attributes_for :news_bulletin_files, :allow_destroy => true
|
||||
accepts_nested_attributes_for :news_bulletin_links, :allow_destroy => true
|
||||
|
||||
validates_presence_of :title
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
before_save :set_key, :update_status
|
||||
before_save :check_deadline
|
||||
before_save :update_avliable_language, :clean_tags
|
||||
|
||||
after_save :save_news_bulletin_links
|
||||
after_save :save_news_bulletin_files
|
||||
|
||||
|
||||
def self.search( search = nil, category_id = nil )
|
||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
||||
key = /#{search}/
|
||||
find(:all, :conditions => {title: key, news_bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
||||
elsif category_id.to_s.size > 0 and search.to_s.size < 1
|
||||
find(:all, :conditions => {news_bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
||||
elsif search.to_s.size > 0 and category_id.to_s.size < 1
|
||||
key = /#{search}/
|
||||
find(:all, :conditions => {title: key}).desc( :is_top, :postdate )
|
||||
else
|
||||
find(:all).desc( :is_top, :postdate)
|
||||
end
|
||||
# Tire.index 'news_bulletin' do
|
||||
# delete
|
||||
# create :mappings =>{
|
||||
# :news_bulletin_by_title => {
|
||||
# :properties=> {
|
||||
# :title => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
|
||||
# :body => {}
|
||||
# }
|
||||
# }
|
||||
# :news_bulletin_by_body => {
|
||||
# :properties=> {
|
||||
# :body => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# end
|
||||
# mapping do
|
||||
# indexes :title, :analyzer => 'cjk', :boost => 10
|
||||
# indexes :sub_titles, :analyzer => 'cjk', :boost => 5
|
||||
# indexes :text, :analyzer => 'cjk'
|
||||
# end
|
||||
def type
|
||||
"news_bulletin"
|
||||
end
|
||||
|
||||
searchable do
|
||||
text :titles do
|
||||
title_translations.to_a.collect{|t| t[1]}
|
||||
end
|
||||
text :texts do
|
||||
text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text}
|
||||
end
|
||||
integer :view_count
|
||||
|
||||
boolean :frontend_search do
|
||||
( !is_hidden && !is_pending && is_checked && !is_rejected )
|
||||
end
|
||||
|
||||
|
||||
string :news_bulletin_category_id
|
||||
end
|
||||
# redis_search_index(:title_field => :s_title,
|
||||
# :alias_field => :s_title_en,
|
||||
# :score_field => :view_count,
|
||||
# :condition_fields => [:is_checked,:is_hidden,:news_bulletin_category_id,:is_pending],
|
||||
# :ext_fields =>[])
|
||||
|
||||
# def gen_title_for_search
|
||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
||||
# end
|
||||
|
||||
# def s_title
|
||||
# self.
|
||||
# end
|
||||
|
||||
# def s_title_was
|
||||
# self.title_was["zh_tw"]
|
||||
# end
|
||||
|
||||
# def s_title_en
|
||||
# self.title_translations["en"]
|
||||
# end
|
||||
|
||||
# def s_title_en_was
|
||||
# self.title_was["en"]
|
||||
# end
|
||||
|
||||
# def s_text_en
|
||||
# Nokogiri::HTML(self.text.en).text
|
||||
# end
|
||||
# def s_text_zh_tw
|
||||
# Nokogiri::HTML(self.text.zh_tw).text
|
||||
# end
|
||||
|
||||
def self.widget_datas( category_id = nil )
|
||||
|
||||
@@ -87,6 +157,29 @@ class NewsBulletin
|
||||
|
||||
end
|
||||
|
||||
def proc_check(check,not_pass_info = "")
|
||||
self.is_checked = true
|
||||
if check =="true"
|
||||
self.is_rejected = false
|
||||
elsif check == "false"
|
||||
self.is_rejected = true
|
||||
self.not_checked_reason = not_pass_info
|
||||
end
|
||||
end
|
||||
|
||||
def enabled_for_lang(lang)
|
||||
eval("self.available_for_#{lang}")
|
||||
end
|
||||
|
||||
def de_pending
|
||||
self.is_pending = false
|
||||
end
|
||||
|
||||
def de_pending!
|
||||
de_pending
|
||||
self.save!
|
||||
end
|
||||
|
||||
def is_expired?
|
||||
Date.today > self.deadline ? true : false rescue false
|
||||
#some dates might sat as nil so rescue false
|
||||
@@ -105,7 +198,7 @@ class NewsBulletin
|
||||
end
|
||||
|
||||
def is_checked?
|
||||
self.is_checked
|
||||
!self.is_pending && self.is_checked && (self.is_rejected == false)
|
||||
end
|
||||
|
||||
def is_pending?
|
||||
@@ -113,10 +206,11 @@ class NewsBulletin
|
||||
end
|
||||
|
||||
def is_rejected?
|
||||
self.is_rejected
|
||||
!self.is_pending && self.is_rejected && (self.is_rejected == true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def save_news_bulletin_links
|
||||
self.news_bulletin_links.each do |t|
|
||||
if t.should_destroy
|
||||
@@ -132,19 +226,6 @@ class NewsBulletin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def title
|
||||
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def subtitle
|
||||
@subtitle ||= I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def text
|
||||
@text ||= I18nVariable.first(:conditions => {:key => 'text', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def self.filter(news_bulletins)
|
||||
news_bulletins.each do |news_bulletin|
|
||||
@@ -159,29 +240,24 @@ class NewsBulletin
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
if title && title.new_record?
|
||||
title.key = 'title'
|
||||
end
|
||||
if subtitle && subtitle.new_record?
|
||||
subtitle.key = 'subtitle'
|
||||
end
|
||||
if text && text.new_record?
|
||||
text.key = 'text'
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
self["available_for_#{locale}".to_sym] = false
|
||||
else
|
||||
self["available_for_#{locale}".to_sym] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_status
|
||||
if !self.is_pending && !self.is_checked
|
||||
self.is_pending = false
|
||||
self.is_rejected = true
|
||||
self.is_checked = false
|
||||
elsif self.is_checked
|
||||
self.is_pending = false
|
||||
self.is_rejected = false
|
||||
self.is_checked = true
|
||||
def check_deadline
|
||||
if(!self.deadline.nil? and (self.deadline < self.postdate ))
|
||||
self.deadline = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def clean_tags
|
||||
self.tag_ids.delete('')
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4,7 +4,8 @@ class NewsBulletinCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
include OrbitCoreLib::ObjectDisable
|
||||
|
||||
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||
AfterObjectAuthUrl = '/panel/news/back_end/news_bulletin_categorys'
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
@@ -15,12 +16,11 @@ class NewsBulletinCategory
|
||||
field :key
|
||||
field :display
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
field :title, localize: true
|
||||
has_many :news_bulletins
|
||||
|
||||
def pp_object
|
||||
i18n_variable[I18n.locale]
|
||||
title
|
||||
end
|
||||
|
||||
def self.from_id(id)
|
||||
|
||||
@@ -5,36 +5,13 @@ class NewsBulletinFile
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
# field :filetitle
|
||||
# field :description
|
||||
has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :title, localize: true
|
||||
field :description, localize: true
|
||||
|
||||
# field :to_save, :type => Boolean
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
belongs_to :news_bulletin
|
||||
# embedded_in :news_bulletin
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def filetitle
|
||||
@filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def description
|
||||
@description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
if filetitle && filetitle.new_record?
|
||||
filetitle.key = 'filetitle'
|
||||
end
|
||||
if description && description.new_record?
|
||||
description.key = 'description'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4,12 +4,20 @@ class NewsBulletinLink
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :url
|
||||
# field :name
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :title, localize: true
|
||||
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
# embedded_in :news_bulletin
|
||||
belongs_to :news_bulletin
|
||||
|
||||
before_validation :add_http
|
||||
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
||||
self.url = 'http://' + self.url
|
||||
end
|
||||
end
|
||||
end
|
||||
+6
-4
@@ -1,11 +1,13 @@
|
||||
class NewsTag < Tag
|
||||
|
||||
has_and_belongs_to_many :news_bulletins
|
||||
|
||||
|
||||
def get_visible_news_bulletins(sort = :name)
|
||||
|
||||
def get_visible_news_bulletins(sort = :title)
|
||||
date_now = Time.now
|
||||
self.news_bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
|
||||
end
|
||||
|
||||
def news_bulletins
|
||||
NewsBulletin.all.any_in(:_id => news_bulletin_ids)
|
||||
end
|
||||
|
||||
end
|
||||
-5
@@ -2,14 +2,9 @@
|
||||
<%= stylesheet_link_tag "inc/permission-checkbox" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<<<<<<< HEAD
|
||||
<%= javascript_include_tag "bootstrap" %>
|
||||
<%#= javascript_include_tag "inc/permission-checkbox" %>
|
||||
<%#= javascript_include_tag "inc/search" %>
|
||||
=======
|
||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
||||
<%= javascript_include_tag "inc/search" %>
|
||||
>>>>>>> 291d5e3a03ba7da62ceb5e3b18012f0c9198dfba
|
||||
<% end %>
|
||||
<%#= label_tag :fact_check_setting, t("news.news_bulletin.fact_check_setting") %>
|
||||
<%= form_tag('', :remote => true) %>
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
<h1><%= news_bulletin_category.key %></h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('news_bulletin.status') %></th>
|
||||
<th><%= t('news_bulletin.category') %></th>
|
||||
<th><%= t('news_bulletin.title') %></th>
|
||||
<th><%= t('news_bulletin.postdate') %></th>
|
||||
<th><%= t('news_bulletin.deadline') %></th>
|
||||
<th><%= t('news_bulletin.action') %></th>
|
||||
</tr>
|
||||
|
||||
<% news_bulletin_category.news_bulletins.each do |post| %>
|
||||
<%= render :partial => 'panel/news/back_end/news_bulletins/news_bulletins', :locals => {:post => post,:approval_allow=>true} %>
|
||||
<% end %>
|
||||
</table>
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<%= form_for news_bulletin, :url => panel_news_back_end_news_bulletin_path(news_bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= form_for news_bulletin, :url => panel_news_back_end_news_bulletin_approve_path(news_bulletin),:method => :post, :html => {:class => 'clear'} do |f| %>
|
||||
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
|
||||
Vendored
-50
@@ -1,50 +0,0 @@
|
||||
<%= render 'panel/news/back_end/news_bulletins/filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'panel/news/back_end/news_bulletins/news_bulletins' %>
|
||||
</table>
|
||||
<div class="form-actions">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<% content_for :secondary do %>
|
||||
<%#= render :partial => '/panel/news/back_end/news_secondary' %>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<fieldset><legend><%= t('news_bulletin.search') %></legend>
|
||||
|
||||
<%= form_for :news_bulletin, :action => 'search', :method => 'get', :url => panel_news_back_end_news_bulletins_path do |f| %>
|
||||
|
||||
<%#= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('news_bulletin.select') }%>
|
||||
|
||||
Category <%#= select_tag "category_id", options_for_select(@news_bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('news_bulletin.select') %>
|
||||
|
||||
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
|
||||
|
||||
<%= submit_tag "Search", :name => nil %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h1><%= t('news_bulletin.list_news') %></h1>
|
||||
|
||||
<div id="check_block">
|
||||
<h1>Check Please</h1>
|
||||
<%#= render :partial => "list_table", :collection => @news_bulletin_categorys_check,:as => :news_bulletin_category%>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
-->
|
||||
Vendored
+2
-2
@@ -10,12 +10,12 @@
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, (@news_bulletin_category.new_record? ? @news_bulletin_category.build_i18n_variable : @news_bulletin_category.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@news_bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
+5
-6
@@ -4,18 +4,17 @@
|
||||
<%= news_bulletin_category.key %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to show_toggle_archive_btn(news_bulletin_category), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %></li>
|
||||
<% end %>
|
||||
<%if is_manager? || is_admin? %>
|
||||
<li><%= show_news_cate_permission_link(news_bulletin_category) %></li>
|
||||
<% end %>
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('bulletin_category.delete'), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= news_bulletin_category.i18n_variable[locale] rescue nil %></td>
|
||||
<td><%= news_bulletin_category.title_translations[locale] rescue nil %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
+2
-2
@@ -7,12 +7,12 @@
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, news_bulletin_category.i18n_variable do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
$("#<%= dom_id @news_bulletin_category %>").remove();
|
||||
$("#<%= dom_id @news_bulletin_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@news_bulletin_category) %> ");
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
<%= f.file_field :file %>
|
||||
|
||||
<%= f.label :file_title %>
|
||||
<%= f.text_field :filetitle %>
|
||||
<%= f.text_field :title %>
|
||||
|
||||
<%= f.label :file_description %>
|
||||
<%= f.text_field :description %>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @news_bulletin_categories.each do |category| -%>
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<%= link_to category.title, panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
||||
+45
-27
@@ -62,6 +62,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if news_show_form_status_field( @news_bulletin)%>
|
||||
<div id="widget-status" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Setting the news state" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
@@ -84,7 +85,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div id="widget-tags" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
|
||||
@@ -95,10 +96,22 @@
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= check_box_tag 'news_bulletin[tag_ids][]', tag.id, @news_bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= tag[I18n.locale] %>
|
||||
<%= hidden_field_tag 'news_bulletin[tag_ids][]', '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% if @news_bulletin.is_rejected %>
|
||||
<div id="widget-rejected" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Rejected Report" class="icon-cog icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Approval Status</h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<%= @news_bulletin.not_checked_reason rescue t("rejected_reason_empty") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if params[:action] != 'new' %>
|
||||
<div id="widget-audit" class="widget-box">
|
||||
<div class="widget-action clear">
|
||||
@@ -118,11 +131,11 @@
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<%= f.label :unit_list_for_anc%>
|
||||
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
<%= f.label :unit_list_for_anc,t('news.news_bulletin.unit_name')%>
|
||||
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {:prompt => t("news.news_bulletin.ut_prompt")}, :class => "input-medium" %>
|
||||
|
||||
<%= f.label :category %>
|
||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
<%= f.label :category,t('news.news_bulletin.category') %>
|
||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
||||
@@ -139,26 +152,26 @@
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@news_bulletin.new_record? ? @news_bulletin.build_title : @news_bulletin.title ) do |f| %>
|
||||
<%= f.label :title, t('news.news_bulletin.title')%>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@news_bulletin.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@news_bulletin.new_record? ? @news_bulletin.build_subtitle : @news_bulletin.subtitle ) do |f| %>
|
||||
<%= f.label :subtitle, t('news.news_bulletin.subtitle') %>
|
||||
<%= f.fields_for :subtitle_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@news_bulletin.subtitle_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@news_bulletin.new_record? ? @news_bulletin.build_text : @news_bulletin.text ) do |f| %>
|
||||
<%= f.label :text, t('news.news_bulletin.text') %>
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@news_bulletin.text_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -237,6 +250,9 @@
|
||||
<div id='add_news_bulletin_file' class="info_input news_bulletin_files_block">
|
||||
<%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %>
|
||||
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
|
||||
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
|
||||
<p><%= t("sys.preview_only_for_img") %></p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -249,10 +265,9 @@
|
||||
<%= render :partial => 'form_news_bulletin_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -275,17 +290,20 @@
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
||||
<script>
|
||||
$('#add_news_bulletin_link a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_news_bulletin_links", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_link', f, :news_bulletin_links) %>").replace(old_id, new_id));
|
||||
});
|
||||
$('#add_news_bulletin_file a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_news_bulletin_files", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_file', f, :news_bulletin_files) %>").replace(old_id, new_id));
|
||||
$(document).ready(function() {
|
||||
$('#add_news_bulletin_link a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_news_bulletin_links", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_link', f, :news_bulletin_links) %>").replace(old_id, new_id));
|
||||
});
|
||||
$('#add_news_bulletin_file a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_news_bulletin_files", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_file', f, :news_bulletin_files) %>").replace(old_id, new_id));
|
||||
});
|
||||
$('.for_preview').popover({ html : true });
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
+6
-5
@@ -4,7 +4,7 @@
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
<%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
<%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_news_bulletin_file.file.url)) ) : '' %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :filetitle, (form_news_bulletin_file.new_record? ? form_news_bulletin_file.build_filetitle : form_news_bulletin_file.filetitle ) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_news_bulletin_file.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -40,11 +40,11 @@
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :description, (form_news_bulletin_file.new_record? ? form_news_bulletin_file.build_description : form_news_bulletin_file.description ) do |f| %>
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_news_bulletin_file.description_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -62,6 +62,7 @@
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= hidden_field_tag :tr, (dom_id form_news_bulletin_file) %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
|
||||
+3
-2
@@ -17,11 +17,11 @@
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :i18n_variable, (form_news_bulletin_link.new_record? ? form_news_bulletin_link.build_i18n_variable : form_news_bulletin_link.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge", :value => (form_news_bulletin_link.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -39,6 +39,7 @@
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= hidden_field_tag :tr, (dom_id form_news_bulletin_link) %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
<tr id="<%= dom_id list_news_bulletin_file %>">
|
||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.filetitle.zh_tw, list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description.zh_tw} ) : list_news_bulletin_file.filetitle.zh_tw %></td>
|
||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.filetitle.en, list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description.en} ) : list_news_bulletin_file.filetitle.en %></td>
|
||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.title_translations['zh_tw'], list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description_translations['zh_tw']} ) : list_news_bulletin_file.title_translations['zh_tw'] %></td>
|
||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.title_translations['en'], list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description_translations['en']} ) : list_news_bulletin_file.title_translations['en'] %></td>
|
||||
<td>
|
||||
<a href="<%= panel_news_back_end_news_bulletin_file_quick_edit_path(list_news_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<tr id="<%= dom_id list_news_bulletin_link %>">
|
||||
<td><%= link_to list_news_bulletin_link.i18n_variable.zh_tw, list_news_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_news_bulletin_link.i18n_variable.en, list_news_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_news_bulletin_link.title_translations['zh_tw'], list_news_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_news_bulletin_link.title_translations['en'], list_news_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td>
|
||||
<a href="<%= panel_news_back_end_news_bulletin_link_quick_edit_path(list_news_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
|
||||
Vendored
+11
-11
@@ -28,10 +28,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td>
|
||||
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%>
|
||||
|
||||
<!-- <td><%= news_bulletin.news_bulletin_category.title rescue nil %></td> -->
|
||||
<td> <%= show_news_bulletin_title_at_index news_bulletin%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
@@ -44,20 +42,21 @@
|
||||
<li><%= link_to t(:basic), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'basic'), :remote => true %></li>
|
||||
<li><%= link_to t(:picture), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'picture'), :remote => true %></li>
|
||||
<li><%= link_to t(:tags), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'tags'), :remote => true %></li>
|
||||
<li><%= link_to t(:link), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'links'), :remote => true %></li>
|
||||
<li><%= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li>
|
||||
<li><%#= link_to t(:link), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'links'), :remote => true %></li>
|
||||
<li><%#= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if news_show_delete_link(news_bulletin) %>
|
||||
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
<% if news_show_approval_link(news_bulletin) %>
|
||||
<li><%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
|
||||
<% if news_show_reject_reason(news_bulletin)%>
|
||||
<li><%= link_to t('rejected_reason')+truncate(news_bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(news_bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
@@ -72,6 +71,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= User.from_id(news_bulletin.update_user_id).name rescue ''%></td>
|
||||
<td><%= news_bulletin.view_count rescue nil %></td>
|
||||
<td><%= news_bulletin.unit_list_for_anc.title rescue nil %> </td>
|
||||
</tr>
|
||||
<tr id="<%= dom_id news_bulletin, :edit %>" class="qe-block hide" />
|
||||
+4
-4
@@ -13,23 +13,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.fields_for :filetitle, (@news_bulletin_file.new_record? ? @news_bulletin_file.build_filetitle : @news_bulletin_file.filetitle ) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<label for="file-<%= locale %>" class="control-label">Name <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@news_bulletin_file.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= f.fields_for :description, (@news_bulletin_file.new_record? ? @news_bulletin_file.build_description : @news_bulletin_file.description ) do |f| %>
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<label for="file-<%= locale %>" class="control-label">Description <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@news_bulletin_file.description_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
+2
-2
@@ -14,13 +14,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.fields_for :i18n_variable, (@news_bulletin_link.new_record? ? @news_bulletin_link.build_i18n_variable : @news_bulletin_link.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%#= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale %>
|
||||
<%= f.text_field locale, :value => (@news_bulletin_link.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Vendored
+1
-1
@@ -2,11 +2,11 @@
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span7"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb
Vendored
+18
-15
@@ -3,18 +3,18 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categories.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %>
|
||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categories.collect {|t| [ t.title, t.id ]}, {}, :class => 'input-large' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :title, news_bulletin.title do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -25,27 +25,30 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:start) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :postdate, {}, :class => 'input-small' %>
|
||||
<%= f.date_select :postdate, { :use_month_numbers => true, :order => [:day, :month, :year] }, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:end) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :deadline, {}, :class => 'input-small' %>
|
||||
<%= f.date_select :deadline, { :use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="widget-status">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:status) %></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline"><%= f.check_box :is_hot %><%= t(:hot) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_top %><%= t(:top) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_hidden %><%= t(:hidden) %></label>
|
||||
<% if news_show_form_status_field(@news_bulletin)%>
|
||||
<div id="widget-status">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:status) %></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline"><%= f.check_box :is_hot %><%= t(:hot) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_top %><%= t(:top) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_hidden %><%= t(:hidden) %></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="widget-role">
|
||||
<% end -%>
|
||||
|
||||
<!-- <div id="widget-role">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Role</label>
|
||||
<div class="controls">
|
||||
@@ -58,5 +61,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<!--<label class="control-label">Picture</label>-->
|
||||
<div class="control-group">
|
||||
<div class="controls upload-picture">
|
||||
<img class="pull-left upload-picture" src="" />
|
||||
<%= image_tag(@news_bulletin.image.url , :class => "pull-left") if @news_bulletin.image? %>
|
||||
</div>
|
||||
<div class="controls file-upload input-prepend">
|
||||
<label class="control-label add-on btn" for="input-upload">
|
||||
|
||||
Vendored
+1
@@ -6,6 +6,7 @@
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag 'news_bulletin[tag_ids][]', tag.id, news_bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= tag[I18n.locale] %>
|
||||
<%= hidden_field_tag 'news_bulletin[tag_ids][]', '' %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Vendored
+4
-3
@@ -1,7 +1,8 @@
|
||||
<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'],
|
||||
['category', 'news_bulletin_category', 'span1-2', 'news_bulletin.category'],
|
||||
<%= render_sort_bar(true, delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
||||
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'],
|
||||
['title', 'title','span7', 'news_bulletin.title'],
|
||||
['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'],
|
||||
['end_date', 'deadline', 'span1-2', 'news_bulletin.end_date'],
|
||||
['tags', 'tags', 'span1-2', 'news_bulletin.tags'],
|
||||
['last_modified', 'update_user_id','span1-3', 'news_bulletin.last_modified']).html_safe %>
|
||||
['view_count', 'view_count','span1-2', 'view_count'],
|
||||
['unit_list_for_anc', 'unit_list_for_anc','span1-3', 'news.news_bulletin.unit_name']).html_safe %>
|
||||
+3
@@ -8,3 +8,6 @@
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "news_bulletin_form" %>
|
||||
<% end %>
|
||||
+7
-9
@@ -1,12 +1,10 @@
|
||||
<%= form_for :news_bulletins, :url => delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'news_bulletins' %>
|
||||
</table>
|
||||
<% end %>
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'news_bulletins' %>
|
||||
</table>
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="news_bulletin_pagination" class="paginationFixed">
|
||||
<%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
|
||||
</div>
|
||||
@@ -14,13 +12,13 @@
|
||||
|
||||
<div id="news_bulletin_link_qe">
|
||||
<div id="modal-link" class="modal fade">
|
||||
<%= render :partial => "news_bulletin_link_qe" %>
|
||||
<%#= render :partial => "news_bulletin_link_qe" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="news_bulletin_file_qe">
|
||||
<div id="modal-file" class="modal fade">
|
||||
<%= render :partial => "news_bulletin_file_qe" %>
|
||||
<%#= render :partial => "news_bulletin_file_qe" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<b><%= t('news.category') %></b>
|
||||
<%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] rescue nil %>
|
||||
<%= @news_bulletin.news_bulletin_category.title rescue nil %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.postdate') %></b>
|
||||
@@ -9,7 +9,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.title') %></b>
|
||||
<%= @news_bulletin.title[I18n.locale] %>
|
||||
<%= @news_bulletin.title %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= image_tag(@news_bulletin.image.url, :size => "320x240") if @news_bulletin.image.file %>
|
||||
@@ -17,23 +17,23 @@
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.subtitle') %></b>
|
||||
<%= @news_bulletin.subtitle[I18n.locale].html_safe %>
|
||||
<%= @news_bulletin.subtitle.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.text') %></b>
|
||||
<%= @news_bulletin.text[I18n.locale].html_safe %>
|
||||
<%= @news_bulletin.text.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<b><%= t('news.link') %></b>
|
||||
<% @news_bulletin.news_bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.file') %></b>
|
||||
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
+13
-8
@@ -2,12 +2,17 @@
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<% if @current_category %>
|
||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] %></h1>
|
||||
<% else %>
|
||||
<h1 class="h1"><%= t('news.news') %></h1>
|
||||
<h1 class="h1"><%= @page.title rescue nil %></h1>
|
||||
|
||||
<% if !params[:name].blank?%>
|
||||
<%= t("search.unit_get",:unit_name => UnitListForAnc.find(params[:name]).title,:item_num=>@news_bulletins.count) %>
|
||||
<% end %>
|
||||
|
||||
<% if @news_bulletins.blank? and !params[:search_query].blank? %>
|
||||
<%=render :partial => 'shared/search_not_found' %>
|
||||
<% elsif !params[:search_query].blank? %>
|
||||
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@news_bulletins.count) %>
|
||||
<% end %>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -17,12 +22,12 @@
|
||||
</tr>
|
||||
<% @news_bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td><%= image_tag post.image rescue nil %></td>
|
||||
<td class="img"><%= image_tag post.image.url %></td>
|
||||
<td>
|
||||
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
||||
<%= post.subtitle[I18n.locale].html_safe %>
|
||||
<%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
||||
<%= post.subtitle.html_safe rescue '' %>
|
||||
</td>
|
||||
<td><%= display_date(post.postdate) %></td>
|
||||
<td class="date"><%= display_date(post.postdate) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
xml.instruct! :xml, :version => "1.0"
|
||||
xml.rss :version => "2.0" do
|
||||
xml.channel do
|
||||
if @current_category
|
||||
xml.title @current_category.title_translations[I18n.locale.to_s]
|
||||
else
|
||||
xml.title t('news.campus_news')
|
||||
end
|
||||
xml.link panel_news_front_end_news_bulletins_path(:rss)
|
||||
|
||||
for news_bulletin in @news_bulletins
|
||||
xml.item do
|
||||
xml.title news_bulletin.title_translations[I18n.locale.to_s]
|
||||
xml.description news_bulletin.subtitle_translations[I18n.locale.to_s]
|
||||
xml.pubDate news_bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_news_front_end_news_bulletin_path(news_bulletin, :rss)
|
||||
xml.guid panel_news_front_end_news_bulletin_path(news_bulletin, :rss)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
+7
-9
@@ -1,12 +1,12 @@
|
||||
<% # encoding: utf-8 %>
|
||||
<h1 class="h1"><%= @news_bulletin.title[I18n.locale] %></h1>
|
||||
<h1 class="h1"><%= @news_bulletin.title %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span class="pull-right"><%= dislpay_view_count(@news_bulletin) %></span>
|
||||
<span class="date"><%= display_date(@news_bulletin.postdate) %></span>
|
||||
<% unit = @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue nil %>
|
||||
<% unit = @news_bulletin.unit_list_for_anc.title rescue nil %>
|
||||
<%= " | " if unit %>
|
||||
<a href="" class="unit"><%= unit %></a>
|
||||
<%= link_to unit, panel_news_front_end_index_news_bulletins_by_unit_path(:name=>@news_bulletin.unit_list_for_anc_id) unless unit.blank?%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_image">
|
||||
@@ -14,7 +14,7 @@
|
||||
<%= link_to image_tag(@news_bulletin.image.url, :size => "320x240"), @news_bulletin.image.url, {:target => '_blank', :title => @news_bulletin.image_identifier} if @news_bulletin.image.file %>
|
||||
</div>
|
||||
<div class="news_paragraph">
|
||||
<%= @news_bulletin.text[I18n.locale].html_safe %>
|
||||
<%= @news_bulletin.text.html_safe rescue '' %>
|
||||
</div>
|
||||
<div class="linkAndFile">
|
||||
<% if @news_bulletin.news_bulletin_links.size > 0 %>
|
||||
@@ -22,7 +22,7 @@
|
||||
<i class="icons-link"></i>
|
||||
<div class="showLink">
|
||||
<% @news_bulletin.news_bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,13 +32,11 @@
|
||||
<i class="icons-paperclip"></i>
|
||||
<div class="showFile">
|
||||
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="fb">
|
||||
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35&appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
|
||||
</div>
|
||||
<%= share_links(@news_bulletin, 'news') %>
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
xml.instruct! :xml, :version => "1.0"
|
||||
xml.rss :version => "2.0" do
|
||||
xml.channel do
|
||||
if @current_category
|
||||
xml.title @current_category.title_translations[I18n.locale.to_s]
|
||||
else
|
||||
xml.title t('news.campus_news')
|
||||
end
|
||||
xml.link panel_news_front_end_news_bulletins_path(:rss)
|
||||
|
||||
# for news_bulletin in @news_bulletins
|
||||
xml.item do
|
||||
xml.title @news_bulletin.title
|
||||
xml.description @news_bulletin.text
|
||||
xml.pubDate @news_bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_news_front_end_news_bulletin_path(@news_bulletin, :rss)
|
||||
xml.guid panel_news_front_end_news_bulletin_path(@news_bulletin, :rss)
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
<tr>
|
||||
<td><%= image_tag post.image %></td>
|
||||
<td>
|
||||
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
||||
<%= post.subtitle[I18n.locale].html_safe %>
|
||||
<%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
||||
<%= post.subtitle.html_safe rescue '' %>
|
||||
</td>
|
||||
<td><%= display_date(post.postdate) %></td>
|
||||
</tr>
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
<% @news_bulletins.each do |news_bulletin| %>
|
||||
<li>
|
||||
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category_id) %>
|
||||
<%= link_to news_bulletin.title, panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category_id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
<% @web_links.each do |web_link| %>
|
||||
<li>
|
||||
<%= link_to web_link.name[I18n.locale], web_link.url %>
|
||||
<%= link_to web_link.title, web_link.url %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
||||
Vendored
+5
-5
@@ -1,5 +1,5 @@
|
||||
<% if @news_bulletins and !@news_bulletins.nil? %>
|
||||
<h2 class="topic_title"><%= t('news.campus_news')%></h2>
|
||||
<h2 class="topic_title"><%= link_to t('news.campus_news'), panel_news_front_end_news_bulletins_path %></h2>
|
||||
<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
|
||||
<div class="btn-group topic_note">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
@@ -9,7 +9,7 @@
|
||||
<ul class="dropdown-menu">
|
||||
<% @news_bulletin_categorys.each do |category| %>
|
||||
<li>
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
|
||||
<%= link_to category.title, panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -19,9 +19,9 @@
|
||||
<ul id="topic_list">
|
||||
<% @news_bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
|
||||
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3>
|
||||
<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p>
|
||||
<div class="news_img"><%= link_to image_tag(post.image.url, :size => "290x130"), panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></div>
|
||||
<h3 class="h3 news_title"><%= link_to post.title, panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3>
|
||||
<p class="news_wrap"><%= post.subtitle.html_safe rescue '' %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
Loaded 100 of 432 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user