Remove unless files and change routes.

This commit is contained in:
Matthew K. Fu JuYuan authored and Christophe Vilayphiou committed 2012-05-14 00:50:36 +08:00
1 parent 0119ab1a74
commit 7a6d30ad62
20 files changed
+10 -395

No files matched your search

@@ -1,64 +0,0 @@
class Panel::Announcement::BackEnd::BulletinCategorySettingController < OrbitBackendController
before_filter :authenticate_user!
before_filter :for_app_manager
include AdminHelper
# layout 'admin'
def preview_and_approve
@bulletin = Bulletin.find params[:bulletin_id]
end
# def approve
#
# end
def setting
@sys_users = User.all(conditions: {admin: false})
@bulletin_categorys = []
@bulletin_categorys << BulletinCategory.find(params[:bulletin_category_id])
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
if params.has_key? :category
@bulletin_category = BulletinCategory.find params[:category][:id]
else
@bulletin_category = @bulletin_categorys.first
end
preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
object_auth = update_setting_by_params
if object_auth.save!
flash[:notice] = "Update Done"
else
flash[:notice] = "Update Failed"
end
end
def user_list
@bulletin_category = BulletinCategory.find params[:category][:id]
end
protected
def update_setting_by_params
category = BulletinCategory.find params[:category][:id]
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
object_auth = object_auth_ary.first
object_auth.privilege_users = privilege_users
object_auth
end
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end
@@ -1,25 +0,0 @@
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
<% @sys_users.each do |sys_user| -%>
<div class="checkblock">
<% sys_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 => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
<div class="check-icon">
</div>
<div class='member-avatar'>
<% if sys_user.avatar? %>
<%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
<%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
<%end -%>
</div>
<% end -%>
<% end -%>
@@ -1,2 +0,0 @@
$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
permissionCheckbox();
@@ -1 +0,0 @@
alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
@@ -1,2 +0,0 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
+1 -5
View File
@@ -21,11 +21,7 @@ Rails.application.routes.draw do
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
end
resources :bulletin_categorys do
match 'submit_setting' => "bulletin_category_setting#setting" ,:as => :setting,:via => :get
match 'submit_setting' => "bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
match 'submit_setting' => "bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
end
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
@@ -1,64 +0,0 @@
class Panel::News::BackEnd::NewsBulletinCategorySettingController < OrbitBackendController
before_filter :authenticate_user!
before_filter :for_app_manager
include AdminHelper
# layout 'admin'
# def preview_and_approve
# @bulletin = Bulletin.find params[:bulletin_id]
# end
# def approve
#
# end
def setting
@sys_users = User.all(conditions: {admin: false})
@bulletin_categorys = []
@bulletin_categorys << NewsBulletinCategory.find(params[:news_bulletin_category_id])
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
if params.has_key? :category
@bulletin_category = NewsBulletinCategory.find params[:category][:id]
else
@bulletin_category = @bulletin_categorys.first
end
preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
object_auth = update_setting_by_params
if object_auth.save!
flash[:notice] = "Update Done"
else
flash[:notice] = "Update Failed"
end
end
def user_list
@bulletin_category = NewsBulletinCategory.find params[:category][:id]
end
protected
def update_setting_by_params
category = NewsBulletinCategory.find params[:category][:id]
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
object_auth = object_auth_ary.first
object_auth.privilege_users = privilege_users
object_auth
end
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end
@@ -1,25 +0,0 @@
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
<% @sys_users.each do |sys_user| -%>
<div class="checkblock">
<% sys_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 => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
<div class="check-icon">
</div>
<div class='member-avatar'>
<% if sys_user.avatar? %>
<%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
<%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
<%end -%>
</div>
<% end -%>
<% end -%>
@@ -1,2 +0,0 @@
$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
permissionCheckbox();
@@ -1 +0,0 @@
alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
@@ -1,2 +0,0 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
+1 -5
View File
@@ -20,11 +20,7 @@ Rails.application.routes.draw do
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
end
resources :news_bulletin_categorys do
match 'submit_setting' => "news_bulletin_category_setting#setting" ,:as => :setting,:via => :get
match 'submit_setting' => "news_bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
match 'submit_setting' => "news_bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
end
resources :news_bulletin_categorys
resources :news_bulletin_links, :controller => 'news_bulletin_links' do
match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit