新聞與公告QA-權限設定--優先處理3.一般發佈新聞&公告人,應該只能看到自己發佈的新聞&公告,但是目前可以看到全部,而且可以刪除其他人的公告.至少要不能刪除別人的公告
新聞與公告QA-編輯問題-發佈新聞時,發佈單位預設為請選擇
新聞與公告QA-編輯問題-公告模組請移除 Subtitle 欄位
put rb-readline only in Linux
make app_manager destroy after user deletion.   may need to run:
 AppManager.all.collect{|am|  am if am.user.nil? }.delete_if {|x| x == nil}.each{|am| am.destroy}
for clean up DB.
This commit is contained in:
Matthew K. Fu JuYuan 2012-06-25 16:23:16 +08:00
parent a36f73bafc
commit ffd95ee1fd
16 changed files with 49 additions and 37 deletions

View File

@ -26,7 +26,6 @@ gem 'rake'
gem 'resque' # background jobs
gem 'resque-scheduler' # job scheduling
gem 'resque-restriction'
gem 'rb-readline'
gem 'ruby-debug19'
gem 'rubyzip'
gem 'therubyracer'
@ -34,6 +33,8 @@ gem 'sinatra'
gem 'sprockets'
gem 'tinymce-rails'
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
gem 'rb-readline' if RUBY_PLATFORM.downcase.include?("linux")
gem "impressionist", :require => "impressionist", :path => "vendor/impressionist"

View File

@ -168,7 +168,6 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rb-readline (0.4.2)
rdoc (3.12)
json (~> 1.4)
redis (2.2.2)
@ -302,7 +301,6 @@ DEPENDENCIES
radius
rails (>= 3.1.0, < 3.2.0)
rake
rb-readline
resque
resque-restriction
resque-scheduler

View File

@ -4,7 +4,7 @@ class ModuleApp
include OrbitCoreLib::ObjectTokenUnility
field :key
field :title
field :title
field :version
field :organization
field :author
@ -16,8 +16,8 @@ class ModuleApp
field :app_pages ,type: Array
field :widgets ,type: Array
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
has_many :tags
has_many :page_parts

View File

@ -17,10 +17,10 @@ class User
has_many :attribute_values, :autosave => true, :dependent => :destroy
has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists
has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth"
has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth"
has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth", :dependent => :destroy
has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth", :dependent => :destroy
has_many :managing_apps,:class_name => "AppManager"
has_many :managing_apps,:class_name => "AppManager", :dependent => :destroy
belongs_to :role
has_and_belongs_to_many :sub_roles

View File

@ -12,7 +12,7 @@
<%= 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') || active_for_ob_auths_object("BulletinCategory") ) %>
<%= 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.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', '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('approvals', 'setting') if (is_manager? rescue true) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_app_auth('Announcement') if (is_admin? rescue nil) %>
<% end -%>
@ -26,7 +26,7 @@
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue true) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %>
<% end -%>

View File

@ -2,7 +2,7 @@
default_uid = 'kaito'
default_gid = 'staff'
rails_env = 'development' #ENV['RAILS_ENV'] || "production"
rails_env = ENV['RAILS_ENV'] || "production"
rails_root = ENV['RAILS_ROOT'] || File.expand_path("..",File.dirname(__FILE__))
@ -17,10 +17,10 @@ num_workers.times do |num|
w.interval = 30.seconds
p "/usr/bin/rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
# w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env} -P /var/godgod.#{port}.pid"
w.uid = rails_env == 'production' ? nccu : default_uid
w.gid = rails_env == 'production' ? nccu : default_gid
w.uid = rails_env == 'production' ? "nccu" : default_uid
w.gid = rails_env == 'production' ? "nccu" : default_gid
w.log = "#{rails_root}/log/god.log"

View File

@ -6,4 +6,10 @@ module Panel::Announcement::BackEnd::BulletinsHelper
by_bulletin and by_user
end
def show_delete_link(bulletin)
by_bulletin = (bulletin.create_user_id == current_user.id)
by_user = (is_manager? or is_admin?)
by_bulletin or by_user
end
end

View File

@ -48,12 +48,12 @@
<li><%= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
</ul>
</li>
<%#= debugger %>
<%#= a=1 %>
<% end %>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<% end -%>
<% if show_delete_link(bulletin) %>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<% end %>
<% if show_approval_link(bulletin) %>
<li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
<% end %>

View File

@ -123,7 +123,7 @@
<%#= f.label :unit_list_for_anc%>
<%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<%= f.label :category %>
<%= f.label :category,t('announcement.bulletin.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">
@ -141,23 +141,16 @@
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :title %>
<%= f.label :title ,t('announcement.bulletin.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' %>
<% end %>
</div>
<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' %>
<% end %>
</div>
<div class="editor">
<%= f.label :text %>
<%= f.label :text ,t('announcement.bulletin.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' %>

View File

@ -49,6 +49,7 @@ zh_tw:
bulletins: 公告訊息
related_links: 相關連結
bulletin:
text: 內文
category: 分類
submit_user_list: 張貼人
list_lower: 列表

View File

@ -6,4 +6,10 @@ module Panel::News::BackEnd::NewsBulletinsHelper
by_news_bulletin and by_user
end
def news_show_delete_link(news_bulletin)
by_news_bulletin = (news_bulletin.create_user_id == current_user.id)
by_user = (is_manager? or is_admin?)
by_news_bulletin or by_user
end
end

View File

@ -118,10 +118,10 @@
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.label :unit_list_for_anc%>
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<%= f.label :unit_list_for_anc,t('news.news_bulletin.unit_name')%>
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {:prompt => t("news.news_bulletin.ut_prompt")}, :class => "input-medium" %>
<%= f.label :category %>
<%= f.label :category,t('news.news_bulletin.category') %>
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<ul class="nav nav-tabs">
@ -139,7 +139,7 @@
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :title %>
<%= f.label :title, t('news.news_bulletin.title')%>
<%= f.fields_for :title, (@news_bulletin.new_record? ? @news_bulletin.build_title : @news_bulletin.title ) do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title' %>
@ -147,7 +147,7 @@
</div>
<div class="editor">
<%= f.label :subtitle %>
<%= f.label :subtitle, t('news.news_bulletin.subtitle') %>
<%= f.fields_for :subtitle, (@news_bulletin.new_record? ? @news_bulletin.build_subtitle : @news_bulletin.subtitle ) do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
@ -155,7 +155,7 @@
</div>
<div class="editor">
<%= f.label :text %>
<%= f.label :text, t('news.news_bulletin.text') %>
<%= f.fields_for :text, (@news_bulletin.new_record? ? @news_bulletin.build_text : @news_bulletin.text ) do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>

View File

@ -52,6 +52,8 @@
<%#= a=1 %>
<% end %>
<% end %>
<% if news_show_delete_link(news_bulletin) %>
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
<% end %>
<% if news_show_approval_link(news_bulletin) %>

View File

@ -65,6 +65,7 @@ en:
related_links: Related Links
news: News
news_bulletin:
ut_prompt: Please select UT
category: Category
list_lower: " list"
title: Title

View File

@ -47,9 +47,13 @@ zh_tw:
related_links: 相關連結
news: 新聞
news_bulletin:
ut_prompt: 請選擇單位
category: 分類
list_lower: 列表
title: 標題
subtitle: 副標題
text: 內文
unit_name: 發佈單位
postdate: 張貼日期
approval: 新聞審核
approval_setting: 審核設定