diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_category_setting_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_category_setting_controller.rb
new file mode 100644
index 00000000..6b92195f
--- /dev/null
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_category_setting_controller.rb
@@ -0,0 +1,63 @@
+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
+ @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
diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
index 8ad75108..51cbadcf 100644
--- a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
+++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
@@ -2,13 +2,16 @@ module Panel::News::BackEnd::NewsBulletinCategorysHelper
include ActionView::Helpers::UrlHelper
- def show_submit_permission_link(news_bulletin_category)
- oa = news_bulletin_category.get_object_auth_by_title('submit')
+ def show_permission_link(news_bulletin_category)
+ type = 'submit'
+ oa = news_bulletin_category.get_object_auth_by_title(type)
if oa.nil?
- news_bulletin_category.object_auths.new(title: 'submit' ).save
- oa = news_bulletin_category.get_object_auth_by_title('submit')
+ news_bulletin_category.object_auths.new(title: type ).save
+ oa = news_bulletin_category.get_object_auth_by_title(type)
end
- link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
+# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
+link_to t('announcement.bulletin.cate_auth'),panel_news_back_end_news_bulletin_category_setting_path(news_bulletin_category)
+
end
end
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_modal_list.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_modal_list.html.erb
new file mode 100644
index 00000000..a73fdab2
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_modal_list.html.erb
@@ -0,0 +1,44 @@
+<% if bulletin_category -%>
+
+
+
+
+
+ <% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %>
+
+
+ <% if user.avatar? %>
+ <%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
+
+ <% end -%>
+
+
+
+
+
+
+
+
+
+
+
+<% end -%>
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_privilege_user.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_privilege_user.html.erb
new file mode 100644
index 00000000..c36941de
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_privilege_user.html.erb
@@ -0,0 +1,26 @@
+<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
+<% sys_users = User.all -%>
+ <% sys_users.each do |sys_user| -%>
+
+
+
+ <% sys_user.sub_roles.each do |sr| %>
+
<%= sr.key %>
+ <% 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 %>
+
+
+
+ <% if sys_user.avatar? %>
+ <%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= 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 -%>
+
+
+ <% end -%>
+<% end -%>
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.html.erb
new file mode 100644
index 00000000..618f7825
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.html.erb
@@ -0,0 +1,56 @@
+<% content_for :page_specific_css do %>
+ <%= stylesheet_link_tag "inc/permission-checkbox" %>
+<% end %>
+<% content_for :page_specific_javascript do %>
+ <%= javascript_include_tag "inc/permission-checkbox" %>
+ <%= javascript_include_tag "inc/search" %>
+ <%= javascript_include_tag "inc/modal-preview" %>
+<% end %>
+<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
+<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
+
+
+ -
+
+ <%= label_tag :category, t("announcement.bulletin.category") %>
+ <%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
+ <%= search_field_tag 'user_filter' %>
+
+
+
+
+ <%= link_to t("announcement.bulletin.approval_user_list"), panel_news_back_end_news_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
+
+
+<%#= label_tag :role, t("admin.roles") %>
+
+<%= content_tag :div do -%>
+ <% form_tag panel_news_back_end_news_bulletin_category_setting_path do %>
+ <%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
+
+ <% end -%>
+<% end -%>
+
+
+
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.js.erb
new file mode 100644
index 00000000..0ca148da
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.js.erb
@@ -0,0 +1,2 @@
+$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
+permissionCheckbox();
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/update_setting.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/update_setting.js.erb
new file mode 100644
index 00000000..7486000a
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/update_setting.js.erb
@@ -0,0 +1 @@
+alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/user_list.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/user_list.js.erb
new file mode 100644
index 00000000..4c8bf25d
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/user_list.js.erb
@@ -0,0 +1,2 @@
+$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
+var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
index 377091bd..7c16678a 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
@@ -5,7 +5,7 @@
<%if is_manager? || is_admin? %>
- - <%= show_submit_permission_link(news_bulletin_category) %>
+ - <%= show_permission_link(news_bulletin_category) %>
<% end %>
<% if is_admin?%>
- <%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %>
diff --git a/vendor/built_in_modules/news/config/routes.rb b/vendor/built_in_modules/news/config/routes.rb
index b7882d2d..ccefcf38 100644
--- a/vendor/built_in_modules/news/config/routes.rb
+++ b/vendor/built_in_modules/news/config/routes.rb
@@ -20,7 +20,11 @@ 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
+ 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_links, :controller => 'news_bulletin_links' do
match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit