archive for announcement
This commit is contained in:
parent
f7107936d0
commit
ae2cbb728e
|
@ -75,3 +75,8 @@
|
|||
<%#= content_tag :li, link_to(t('admin.tags'), admin_asset_tags_path), :class => active_for_action('/admin/asset_tags', 'index') %>
|
||||
<%# end -%>
|
||||
<%# end -%>
|
||||
<div class="content">
|
||||
<% flash.each do |key, msg| %>
|
||||
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
|
||||
<% end%>
|
||||
</div>
|
|
@ -14,7 +14,7 @@ module OrbitCoreLib
|
|||
query1 = auth_object_space.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: user.id)
|
||||
query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role.id}).excludes(blocked_user_ids: user.id)
|
||||
result = (query1 + query2).uniq
|
||||
result.collect{|t| t.obj_authable}
|
||||
result.collect{|t| t.obj_authable}.delete_if{|val| val==nil}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -107,13 +107,20 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
|
|||
# DELETE /bulletins/1
|
||||
# DELETE /bulletins/1.xml
|
||||
def destroy
|
||||
@bulletin_category = BulletinCategory.find(params[:id])
|
||||
@bulletin_category.destroy
|
||||
@bulletin_category = BulletinCategory.find(params[:id]).first
|
||||
@bulletin_category.disable = @bulletin_category.disable ? false : true
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
if @bulletin_category.save!
|
||||
respond_to do |format|
|
||||
flash[:notice] = t("bulletin_category.update_success")
|
||||
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("bulletin_category.update_failed")
|
||||
format.html { render :action => "index" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
layout 'new_admin'
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :get_categorys ,:only => [ :new,:edit,:update]
|
||||
# before_filter :for_admin_only,:only => [:]
|
||||
# before_filter :for_app_manager,:only => [:index,:show,]
|
||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
|
||||
|
@ -83,15 +84,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
# @bulletin.bulletin_files.build
|
||||
# @bulletin.bulletin_files.new
|
||||
|
||||
if get_categorys.empty?
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_tags
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @bulletin }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -105,7 +101,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
|
||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
||||
|
||||
get_categorys
|
||||
get_tags
|
||||
end
|
||||
end
|
||||
|
@ -268,7 +263,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
format.xml { head :ok }
|
||||
else
|
||||
get_tags
|
||||
get_categorys
|
||||
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
|
@ -333,9 +328,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
@bulletin_categorys = []
|
||||
#@unit_list_for_anc = UnitListForAnc.all
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
|
||||
@bulletin_categorys = (id ? BulletinCategory.available.find(id).to_a : BulletinCategory.available)
|
||||
elsif is_sub_manager?
|
||||
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit')
|
||||
@bulletin_categorys = BulletinCategory.available.authed_for_user(current_user,'submit')
|
||||
end
|
||||
if @bulletin_categorys.empty? && params[:action] != "index"
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,4 +13,8 @@ include ActionView::Helpers::UrlHelper
|
|||
link_to t('announcement.bulletin.cate_auth'),admin_object_auth_ob_auth_path(oa)
|
||||
end
|
||||
|
||||
def show_toggle_archive_btn(bulletin_category)
|
||||
bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||
end
|
||||
|
||||
end
|
|
@ -14,11 +14,22 @@ class BulletinCategory
|
|||
|
||||
field :key
|
||||
field :display
|
||||
|
||||
field :disable,type: Boolean,:default => false
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
has_many :bulletins,:dependent => :destroy
|
||||
has_many :bulletins
|
||||
|
||||
scope :available,where(disable: false)
|
||||
|
||||
def self.find(*args)
|
||||
if args ==[:all]
|
||||
unscoped
|
||||
else
|
||||
unscoped.find(args)
|
||||
end
|
||||
end
|
||||
|
||||
def pp_object
|
||||
i18n_variable[I18n.locale]
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<ul class="nav nav-pills hide">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<li><%= link_to show_toggle_archive_btn(bulletin_category) , panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=> "archive_toggle" %></li>
|
||||
<% end %>
|
||||
<%if is_manager? || is_admin? %>
|
||||
<li><%= show_anc_cate_permission_link(bulletin_category) %></li>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#<%= dom_id @bulletin_category %>").remove();
|
||||
$("#<%= dom_id @bulletin_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@bulletin_category) %> ");
|
|
@ -79,6 +79,7 @@ zh_tw:
|
|||
fact_check: 公告審核
|
||||
delete: 刪除
|
||||
edit: 編輯
|
||||
|
||||
# action: 行動
|
||||
# add_language: 新增語言
|
||||
# admin: 管理
|
||||
|
@ -178,6 +179,10 @@ zh_tw:
|
|||
bulletin_category:
|
||||
edit: 修改
|
||||
delete: 刪除
|
||||
update_success: 分類更新成功
|
||||
update_failed: 分類更新失敗
|
||||
disable_change_to_false: 設為停用
|
||||
disable_change_to_true: 重新啓用
|
||||
|
||||
# Chinese (Taiwan) translations for Ruby on Rails
|
||||
# by tsechingho (http://github.com/tsechingho)
|
||||
|
|
Reference in New Issue