Merge branch 'ad_banner' into ldap

This commit is contained in:
Christophe Vilayphiou 2012-04-24 16:46:04 +08:00
commit 0c4f1d91f7
14 changed files with 276 additions and 44 deletions

View File

@ -1,6 +1,6 @@
<%= content_tag :li, :class => active_for_controllers('purchases') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
<% end -%>
<%#= content_tag :li, :class => active_for_controllers('purchases') do -%>
<%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
<%# end -%>
<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'fact_checks') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
@ -9,14 +9,14 @@
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %>
<% end -%>
<% end -%>
<%= content_tag :li, :class => active_for_controllers('users') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<% end -%>
<%#= content_tag :li, :class => active_for_controllers('users') do -%>
<%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<%# end -%>
<%= content_tag :li, :class => active_for_controllers('page_contexts') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %>
@ -41,10 +41,10 @@
<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%>
<%= content_tag :li, link_to(t('admin.announcement.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
<%= content_tag :li, link_to(t('admin.announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
<%= content_tag :li, link_to(t('admin.announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %>
<% end -%>
<% end -%>

View File

@ -65,6 +65,7 @@ en:
add_drop_down_item: +Add Menu Item
admin: Admin
action: Action
all_articles: List
announcement: Announcement
asset: Asset
assets:
@ -92,7 +93,7 @@ en:
dashboard: Dashboard
delete_language: Delete language
description: Description
design: Design
design: Template
disable_language: Disable language
editing_home: Editing homepage
editing_layout: Editing layout
@ -117,6 +118,7 @@ en:
layout: Layout
layout_name: Layout name
links: Links
link: Links
list_assets: Assets list
list_designs: Designs list
list_items: Items list
@ -161,7 +163,7 @@ en:
setup_translations: Translations setup
setup_designs: Designs setup
site: Site
site_setting: Site Setting
site_settings: Site Setting
super_pages: Super pages
structure: Structure
title: Title

View File

@ -61,6 +61,7 @@ zh_tw:
add_language: 新增語言
add_drop_down_item: 增加Orbit選單
admin: 管理
all_articles: 列表
announcement: 公告管理
asset: 資產
assets:
@ -92,7 +93,7 @@ zh_tw:
data: 資料數據
delete_language: 刪除語言
description: 描述
design: 網站版型
design: 版型管理
disable_language: 禁用語言
edit: 編輯
editing_home: 編輯首頁
@ -117,6 +118,7 @@ zh_tw:
language: 語言
layout: 佈局
layout_name: 佈局名字
link: 連結管理
links: 網路資源
list_assets: 資產列表
list_designs: 設計列表
@ -151,13 +153,13 @@ zh_tw:
non_multilingual: 非多種語言
options: 選項
orig_upload_file: 原上傳檔名
page: Page
page: 頁面管理
position: 位置
published?: 發布?
purchase: 購買
role: 角色
roles: 角色
site_setting: 基本設定
site_settings: 基本設定
setup_member: 成員設置
setup_translations: 語系設定
setup_designs: 版型設定

View File

@ -0,0 +1,75 @@
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
# layout 'admin'
def setting
@bulletin_categorys = BulletinCategory.all
if params.has_key?(:category_id)
first_category = BulletinCategory.find params[:category_id]
if params[:commit] == 'Update'
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
preload_object_auth = preload_object_auth_ary.first
preload_object_auth.privilege_users = privilege_users
preload_object_auth.save!
end
else
first_category = @bulletin_categorys.first
end
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
format.js
end
end
def update_setting
end
# def index
# get_categorys(params[:bulletin_category_id])
#
# @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
# @bulletin_categories = BulletinCategory.all
#
# module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
# @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
#
# respond_to do |format|
# format.html # index.html.erb
# format.js
# format.xml { render :xml => @bulletins }
# end
# end
#
# def new
#
# end
#
# def create
#
# end
#
# def update
#
# end
#
# def edit
#
# end
#
# def destroy
#
# end
protected
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end

View File

@ -0,0 +1,15 @@
<h1><%= bulletin_category.key %></h1>
<table>
<tr>
<th><%= t('bulletin.status') %></th>
<th><%= t('bulletin.category') %></th>
<th><%= t('bulletin.title') %></th>
<th><%= t('bulletin.postdate') %></th>
<th><%= t('bulletin.deadline') %></th>
<th><%= t('bulletin.action') %></th>
</tr>
<% bulletin_category.bulletins.each do |post| %>
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %>
<% end %>
</table>

View File

@ -0,0 +1,26 @@
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
<% sys_users = User.all -%>
<% sys_users.each do |user| -%>
<div class="checkblock">
<% user.sub_roles.each do |sr| %>
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
<% end %>
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_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 -%>

View File

@ -0,0 +1,50 @@
<%= render 'panel/announcement/back_end/bulletins/filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'panel/announcement/back_end/bulletins/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>
<!--
<% content_for :secondary do %>
<%#= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<fieldset><legend><%= t('bulletin.search') %></legend>
<%= form_for :bulletin, :action => 'search', :method => 'get', :url => panel_announcement_back_end_bulletins_path do |f| %>
<%#= f.select :bulletin_category_id, @bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('bulletin.select') }%>
Category <%#= select_tag "category_id", options_for_select(@bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('bulletin.select') %>
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</fieldset>
<br />
<br />
<h1><%= t('bulletin.list_announcement') %></h1>
<div id="check_block">
<h1>Check Please</h1>
<%#= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />
-->

View File

@ -0,0 +1,41 @@
<% 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) %>
<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} %>
<div class="form-actions pagination-centered">
<%= submit_tag "Update", :class => 'btn' %>
</div>
<% end -%>
<% end -%>
</div>
<script type="text/javascript" charset="utf-8">
var availableTags = [];
$(function() {
$('#category_id').change(function() {
$(this).parents('form').submit();
});
</script>

View File

@ -0,0 +1 @@
$("#users_checkbox_ary").replaceWith('<%= (render :partial => 'privilege_user', :locals => {:users => @users_array}).html_safe%>');

View File

@ -40,7 +40,7 @@
<%#= 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 %>
<li><%= link_to t('announcement.bulletin.approval'), 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>

View File

@ -110,17 +110,17 @@
<% 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') %>
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('announcement.bulletin.fact_check_pass') %>
<%= t('announcement.bulletin.approval_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('announcement.bulletin.fact_check_not_pass') %>
<%= t('announcement.bulletin.approval_not_pass') %>
<% end -%>
<div class="select-role">
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>

View File

@ -37,7 +37,27 @@ en:
rejected: Rejected
clear: Clear
hot: Hot
top: Top
hidden: Hidden
passed: Approved
pending: Pending
rejected: Rejected
clear: Clear
hot: Hot
top: Top
hidden: Hidden
passed: Approved
pending: Pending
rejected: Rejected
clear: Clear
announcement:
all_articles: List
add_new: Add
sure?: Sure?
campus_news: Campus News
more: more+
@ -49,14 +69,14 @@ en:
list_lower: " list"
title: Title
postdate: Postdate
fact_check: Fact Check
fact_check_setting: Fact Check Setting
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'
approval: Approval
approval_setting: Approval Setting
approval_stat: Fact Check Status
approval_not_pass: 'Not Pass'
approval_not_pass_reason: 'Reason'
approval_pending: 'Pending'
approval_pass: 'Pass'
approval_setting_window_title: 'Unit'
# admin:
# action: Action

View File

@ -27,16 +27,16 @@ zh_tw:
hot: 熱門
top: 置頂
hidden: 隱藏
passed: 通過
pending: 待審
passed: 審核通過
pending: 待審
rejected: 不通過
clear: 清除
quick_edit: 快速編輯
announcement:
add_new: 新增公告
all_articles: 公告列表
add_new: 新增
all_articles: 列表
tags: 標籤
categories: 分類
status: 狀態
@ -51,14 +51,14 @@ zh_tw:
list_lower: 列表
title: 標題
postdate: 張貼日期
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: '單位'
approval: 公告審核
approval_setting: 審核設定
approval_stat: 審核狀況
approval_pending: 待審核
approval_not_pass: '不通過'
approval_pass: '通過'
approval_not_pass_reason: '不通過原因'
approval_setting_window_title: '單位'
bulletin:
last_modified: 最後修改於

View File

@ -3,8 +3,8 @@ Rails.application.routes.draw do
namespace :announcement do
namespace :back_end do
match 'public' => "announcements#public",:as => :public
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
match 'approval_setting' => "approvals#setting" ,:as => :approval_setting
match 'update_setting' => "approvals#update_setting" ,:as => :approval_update_setting
resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add