Merge branch 'master' into ldap
Conflicts: Gemfile Gemfile.lock app/views/admin/attributes/_app_selector.html.erb app/views/admin/module_apps/_app_selector.html.erb app/views/admin/pages/_app_selector.html.erb vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb
This commit is contained in:
commit
198825a309
256 files changed
+4631
-4327
No files matched your search
+1
-2
@@ -1,5 +1,4 @@
|
||||
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
|
||||
layout 'new_admin'
|
||||
|
||||
def index
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
@@ -93,7 +92,7 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
|
||||
respond_to do |format|
|
||||
if @bulletin_category.update_attributes(params[:bulletin_category])
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
else
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
class Panel::Announcement::BackEnd::BulletinFilesController < ApplicationController
|
||||
|
||||
layout 'new_admin'
|
||||
|
||||
def index
|
||||
@bulletin_files = BulletinFile.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
# format.xml { render :xml => @bulletins }
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# POST /bulletins
|
||||
# POST /bulletins.xml
|
||||
def create
|
||||
@bulletin_file = BulletinFile.new(params[:bulletin_file])
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_file.save
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render action: "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /bulletins/1
|
||||
# PUT /bulletins/1.xml
|
||||
def update
|
||||
@bulletin_file = BulletinFile.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_file.update_attributes(params[:bulletin_file])
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController
|
||||
|
||||
layout 'new_admin'
|
||||
|
||||
def index
|
||||
@bulletin_links = BulletinLink.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
# format.xml { render :xml => @bulletins }
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController
|
||||
|
||||
layout 'new_admin'
|
||||
|
||||
def index
|
||||
@bulletin_links = BulletinLink.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
# format.xml { render :xml => @bulletins }
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# POST /bulletins
|
||||
# POST /bulletins.xml
|
||||
def create
|
||||
@bulletin_link = BulletinLink.new(params[:bulletin_link])
|
||||
# @bulletin_link.bulletin_id = params[:bulletin_link][:bulletin_id]
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_link.save
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render action: "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /bulletins/1
|
||||
# PUT /bulletins/1.xml
|
||||
def update
|
||||
@bulletin_link = BulletinLink.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_link.update_attributes(params[:bulletin_link])
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
+212
-62
@@ -1,5 +1,4 @@
|
||||
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
layout 'new_admin'
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
@@ -9,17 +8,40 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# @bulletins = Bulletin.desc("postdate desc")
|
||||
get_categorys(params[:bulletin_category_id])
|
||||
get_tags
|
||||
|
||||
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
|
||||
if @filter && params[:clear]
|
||||
@filter.delete(params[:type])
|
||||
elsif @filter && new_filter
|
||||
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||
elsif @filter.has_key?(new_filter[:type])
|
||||
@filter[new_filter[:type]] << new_filter[:id].to_s
|
||||
else
|
||||
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||
end
|
||||
elsif new_filter
|
||||
@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]])
|
||||
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
|
||||
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
|
||||
@bulletin_categories = BulletinCategory.all
|
||||
|
||||
@bulletin_link = BulletinLink.new
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
|
||||
@bulletin_file = BulletinFile.new
|
||||
@file_url = panel_announcement_back_end_bulletins_path
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js
|
||||
format.js { }
|
||||
format.xml { render :xml => @bulletins }
|
||||
end
|
||||
end
|
||||
@@ -78,30 +100,58 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# POST /bulletins
|
||||
# POST /bulletins.xml
|
||||
def create
|
||||
@bulletin = Bulletin.new(params[:bulletin])
|
||||
|
||||
@bulletin.create_user_id = current_user.id
|
||||
@bulletin.update_user_id = current_user.id
|
||||
if params[:bulletin_link]
|
||||
|
||||
@bulletin_link = BulletinLink.new(params[:bulletin_link])
|
||||
|
||||
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.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
if @bulletin_link.save
|
||||
format.js { render 'create_bulletin_link' }
|
||||
end
|
||||
end
|
||||
|
||||
elsif params[:bulletin_file]
|
||||
|
||||
@bulletin_file = BulletinFile.new(params[:bulletin_file])
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_file.save
|
||||
format.js { render 'create_bulletin_file' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@bulletin = Bulletin.new(params[:bulletin])
|
||||
|
||||
@bulletin.create_user_id = current_user.id
|
||||
@bulletin.update_user_id = current_user.id
|
||||
|
||||
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.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def link_quick_add
|
||||
# debugger
|
||||
|
||||
@bulletin = Bulletin.find(params[:bulletin_id])
|
||||
|
||||
|
||||
@bulletin_link = BulletinLink.new
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
|
||||
@bulletin_link.bulletin_id = params[:bulletin_id]
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
@@ -110,10 +160,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
def link_quick_edit
|
||||
# debugger
|
||||
@bulletin_link = BulletinLink.find(params[:bulletin_id])
|
||||
|
||||
@bulletin = Bulletin.find(params[:bulletin_id])
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
||||
# @bulletin = Bulletin.find(params[:bulletin_id])
|
||||
|
||||
# @link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
@@ -121,31 +174,88 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
end
|
||||
|
||||
def file_quick_add
|
||||
# debugger
|
||||
|
||||
@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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
# PUT /bulletins/1
|
||||
# PUT /bulletins/1.xml
|
||||
def update
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
|
||||
@bulletin.update_user_id = current_user.id
|
||||
|
||||
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'
|
||||
# if params[:bulletin][:image_del] == '1'
|
||||
# @bulletin.remove_image!
|
||||
# @bulletin.image_del = nil
|
||||
# params[:bulletin][:image_del] = nil
|
||||
# end
|
||||
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.update_attributes(params[:bulletin]) && @bulletin.save
|
||||
# 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
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
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' }
|
||||
end
|
||||
end
|
||||
|
||||
elsif params[:bulletin_file]
|
||||
|
||||
@bulletin_file = BulletinFile.find(params[:id])
|
||||
|
||||
@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' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
|
||||
@bulletin.update_user_id = current_user.id
|
||||
|
||||
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'
|
||||
# if params[:bulletin][:image_del] == '1'
|
||||
# @bulletin.remove_image!
|
||||
# @bulletin.image_del = nil
|
||||
# params[:bulletin][:image_del] = nil
|
||||
# end
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save
|
||||
# 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
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# DELETE /bulletins/1
|
||||
@@ -172,6 +282,21 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
# end
|
||||
|
||||
|
||||
def load_quick_edit
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
@type = params[:type]
|
||||
@bulletin_categories = BulletinCategory.all
|
||||
get_tags
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:to_delete]
|
||||
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
|
||||
end
|
||||
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort])
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
@@ -184,21 +309,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
end
|
||||
end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||
end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||
end
|
||||
|
||||
def get_sorted_bulletins
|
||||
def get_sorted_and_filtered_bulletins
|
||||
bulletins = Bulletin.all
|
||||
case params[:sort]
|
||||
when 'postdate', 'deadline'
|
||||
bulletins.order_by([params[:sort], params[:direction]])
|
||||
bulletins = bulletins.order_by([params[:sort], params[:direction]])
|
||||
when 'category'
|
||||
category_ids = bulletins.distinct(:bulletin_category_id)
|
||||
categories = BulletinCategory.find(category_ids) rescue nil
|
||||
@@ -207,36 +327,66 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
|
||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
|
||||
sorted_categorys.flatten
|
||||
else
|
||||
nil
|
||||
bulletins = sorted_categorys.flatten!
|
||||
end
|
||||
when 'title'
|
||||
h = Hash.new
|
||||
bulletins.each { |bulletin| h[bulletin.title[I18n.locale]] = bulletin }
|
||||
h = Array.new
|
||||
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
|
||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||
sorted.collect {|a| a[1] }
|
||||
bulletins = sorted.collect {|a| a[1] }
|
||||
when 'status'
|
||||
bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction])
|
||||
bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction])
|
||||
when 'update_user_id'
|
||||
user_ids = bulletins.distinct(:update_user_id)
|
||||
users = User.find(user_ids) rescue nil
|
||||
if users
|
||||
h = Hash.new
|
||||
users.each { |user| h[user.name] = user.id }
|
||||
h = Array.new
|
||||
users.each { |user| h << [user.name, user.id] }
|
||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
|
||||
sorted_users.flatten
|
||||
else
|
||||
nil
|
||||
bulletins = sorted_users.flatten
|
||||
end
|
||||
when 'tags'
|
||||
a = Array.new
|
||||
AnnouncementTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.bulletins }
|
||||
a.flatten!
|
||||
a.uniq
|
||||
a.uniq!
|
||||
tmp = Array.new
|
||||
bulletins.where(:tag_ids => []).each { |bulletin| tmp << [bulletin.title[I18n.locale].downcase, bulletin] }
|
||||
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
||||
sorted_titles = sorted.collect {|a| a[1] }
|
||||
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
|
||||
bulletins = a.flatten
|
||||
end
|
||||
if @filter
|
||||
@filter.each do |key, value|
|
||||
case key
|
||||
when 'status'
|
||||
a = Array.new
|
||||
bulletins.each do |bulletin|
|
||||
value.each do |v|
|
||||
a << bulletin if bulletin[v]
|
||||
end
|
||||
end
|
||||
bulletins = a
|
||||
when 'categories'
|
||||
a = Array.new
|
||||
bulletins.each do |bulletin|
|
||||
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
|
||||
end
|
||||
bulletins = a
|
||||
when 'tags'
|
||||
a = Array.new
|
||||
bulletins.each do |bulletin|
|
||||
bulletin.tags.each do |tag|
|
||||
a << bulletin if value.include?(tag.id.to_s)
|
||||
end
|
||||
end
|
||||
bulletins = a
|
||||
end if value.size > 0
|
||||
end
|
||||
end
|
||||
Kaminari.paginate_array(bulletins).page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
+1
-2
@@ -2,7 +2,6 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendControll
|
||||
before_filter :authenticate_user!
|
||||
include AdminHelper
|
||||
# layout 'admin'
|
||||
layout 'new_admin'
|
||||
|
||||
def setting
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
@@ -18,7 +17,7 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendControll
|
||||
else
|
||||
first_category = @bulletin_categorys.first
|
||||
end
|
||||
preload_object_auth = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
|
||||
preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check')
|
||||
@users_array = preload_object_auth.first.privilege_users rescue []
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = NewBlog::MOUDLEAPP_TITLE
|
||||
@app_title = 'announcement'
|
||||
end
|
||||
|
||||
# GET /bulletins
|
||||
@@ -12,9 +12,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
|
||||
date_now = Time.now
|
||||
if params[:category_id]
|
||||
@bulletins = Bulletin.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(10)
|
||||
@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(10)
|
||||
else
|
||||
@bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
@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(10)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
@@ -23,7 +23,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def show
|
||||
@bulletin = Bulletin.find(params[:id])
|
||||
@bulletin = Bulletin.can_display.where.where(_id: params[:id])
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = NewBlog::MOUDLEAPP_TITLE
|
||||
@app_title = 'announcement'
|
||||
end
|
||||
|
||||
# GET /bulletins
|
||||
@@ -14,9 +14,9 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
# @bulletin_categorys = BulletinCategory.first;
|
||||
# @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
|
||||
if params[:category_id]
|
||||
@bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||
else
|
||||
@bulletins = Bulletin.widget_datas.limit(9)
|
||||
@bulletins = Bulletin.can_display.widget_datas.limit(9)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
@@ -26,14 +26,14 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
def bulletins_and_web_links
|
||||
@tags = AnnouncementTag.all
|
||||
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
|
||||
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
|
||||
@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
|
||||
render :layout => 'module_widget'
|
||||
end
|
||||
|
||||
def reload_bulletins
|
||||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
|
||||
@bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def reload_web_links
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class Bulletin
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
# field :category_id, :type => Integer
|
||||
field :title
|
||||
# has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
# has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
# has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :subtitle
|
||||
field :text
|
||||
field :postdate , :type => Date
|
||||
field :deadline , :type => Date
|
||||
# field :url
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
|
||||
field :is_top, :type => Boolean, :default => false
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :bulletin_category
|
||||
|
||||
embeds_many :bulletin_links, :cascade_callbacks => true
|
||||
embeds_many :bulletin_files, :cascade_callbacks => true
|
||||
|
||||
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
||||
|
||||
# validates_presence_of :title_variable
|
||||
validates_presence_of :title
|
||||
|
||||
after_save :save_bulletin_links
|
||||
after_save :save_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, 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 => {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
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.widget_datas
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
|
||||
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
|
||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).limit(5)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def save_bulletin_links
|
||||
self.bulletin_links.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def save_bulletin_files
|
||||
self.bulletin_files.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,101 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class Bulletin
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
# field :category_id, :type => Integer
|
||||
field :title
|
||||
# has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
# has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
# has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :subtitle
|
||||
field :text
|
||||
field :postdate , :type => Date
|
||||
field :deadline , :type => Date
|
||||
# field :url
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
|
||||
field :is_top, :type => Boolean, :default => false
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :bulletin_category
|
||||
|
||||
embeds_many :bulletin_links, :cascade_callbacks => true
|
||||
embeds_many :bulletin_files, :cascade_callbacks => true
|
||||
|
||||
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
||||
|
||||
# validates_presence_of :title_variable
|
||||
validates_presence_of :title
|
||||
|
||||
after_save :save_bulletin_links
|
||||
after_save :save_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, 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 => {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
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.widget_datas
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
|
||||
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
|
||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).limit(5)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def save_bulletin_links
|
||||
self.bulletin_links.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def save_bulletin_files
|
||||
self.bulletin_files.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
+37
-22
@@ -19,12 +19,14 @@ class Bulletin
|
||||
field :is_top, :type => Boolean, :default => false
|
||||
field :is_hot, :type => Boolean, :default => false
|
||||
field :is_hidden, :type => Boolean, :default => false
|
||||
field :is_checked, :type => Boolean, :default => false
|
||||
field :is_checked, :type => Boolean, :default => nil
|
||||
|
||||
field :not_checked_reason
|
||||
|
||||
field :public, :type => Boolean, :default => true
|
||||
|
||||
scope :can_display,where(is_checked: true)
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :bulletin_category
|
||||
@@ -47,28 +49,17 @@ class Bulletin
|
||||
|
||||
|
||||
def self.search( search = nil, category_id = nil )
|
||||
|
||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
||||
|
||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
||||
key = /#{search}/
|
||||
|
||||
find(:all, :conditions => {title: key, 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 => {bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
||||
|
||||
elsif search.to_s.size > 0 and category_id.to_s.size < 1
|
||||
|
||||
find(:all, :conditions => {title: key, 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 => {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
|
||||
|
||||
find(:all, :conditions => {title: key}).desc( :is_top, :postdate )
|
||||
else
|
||||
find(:all).desc( :is_top, :postdate)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -87,7 +78,22 @@ class Bulletin
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def status
|
||||
case self.is_checked
|
||||
when nil
|
||||
I18n.t('announcement.bulletin.fact_check_pending')
|
||||
when true
|
||||
I18n.t('announcement.bulletin.fact_check_pass')
|
||||
when false
|
||||
I18n.t('announcement.bulletin.fact_check_not_pass')
|
||||
end
|
||||
end
|
||||
|
||||
def is_expired?
|
||||
Date.today > self.deadline ? true : false rescue false
|
||||
#some dates might sat as nil so rescue false
|
||||
end
|
||||
|
||||
def is_top?
|
||||
self.is_top
|
||||
@@ -101,6 +107,15 @@ class Bulletin
|
||||
self.is_hidden
|
||||
end
|
||||
|
||||
def is_checked?
|
||||
self.is_checked
|
||||
end
|
||||
|
||||
def is_check_rejected?
|
||||
self.is_checked == false
|
||||
end
|
||||
|
||||
|
||||
def save_bulletin_links
|
||||
self.bulletin_links.each do |t|
|
||||
if t.should_destroy
|
||||
|
||||
@@ -16,6 +16,15 @@ class BulletinFile
|
||||
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
|
||||
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<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.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_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>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+5
-5
@@ -23,14 +23,14 @@
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.label :display %>
|
||||
<%= f.radio_button :display, "List" %>List
|
||||
<%= f.radio_button :display, "Picture" %>Picture
|
||||
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
|
||||
<%#= f.label :display %>
|
||||
<%#= f.radio_button :display, "List" List%>
|
||||
<%#= f.radio_button :display, "Picture" Picture%>
|
||||
<%# <br />顯示方式是設定在前台頁面時,資訊所呈現的樣式 %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
<!-- <tr class="qe-block hide"> -->
|
||||
<tr class="qe-block hide">
|
||||
<td colspan="8">
|
||||
<legend><%= t(:quick_edit) %></legend>
|
||||
<%= form_for bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(bulletin_category), :html => {:class => 'form-horizontal'} do |f| %>
|
||||
<%= render :partial => "quick_edit_qe", :locals => { :f => f, :bulletin_category => bulletin_category } %>
|
||||
<div class="form-actions">
|
||||
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
|
||||
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
$.each($(".quick_edit"),function(obj){ $(this).remove(); });
|
||||
$("#<%= dom_id @bulletin_category %>").append("<div class='quick_edit'><%= j render "form" %></div>");
|
||||
//$("#form > form").replaceWith("<%= j render "form" %>");
|
||||
+26
-20
@@ -1,5 +1,5 @@
|
||||
<tr id="<%= dom_id bulletin %>" class="with_action">
|
||||
<td><input type="checkbox"></td>
|
||||
<td><%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %></td>
|
||||
<td>
|
||||
<% if bulletin.is_top? %>
|
||||
<span class="label label-success"><%= t(:top) %></span>
|
||||
@@ -10,40 +10,46 @@
|
||||
<% if bulletin.is_hidden? %>
|
||||
<span class="label"><%= t(:hidden) %></span>
|
||||
<% end %>
|
||||
<%= bulletin.status %>
|
||||
</td>
|
||||
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td>
|
||||
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% unless bulletin.is_check_rejected?%>
|
||||
<li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
|
||||
<ul class="dropdown-menu" id="menu1">
|
||||
<li><a href="#" class='toggle-tr-edit' rel='basic'><%= t(:basic) %></a></li>
|
||||
<li><a href="#" class='toggle-tr-edit' rel='picture'><%= t(:picture) %></a></li>
|
||||
<li><a href="#" class='toggle-tr-edit' rel='tags'><%= t(:tags) %></a></li>
|
||||
<li><a href="#" class='toggle-tr-edit' rel='link'><%= t(:link) %></a></li>
|
||||
<li><a href="#" class='toggle-tr-edit' rel='file'><%= t(:file) %></a></li>
|
||||
<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(: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>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
<% if (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !bulletin.is_expired? %>
|
||||
<li><%= link_to t('bulletin.fact_check'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
<% 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>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%></td>
|
||||
<td><%= bulletin.postdate %></td>
|
||||
<td><%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %></td>
|
||||
<td>
|
||||
<% bulletin.sorted_tags.each do |tag| %>
|
||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
||||
<% end %>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
<% bulletin.sorted_tags.each do |tag| %>
|
||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= User.from_id(bulletin.update_user_id).name rescue ''%></td>
|
||||
</tr>
|
||||
|
||||
<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<% end %>
|
||||
<tr id="<%= dom_id bulletin, :edit %>" class="qe-block hide" />
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
|
||||
<tr id="<%= "bulletin_#{bulletin_file.id}" if !bulletin_file.new_record? %>" class='list_item'>
|
||||
<td>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if bulletin_file.new_record? %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= form_for(@bulletin_file, :remote => true, :url => @file_url) do |f| %>
|
||||
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= (@bulletin_file.new_record? ? 'Add File' : 'Edit File') %></h3>
|
||||
</div>
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.fields_for :filetitle, (@bulletin_file.new_record? ? @bulletin_file.build_filetitle : @bulletin_file.filetitle ) 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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= f.fields_for :description, (@bulletin_file.new_record? ? @bulletin_file.build_description : @bulletin_file.description ) 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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<%= hidden_field_tag 'bulletin_file[bulletin_id]', @bulletin_file.bulletin_id %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
|
||||
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
|
||||
<div class="field">
|
||||
|
||||
<%= f.label :link_url %>
|
||||
<%= f.text_field :url %>
|
||||
|
||||
<%= f.label :link_name %>
|
||||
<%#= f.text_field :name %>
|
||||
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||
<%= f.text_field locale, :style => "width:130px" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<span class="action">
|
||||
<% if bulletin_link.new_record? %>
|
||||
<a href="#" class="delete"><%= t(:delete) %></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
|
||||
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
|
||||
<div class="field">
|
||||
|
||||
<%= f.label :link_url %>
|
||||
<%= f.text_field :url %>
|
||||
|
||||
<%= f.label :link_name %>
|
||||
<%#= f.text_field :name %>
|
||||
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||
<%= f.text_field locale, :style => "width:130px" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<span class="action">
|
||||
<% if bulletin_link.new_record? %>
|
||||
<a href="#" class="delete"><%= t(:delete) %></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
|
||||
<tr id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
|
||||
|
||||
<td>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.text_field :url %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if bulletin_link.new_record? %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
|
||||
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
|
||||
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
|
||||
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
|
||||
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
|
||||
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
|
||||
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
|
||||
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
|
||||
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
|
||||
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
|
||||
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
|
||||
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
|
||||
<td>
|
||||
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(bulletin_link2) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
+30
-34
@@ -1,41 +1,37 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= form_for(@bulletin.bulletin_links, :remote => true, :url => @link_url) do |f| %>
|
||||
|
||||
<div id="modal-link" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3>Add Link / Edit Link</h3>
|
||||
</div>
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="control-group">
|
||||
<label for="http" class="control-label">URL</label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :url %>
|
||||
<span class="help-inline">Please correct the error</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group error">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<input type="text" value="" id="link-<%= locale %>" class="input-xlarge">
|
||||
<span class="help-inline">Please correct the error</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary" href="#">Submit/確定</a>
|
||||
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
|
||||
</div>
|
||||
<%= form_for(@bulletin_link, :remote => true, :url => @link_url) do |f| %>
|
||||
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= (@bulletin_link.new_record? ? 'Add Link' : 'Edit Link') %></h3>
|
||||
</div>
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="control-group">
|
||||
<label for="http" class="control-label">URL</label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :url %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<%= f.fields_for :i18n_variable, (@bulletin_link.new_record? ? @bulletin_link.build_i18n_variable : @bulletin_link.i18n_variable) 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 %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="modal-footer">
|
||||
<%= hidden_field_tag 'bulletin_link[bulletin_id]', @bulletin_link.bulletin_id %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
+11
-35
@@ -1,39 +1,15 @@
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th class="span1 strong">
|
||||
<input type="checkbox">
|
||||
<a href class="list-remove"><i class="icon-trash"></i></a>
|
||||
</th>
|
||||
<th class="sort span1 <%= is_sort_active?('status') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('status')) %>">
|
||||
<%= t('bulletin.status') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('status')) %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('category') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('category')) %>">
|
||||
<%= t('bulletin.category') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('category')) %>
|
||||
</th>
|
||||
<th class="sort span7 <%= is_sort_active?('title') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('title')) %>">
|
||||
<%= t('bulletin.title') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('title')) %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('postdate') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('postdate')) %>">
|
||||
<%= t('bulletin.start_date') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('postdate')) %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('deadline') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('deadline')) %>">
|
||||
<%= t('bulletin.end_date') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('deadline')) %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('tags') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('tags')) %>">
|
||||
<%= t('bulletin.tags') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('tags')) %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('update_user_id') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('update_user_id')) %>">
|
||||
<%= t('bulletin.last_modified') %>
|
||||
<%= content_tag(:b, nil, :class => is_sort?('update_user_id')) %>
|
||||
</th>
|
||||
</tr>
|
||||
<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-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sort-holder">
|
||||
<tbody id="tbody_bulletins" class="sort-holder">
|
||||
<%= render :partial => 'bulletin', :collection => @bulletins %>
|
||||
</tbody>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<div class="filter-clear">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-brush-large') + t(:clear), panel_announcement_back_end_bulletins_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn js_history" %>
|
||||
</div>
|
||||
+7
-31
@@ -1,4 +1,4 @@
|
||||
<div class="subnav">
|
||||
<div id='filter' class="subnav">
|
||||
<ul class="nav nav-pills filter">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
@@ -18,40 +18,16 @@
|
||||
</ul>
|
||||
<div class="filters">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Category1</a>
|
||||
<a href="#" class="btn">Category2</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
<%= render 'filter_status' %>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-category">
|
||||
<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 => add_filter(:categories, category.id)), :class => 'btn' %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
<%= render 'filter_categories' %>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-tags">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Tag1</a>
|
||||
<a href="#" class="btn">Tag2</a>
|
||||
<a href="#" class="btn">Tag3</a>
|
||||
<a href="#" class="btn">Tag4</a>
|
||||
<a href="#" class="btn">Tag5</a>
|
||||
<a href="#" class="btn">Tag6</a>
|
||||
<a href="#" class="btn">Tag7</a>
|
||||
<a href="#" class="btn">Tag8</a>
|
||||
<a href="#" class="btn">Tag9</a>
|
||||
<a href="#" class="btn">Tag10</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
<%= render 'filter_tags' %>
|
||||
</div>
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+6
@@ -0,0 +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]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<%= link_to t(:is_top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_top')}" %>
|
||||
<%= link_to t(:is_hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hot')}" %>
|
||||
<%= link_to t(:is_hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hidden')}" %>
|
||||
<%= link_to t(:is_checked), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_checked')}" %>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @tags.each do |tag| -%>
|
||||
<%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>
|
||||
Vendored
+103
-94
@@ -1,30 +1,9 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= f.error_messages %>
|
||||
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
<div class="field">
|
||||
<%= label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
|
||||
<%= f.radio_button :is_checked, true%>
|
||||
<%= label :is_checked_true, t('announcement.bulletin.fact_check_pass') %>
|
||||
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true} : {}) %>
|
||||
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass') %>
|
||||
|
||||
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
|
||||
<%= f.text_field :not_checked_reason %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :image, t('announcement.image') %><br />
|
||||
<%= f.file_field :image %>
|
||||
<% if @bulletin.image.file %>
|
||||
<%= check_box_tag 'bulletin[image_del]' %>
|
||||
<%= t('announcement.刪除已上傳檔案') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--Widget start-->
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div id="sub-wiget">
|
||||
|
||||
<div id="widget-picture" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
@@ -80,9 +59,18 @@
|
||||
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Status</h3>
|
||||
<div class="widget-content clear">
|
||||
<div class="controls">
|
||||
<%= f.check_box :is_top %><%= t('top') %>
|
||||
<%= f.check_box :is_hot %><%= t('hot') %>
|
||||
<%= f.check_box :is_hidden %><%= t('hide') %>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= f.check_box :is_top %>
|
||||
<%= t('top') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= f.check_box :is_hot %>
|
||||
<%= t('hot') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= f.check_box :is_hidden %>
|
||||
<%= t('hide') %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,12 +82,45 @@
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<% @tags.each do |tag| %>
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= tag[I18n.locale] %>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= tag[I18n.locale] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if params[:action] != 'new' %>
|
||||
<div id="widget-audit" class="widget-box">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
|
||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
|
||||
<div class="controls">
|
||||
<%= f.label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
<%= t('announcement.bulletin.fact_check_pass') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true, :class => 'privacy'} : {})%>
|
||||
<%= t('announcement.bulletin.fact_check_not_pass') %>
|
||||
<% end -%>
|
||||
<div class="select-role">
|
||||
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
|
||||
<%= f.text_field :not_checked_reason %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif current_user.admin? %>
|
||||
<%= f.hidden_field :is_checked,:value => true%>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -111,60 +132,49 @@
|
||||
|
||||
<%= f.label :category %>
|
||||
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
|
||||
English
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">English</a></li>
|
||||
<li><a href="#">Chinese</a></li>
|
||||
<li><a href="#">Japanese</a></li>
|
||||
<li><a href="#">French</a></li>
|
||||
<li><a href="#">German</a></li>
|
||||
<!--<li class="divider"></li>
|
||||
<li><a href="#">Separated link</a></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<div class="title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<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' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="main-wiget">
|
||||
<div id="widget-link" class="widget-box">
|
||||
<div class="widget-action clear">
|
||||
@@ -172,14 +182,14 @@
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<div id='bulletin_links' class="bulletin_links_block">
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<th>Name - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||
<% end %>
|
||||
<th>Name</th>
|
||||
<th class="span1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -194,32 +204,31 @@
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
|
||||
<div id='bulletin_links' class="bulletin_links_block">
|
||||
|
||||
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
|
||||
<%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %>
|
||||
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
|
||||
<%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
|
||||
<%= render :partial => 'form_bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="main-wiget">
|
||||
<div id="widget-file" class="widget-box">
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Added to the file" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-paperclip icons-white"></i>File</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<div id='bulletin_files' class="bulletin_files_block">
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -240,30 +249,30 @@
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
|
||||
<div id='bulletin_files' class="bulletin_files_block">
|
||||
|
||||
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
|
||||
<%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %>
|
||||
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
|
||||
<%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
|
||||
<%= render :partial => 'form_bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--Post End-->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -277,13 +286,13 @@
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_bulletin_links", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id));
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id));
|
||||
});
|
||||
$('#add_bulletin_file a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_bulletin_files", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
|
||||
<tr id="<%= "bulletin_file_#{form_bulletin_file.id}" if !form_bulletin_file.new_record? %>" class='list_item'>
|
||||
<td>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<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| %>
|
||||
<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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<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| %>
|
||||
<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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if form_bulletin_file.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
|
||||
<tr id="<%= "bulletin_link_#{form_bulletin_link.id}" if !form_bulletin_link.new_record? %>" class='list_item'>
|
||||
|
||||
<td>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.text_field :url %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<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| %>
|
||||
<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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if form_bulletin_link.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
<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>
|
||||
<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">
|
||||
<%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
|
||||
<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>
|
||||
<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">
|
||||
<%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
+10
-17
@@ -1,17 +1,10 @@
|
||||
<!-- <tr class="qe-block hide"> -->
|
||||
<tr class="qe-block hide">
|
||||
<td colspan="8">
|
||||
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span>Basic / Picture / Tags / Link / File</legend>
|
||||
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %>
|
||||
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<div class="form-actions">
|
||||
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
|
||||
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<td colspan="8">
|
||||
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span><%= t(type) %></legend>
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'form-horizontal'} do |f| %>
|
||||
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_#{@type}", :locals => { :f => f, :bulletin => @bulletin } %>
|
||||
<div class="form-actions">
|
||||
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
|
||||
<%= f.submit t(:cancel), :class => 'btn quick_edit_cancel', :type => 'reset', :rel => dom_id(@bulletin, :edit) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<div id="qe-basic" class="qe-edit-div hide">
|
||||
<div id="qe-basic" class="qe-edit-div">
|
||||
<div id="widget-category">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:category) %></label>
|
||||
|
||||
+6
-42
@@ -1,4 +1,4 @@
|
||||
<div id="qe-file" class="qe-edit-div hide">
|
||||
<div id="qe-file" class="qe-edit-div">
|
||||
<div id="widget-file">
|
||||
<div class="control-group">
|
||||
<table class="table table-condensed">
|
||||
@@ -11,52 +11,16 @@
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td style="text-align:center" colspan="3">
|
||||
<a class="btn btn-primary btn-small" href="#modal-file" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
|
||||
<td style="text-align:center" colspan="3">
|
||||
<a class="btn btn-primary btn-small" href="<%= panel_announcement_back_end_bulletin_file_quick_add_path(bulletin) %>#modal-file" data-toggle="modal" data-remote="true"><i class="icon-plus icon-white"></i> <%= t('add')%></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>…</td>
|
||||
<td>…</td>
|
||||
<td><a href="#modal-file" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<%= render :partial => 'list_bulletin_file', :collection => bulletin.bulletin_files %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="modal-file" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3>Add File / Edit File</h3>
|
||||
</div>
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="controls file-upload">
|
||||
<label class="control-label btn" for="input-upload">
|
||||
Browse
|
||||
<input id="input-upload" class="upload" type="file" name="upload" onchange="document.getElementById('fn').innerHTML = this.value;">
|
||||
</label>
|
||||
<span id='fn' class="file-name"></span>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label for="file-zh-tw" class="control-label">Chinese</label>
|
||||
<div class="controls">
|
||||
<input type="text" value="" id="file-zh-tw" class="input-xlarge">
|
||||
<span class="help-inline">Please correct the error</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label for="file-en" class="control-label">English</label>
|
||||
<div class="controls">
|
||||
<input type="text" value="" id="file-en" class="input-xlarge">
|
||||
<span class="help-inline">Please correct the error</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary" href="#">Submit/確定</a>
|
||||
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
+7
-40
@@ -1,7 +1,7 @@
|
||||
<div id="qe-link" class="qe-edit-div hide">
|
||||
<div id="qe-link" class="qe-edit-div">
|
||||
<div id="widget-link">
|
||||
<div class="control-group">
|
||||
<table class="table table-condensed">
|
||||
<table id="bulletin_links" class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Chinese</th>
|
||||
@@ -11,50 +11,17 @@
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td style="text-align:center" colspan="3">
|
||||
<a class="btn btn-primary btn-small" href="#modal-link" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
|
||||
<td style="text-align:center" colspan="3">
|
||||
<a class="btn btn-primary btn-small" href="<%= panel_announcement_back_end_bulletin_link_quick_add_path(bulletin) %>#modal-link" data-toggle="modal" data-remote="true"><i class="icon-plus icon-white"></i> <%= t('add')%></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<% bulletin.bulletin_links.each_with_index do |bulletin_link2, i| %>
|
||||
<%= f.fields_for :bulletin_links, bulletin_link2 do |f| %>
|
||||
<%= render :partial => 'bulletin_link2', :object => bulletin_link2, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render :partial => 'list_bulletin_link', :collection => bulletin.bulletin_links %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="modal-link" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3>Add Link / Edit Link</h3>
|
||||
</div>
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="control-group">
|
||||
<label for="http" class="control-label">URL</label>
|
||||
<div class="controls">
|
||||
<input type="text" value="" id="http" class="input-xlarge">
|
||||
<span class="help-inline">Please correct the error</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group error">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<input type="text" value="" id="link-<%= locale %>" class="input-xlarge">
|
||||
<span class="help-inline">Please correct the error</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary" href="#">Submit/確定</a>
|
||||
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<div id="qe-picture" class="qe-edit-div hide">
|
||||
<div id="qe-picture" class="qe-edit-div">
|
||||
<div id="widget-picture">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Picture</label>
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div id="qe-tags" class="qe-edit-div hide">
|
||||
<div id="qe-tags" class="qe-edit-div">
|
||||
<div id="widget-tags">
|
||||
<div class="form-horizontal">
|
||||
<% @tags.each do |tag| %>
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th class="span1 strong">
|
||||
<input id="check_all_bulletins" type="checkbox">
|
||||
<a href='#' class="list-remove"><i class="icon-trash"></i></a>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('status') %>">
|
||||
<%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('status'))), :class => 'js_history' %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('category') %>">
|
||||
<%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('category'))), :class => 'js_history' %>
|
||||
</th>
|
||||
<th class="sort span7 <%= is_sort_active?('title') %>">
|
||||
<%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('title'))), :class => 'js_history' %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
|
||||
<%= link_to t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('postdate'))), :class => 'js_history' %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
|
||||
<%= link_to t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('deadline'))), :class => 'js_history' %>
|
||||
</th>
|
||||
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
|
||||
<%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('tags'))), :class => 'js_history' %>
|
||||
</th>
|
||||
<th class="sort span1-3 <%= is_sort_active?('update_user_id') %>">
|
||||
<%= link_to t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('update_user_id'))), :class => 'js_history' %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
$("#modal-file").modal('hide');
|
||||
$('<%= j render :partial => 'list_bulletin_file', :collection => [@bulletin_file] %>').appendTo('#bulletin_files').hide().fadeIn();
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
$("#modal-link").modal('hide');
|
||||
$('<%= j render :partial => 'list_bulletin_link', :collection => [@bulletin_link] %>').appendTo('#bulletin_links').hide().fadeIn();
|
||||
Vendored
+10
-7
@@ -1,7 +1,10 @@
|
||||
<h1><%= t('announcement.editing_announcement') %></h1>
|
||||
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_back %>
|
||||
<ul class="breadcrumb">
|
||||
<li><span>Home</span><span class="divider">/</span></li>
|
||||
<li><span>Library</span><span class="divider">/</span></li>
|
||||
<li class="text-blue"><%= t('announcement.editing_announcement') %></li>
|
||||
</ul>
|
||||
<div id="poststuff">
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
+1
@@ -0,0 +1 @@
|
||||
$("#modal-file").html("<%= j render "bulletin_file_qe" %>");
|
||||
+1
@@ -0,0 +1 @@
|
||||
$("#modal-file").html("<%= j render "bulletin_file_qe" %>");
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'bulletins' %>
|
||||
</table>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= 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' %>
|
||||
</div>
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'bulletins' %>
|
||||
</table>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= 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' %>
|
||||
</div>
|
||||
|
||||
Vendored
+18
-4
@@ -1,7 +1,20 @@
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'bulletins' %>
|
||||
</table>
|
||||
<%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil), :html => {:id => 'delete_bulletins'}, :remote => true do %>
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'bulletins' %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<div id="bulletin_pagination">
|
||||
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
|
||||
<div id="bulletin_link_qe">
|
||||
<div id="modal-link" class="modal fade">
|
||||
<%= render :partial => "bulletin_link_qe" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= 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' %>
|
||||
</div>
|
||||
@@ -9,3 +22,4 @@
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "bulletin_form" %>
|
||||
<% end %>
|
||||
|
||||
Vendored
+7
-1
@@ -1 +1,7 @@
|
||||
$("#bulettin_sort_list").html("<%= j render 'bulletins' %>")
|
||||
$("#collapse-status").html("<%= j render 'filter_status' %>");
|
||||
$("#collapse-category").html("<%= j render 'filter_categories' %>");
|
||||
$("#collapse-tags").html("<%= j render 'filter_tags' %>");
|
||||
$("#delete_bulletins").attr("action", "<%= delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter) %>");
|
||||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||
$("#tbody_bulletins").html("<%= j render :partial => 'bulletin', :collection => @bulletins %>");
|
||||
$("#bulletin_pagination").html("<%= j paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
||||
+1
@@ -0,0 +1 @@
|
||||
$("#modal-link").html("<%= j render "bulletin_link_qe" %>");
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
//$.each($(".quick_edit"),function(obj){ $(this).remove(); });
|
||||
$("#<%= "bulletin_#{bulletin_link2.id}" %>").append("<%= j render "bulletin_link_qe" %>");
|
||||
$("#modal-link").html("<%= j render "bulletin_link_qe" %>");
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
$("#<%= dom_id @bulletin, :edit %>").show()
|
||||
$("#<%= dom_id @bulletin, :edit %>").html("<%= j render :partial => 'quick_edit', :locals => {:type => @type} %>")
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
<div id="poststuff">
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_back %>
|
||||
</div>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
$("#modal-file").modal('hide');
|
||||
$("#<%= dom_id @bulletin_file %>").replaceWith("<%= j render :partial => 'list_bulletin_file', :collection => [@bulletin_file] %>");
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
$("#modal-link").modal('hide');
|
||||
$("#<%= dom_id @bulletin_link %>").replaceWith("<%= j render :partial => 'list_bulletin_link', :collection => [@bulletin_link] %>");
|
||||
+22
-3
@@ -1,7 +1,26 @@
|
||||
<%= content_tag :div ,:id => "users_checkbox_ary", do -%>
|
||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
||||
<% sys_users = User.all -%>
|
||||
<% sys_users.each do |user| -%>
|
||||
<%= label_tag "lab-user-#{user.id}", user.name rescue '' -%>
|
||||
<%= check_box_tag "[users][#{user.id}]", 'true',users.include?(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 -%>
|
||||
+26
-7
@@ -1,19 +1,38 @@
|
||||
<%= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
|
||||
<br/>
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "inc/permission-checkbox" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "bootstrap" %>
|
||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
||||
<%= javascript_include_tag "inc/search" %>
|
||||
<% end %>
|
||||
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
|
||||
<%= form_tag('', :remote => true) %>
|
||||
<%= label_tag :category, t("announcement.bulletin.category") %>
|
||||
<%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %>
|
||||
|
||||
<br/>
|
||||
<%= label_tag :role, t("admin.roles") %>
|
||||
<div class="subnav">
|
||||
<ul class="nav nav-pills filter">
|
||||
<li class="accordion-group">
|
||||
<div class="form-search" style="margin: 5px 10px;">
|
||||
<%= label_tag :category, t("announcement.bulletin.category") %>
|
||||
<%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %>
|
||||
<%= search_field_tag 'user_filter' %>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%#= label_tag :role, t("admin.roles") %>
|
||||
<div class="clear">
|
||||
<%= content_tag :div do -%>
|
||||
<% form_tag :action => "update_setting" do %>
|
||||
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
|
||||
<%= submit_tag "Update" %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var availableTags = [];
|
||||
$(function() {
|
||||
|
||||
$('#category_id').change(function() {
|
||||
$(this).parents('form').submit();
|
||||
});
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
|
||||
|
||||
<% if @bulletin and !@bulletin.nil? %>
|
||||
|
||||
<div id="col1" class="col">
|
||||
<h1 class="h1 ini_heading col_title"><%= @bulletin.title %></h1>
|
||||
<p class="ini_txt"><%= @bulletin.subtitle %></p>
|
||||
<%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %>
|
||||
<a class="btn" href="">read more ></a>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if @bulletins and !@bulletins.nil? %>
|
||||
|
||||
<div id="col2" class="col">
|
||||
<h1 class="h1 ini_heading col_title">news</h1>
|
||||
<ul class="ini_list">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li><span class="time"><%= post.postdate.to_s.gsub("-", "") %></span><%= link_to post.title,panel_announcement_front_end_bulletin_path(post) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
||||
<a class="btn" href="announcement">read more ></a>
|
||||
</div>
|
||||
|
||||
<div id="col2" class="col">
|
||||
<h1 class="h1 ini_heading col_title">news</h1>
|
||||
<ul class="ini_list">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<%= image_tag(post.image.url, :size => "160x140") if post.image.file %>
|
||||
<h4><%= post.title %></h4>
|
||||
<%= post.subtitle %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
||||
<a class="btn" href="announcement">read more ></a>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
|
||||
|
||||
<% if @bulletin and !@bulletin.nil? %>
|
||||
|
||||
<div id="col1" class="col">
|
||||
<h1 class="h1 ini_heading col_title"><%= @bulletin.title %></h1>
|
||||
<p class="ini_txt"><%= @bulletin.subtitle %></p>
|
||||
<%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %>
|
||||
<a class="btn" href="">read more ></a>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if @bulletins and !@bulletins.nil? %>
|
||||
|
||||
<div id="col2" class="col">
|
||||
<h1 class="h1 ini_heading col_title">news</h1>
|
||||
<ul class="ini_list">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li><span class="time"><%= post.postdate.to_s.gsub("-", "") %></span><%= link_to post.title,panel_announcement_front_end_bulletin_path(post) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
||||
<a class="btn" href="announcement">read more ></a>
|
||||
</div>
|
||||
|
||||
<div id="col2" class="col">
|
||||
<h1 class="h1 ini_heading col_title">news</h1>
|
||||
<ul class="ini_list">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<%= image_tag(post.image.url, :size => "160x140") if post.image.file %>
|
||||
<h4><%= post.title %></h4>
|
||||
<%= post.subtitle %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
||||
<a class="btn" href="announcement">read more ></a>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
Vendored
-1
@@ -1,7 +1,6 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<% if @bulletins and !@bulletins.nil? %>
|
||||
|
||||
<h2 class="topic_title"><%= t('announcement.campus_news')%></h2>
|
||||
<%= link_to t('announcement.more'),panel_announcement_front_end_bulletins_path(), :class => "topic_note" %>
|
||||
<div class="topic_prev">previous page</div>
|
||||
|
||||
@@ -40,7 +40,10 @@ en:
|
||||
fact_check_stat: Fact Check Status
|
||||
fact_check_not_pass: 'Not Pass'
|
||||
fact_check_not_pass_reason: 'Reason'
|
||||
fact_check_pending: 'Pending'
|
||||
fact_check_pass: 'Pass'
|
||||
fact_check_setting_window_title: 'Unit'
|
||||
|
||||
# admin:
|
||||
# action: Action
|
||||
# add_language: Add language
|
||||
|
||||
@@ -33,10 +33,11 @@ zh_tw:
|
||||
fact_check: 公告審核
|
||||
fact_check_setting: 審核設定
|
||||
fact_check_stat: 審核狀況
|
||||
fact_check_pending: 審核中
|
||||
fact_check_not_pass: '不通過'
|
||||
fact_check_pass: '通過'
|
||||
fact_check_not_pass_reason: '不通過原因'
|
||||
|
||||
fact_check_setting_window_title: '單位'
|
||||
# admin:
|
||||
# action: 行動
|
||||
# add_language: 新增語言
|
||||
|
||||
+18
-3
@@ -6,14 +6,29 @@ Rails.application.routes.draw do
|
||||
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
|
||||
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
|
||||
|
||||
root :to => "bulletins#index"
|
||||
resources :bulletins do
|
||||
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
|
||||
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||
member do
|
||||
get 'load_quick_edit'
|
||||
end
|
||||
collection do
|
||||
post '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
|
||||
end
|
||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
||||
|
||||
resources :bulletin_categorys
|
||||
|
||||
resources :bulletin_links, :controller => 'bulletin_links' do
|
||||
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
||||
end
|
||||
|
||||
resources :bulletin_files, :controller => 'bulletin_files' do
|
||||
match "file_quick_edit/:bulletin_file_id" => "bulletin_files#file_quick_edit" ,:as => :file_quick_edit
|
||||
end
|
||||
|
||||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.bundle/
|
||||
log/*.log
|
||||
pkg/
|
||||
test/dummy/db/*.sqlite3
|
||||
test/dummy/log/*.log
|
||||
test/dummy/tmp/
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
source "http://rubygems.org"
|
||||
|
||||
# Declare your gem's dependencies in NewBlog.gemspec.
|
||||
# Bundler will treat runtime dependencies like base dependencies, and
|
||||
# development dependencies will be added by default to the :development group.
|
||||
|
||||
gem "mongoid"
|
||||
gemspec
|
||||
|
||||
# Declare any dependencies that are still in development here instead of in
|
||||
# your gemspec. These might include edge Rails or gems from your path or
|
||||
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||
# your gem to rubygems.org.
|
||||
|
||||
# To use debugger
|
||||
# gem 'ruby-debug19', :require => 'ruby-debug'
|
||||
-101
@@ -1,101 +0,0 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
NewBlog (0.0.1)
|
||||
rails (~> 3.1.0.rc6)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.1.0)
|
||||
actionpack (= 3.1.0)
|
||||
mail (~> 2.3.0)
|
||||
actionpack (3.1.0)
|
||||
activemodel (= 3.1.0)
|
||||
activesupport (= 3.1.0)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6)
|
||||
rack (~> 1.3.2)
|
||||
rack-cache (~> 1.0.3)
|
||||
rack-mount (~> 0.8.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.0.0)
|
||||
activemodel (3.1.0)
|
||||
activesupport (= 3.1.0)
|
||||
bcrypt-ruby (~> 3.0.0)
|
||||
builder (~> 3.0.0)
|
||||
i18n (~> 0.6)
|
||||
activerecord (3.1.0)
|
||||
activemodel (= 3.1.0)
|
||||
activesupport (= 3.1.0)
|
||||
arel (~> 2.2.1)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.1.0)
|
||||
activemodel (= 3.1.0)
|
||||
activesupport (= 3.1.0)
|
||||
activesupport (3.1.0)
|
||||
multi_json (~> 1.0)
|
||||
arel (2.2.1)
|
||||
bcrypt-ruby (3.0.0)
|
||||
bson (1.3.1)
|
||||
builder (3.0.0)
|
||||
erubis (2.7.0)
|
||||
hike (1.2.1)
|
||||
i18n (0.6.0)
|
||||
mail (2.3.0)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.16)
|
||||
mongo (1.3.1)
|
||||
bson (>= 1.3.1)
|
||||
mongoid (2.1.9)
|
||||
activemodel (~> 3.0)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
multi_json (1.0.3)
|
||||
polyglot (0.3.2)
|
||||
rack (1.3.2)
|
||||
rack-cache (1.0.3)
|
||||
rack (>= 0.4)
|
||||
rack-mount (0.8.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.1.0)
|
||||
actionmailer (= 3.1.0)
|
||||
actionpack (= 3.1.0)
|
||||
activerecord (= 3.1.0)
|
||||
activeresource (= 3.1.0)
|
||||
activesupport (= 3.1.0)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.1.0)
|
||||
railties (3.1.0)
|
||||
actionpack (= 3.1.0)
|
||||
activesupport (= 3.1.0)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
rake (0.9.2)
|
||||
rdoc (3.9.4)
|
||||
sprockets (2.0.0)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (!= 1.3.0, ~> 1.1)
|
||||
thor (0.14.6)
|
||||
tilt (1.3.3)
|
||||
treetop (1.4.10)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.29)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
NewBlog!
|
||||
mongoid
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
Copyright 2011 YOURNAME
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,3 +0,0 @@
|
||||
= NewBlog
|
||||
|
||||
This project rocks and uses MIT-LICENSE.
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env rake
|
||||
begin
|
||||
require 'bundler/setup'
|
||||
rescue LoadError
|
||||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||
end
|
||||
begin
|
||||
require 'rdoc/task'
|
||||
rescue LoadError
|
||||
require 'rdoc/rdoc'
|
||||
require 'rake/rdoctask'
|
||||
RDoc::Task = Rake::RDocTask
|
||||
end
|
||||
|
||||
RDoc::Task.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = 'NewBlog'
|
||||
rdoc.options << '--line-numbers'
|
||||
rdoc.rdoc_files.include('README.rdoc')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
||||
|
||||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
||||
require 'rake/testtask'
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << 'lib'
|
||||
t.libs << 'test'
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
|
||||
task :default => :test
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
-7
@@ -1,7 +0,0 @@
|
||||
/*
|
||||
*This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
*the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
*= require_tree .
|
||||
*/
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/* module */
|
||||
#module{
|
||||
float: left;
|
||||
width: 170px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.production {
|
||||
padding: 10px;
|
||||
font-size: 12px;
|
||||
border: 1px solid #e1e1e1;
|
||||
margin-bottom: 10px;
|
||||
background: #DDDAD0;
|
||||
color: #484339;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 0 0 5px #33322C;
|
||||
-webkit-box-shadow: 0 0 5px #33322C;
|
||||
box-shadow: 0 0 5px #33322C;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
line-height: 1.4;
|
||||
font-family: Arial;
|
||||
}
|
||||
.production h2{
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
border-left: 4px solid #B6300C;
|
||||
line-height: 20px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.production table{
|
||||
border: 1px solid #9b968c;
|
||||
padding: 5px;
|
||||
width: 145px;
|
||||
}
|
||||
.production th{
|
||||
background: #d3cfc3;
|
||||
font-weight: bold;
|
||||
}
|
||||
.production th, .production tr, .production td{
|
||||
border: 1px solid #9b968c;
|
||||
padding: 5px;
|
||||
}
|
||||
.production a{
|
||||
color: #9a460e;
|
||||
text-decoration: none;
|
||||
}
|
||||
.production a:hover{
|
||||
text-decoration: underline;
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,23 +0,0 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
before_filter :set_locale
|
||||
|
||||
# Set I18n.locale
|
||||
def set_locale
|
||||
# update session if passed
|
||||
session[:locale] = params[:locale] if params[:locale]
|
||||
|
||||
# set locale based on session or default
|
||||
begin
|
||||
# check if locale is valid for non site pages
|
||||
if !VALID_LOCALES.include?(session[:locale])
|
||||
I18n.locale = I18n.default_locale
|
||||
else
|
||||
I18n.locale = session[:locale]
|
||||
end
|
||||
rescue
|
||||
I18n.locale = I18n.default_locale
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
-84
@@ -1,84 +0,0 @@
|
||||
class Panel::NewBlog::BackEnd::PostsController < ApplicationController
|
||||
|
||||
layout 'admin'
|
||||
|
||||
def index
|
||||
@posts = Post.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @posts }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /posts/1
|
||||
# GET /posts/1.xml
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @post }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /posts/new
|
||||
# GET /posts/new.xml
|
||||
def new
|
||||
@post = Post.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @post }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /posts/1/edit
|
||||
def edit
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /posts
|
||||
# POST /posts.xml
|
||||
def create
|
||||
@post = Post.new(params[:post])
|
||||
|
||||
respond_to do |format|
|
||||
if @post.save
|
||||
format.html { redirect_to(panel_new_blog_post_url(@post), :notice => t('blog.create_post_success')) }
|
||||
format.xml { render :xml => @post, :status => :created, :location => @post }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /posts/1
|
||||
# PUT /posts/1.xml
|
||||
def update
|
||||
@post = Post.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @post.update_attributes(params[:post])
|
||||
format.html { redirect_to(panel_new_blog_post_url(@post), :notice => t('blog.update_post_success')) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /posts/1
|
||||
# DELETE /posts/1.xml
|
||||
def destroy
|
||||
@post = Post.find(params[:id])
|
||||
@post.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_new_blog_posts_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
class Panel::NewBlog::FrontEnd::CommentsController < OrbitFrontendController
|
||||
def create
|
||||
@post = Post.find(params[:post_id])
|
||||
@comment = @post.comments.create!(params[:comment])
|
||||
redirect_to panel_new_blog_front_end_post_url(@post)
|
||||
end
|
||||
end
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
class Panel::NewBlog::FrontEnd::PostsController < OrbitFrontendController
|
||||
# GET /posts
|
||||
# GET /posts.xml
|
||||
def index
|
||||
@posts = Post.all
|
||||
end
|
||||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
class Panel::NewBlog::Widget::PostsController < OrbitWidgetController
|
||||
# GET /posts
|
||||
# GET /posts.xml
|
||||
def index
|
||||
@posts = Post.all
|
||||
end
|
||||
|
||||
def latest_post
|
||||
@post = Post.all.last
|
||||
end
|
||||
|
||||
end
|
||||
Whitespace-only changes.
@@ -1,6 +0,0 @@
|
||||
module ApplicationHelper
|
||||
|
||||
def check_show_frontend
|
||||
front_end_available(NewBlog::MOUDLEAPP_TITLE)
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
module NewBlogHelper
|
||||
def self.check_show_frontend
|
||||
ApplicationController.front_end_available(NewBlog::MOUDLEAPP_TITLE)
|
||||
end
|
||||
end
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -1,7 +0,0 @@
|
||||
class Comment
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
field :name, :type => String
|
||||
field :body, :type => String
|
||||
embedded_in :post, :inverse_of => :comments
|
||||
end
|
||||
@@ -1,10 +0,0 @@
|
||||
class Post
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
field :title, :type => String
|
||||
field :body, :type => String
|
||||
embeds_many :comments
|
||||
validates_presence_of :title, :body
|
||||
end
|
||||
Whitespace-only changes.
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
<%= stylesheet_link_tag :all %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= csrf_meta_tag %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
<%= stylesheet_link_tag :all %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= csrf_meta_tag %>
|
||||
</head>
|
||||
<body class="edit preview">
|
||||
<div class="wapper">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +0,0 @@
|
||||
<div class="production">
|
||||
<%= yield %>
|
||||
</div>
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :title %><br />
|
||||
<%= f.text_field :title %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :body %><br />
|
||||
<%= f.text_area :body %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<h1><%= t('blog.editing_post') %></h1>
|
||||
|
||||
<%= form_for @post, :url => panel_new_blog_back_end_post_path(@post) do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to t('blog.show'), panel_new_blog_back_end_post_path(@post) %> |
|
||||
<%= link_back %>
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('blog.new_post'), new_panel_new_blog_back_end_post_path, :class => 'seclink1' %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<h1><%= t('blog.list_post') %></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('blog.title') %></th>
|
||||
<th><%= t('blog.body') %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.title %></td>
|
||||
<td><%= truncate(post.body,:length=>15) %></td>
|
||||
<td><%= link_to t('blog.new_auth'), init_admin_object_auths_path("Post",post) %></td>
|
||||
<td><%= link_to t('blog.show'), panel_new_blog_back_end_post_path(post) %></td>
|
||||
<td><%= link_to t('blog.edit'), edit_panel_new_blog_back_end_post_path(post) %></td>
|
||||
<td><%= link_to t('blog.delete'), panel_new_blog_back_end_post_path(post), :confirm => t('blog.sure?'), :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
<%=stylesheet_link_tag "new_blog/application"%>
|
||||
<h2><%=@post.title%></h2>
|
||||
<p>
|
||||
<%= @post.body%>
|
||||
</p>
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('blog.index'), panel_new_blog_back_end_posts_path, :class => 'seclink2' %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
<h1><%= t('blog.new_post') %></h1>
|
||||
<%= form_for @post, :url => panel_new_blog_back_end_posts_path do |f| %>
|
||||
<%= f.text_field :title, :class => 'text' %>
|
||||
<% end %>
|
||||
|
||||
<%= link_back %>
|
||||
Loaded 100 of 256 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user