diff --git a/app/assets/images/ajax-loader.gif b/app/assets/images/ajax-loader.gif new file mode 100644 index 00000000..5f117fd8 Binary files /dev/null and b/app/assets/images/ajax-loader.gif differ diff --git a/app/assets/javascripts/inc/ajax_setting.js b/app/assets/javascripts/inc/ajax_setting.js new file mode 100644 index 00000000..18d0da33 --- /dev/null +++ b/app/assets/javascripts/inc/ajax_setting.js @@ -0,0 +1,14 @@ +// $.ready(function(){ +// $('body').bind("ajaxSend", function(){ +// $('
').appendTo('body'); +// }).bind("ajaxComplete", function(){ +// $('body > div.modal-backdrop').hide().remove(); +// }); +// }); +jQuery(document).ajaxStart(function(){ + $('').appendTo('body'); +}); + +jQuery(document).ajaxComplete(function(){ + $("#sys_modal").hide().remove(); +}); diff --git a/app/views/layouts/new_admin.html.erb b/app/views/layouts/new_admin.html.erb index 3a493a9d..873b9f14 100644 --- a/app/views/layouts/new_admin.html.erb +++ b/app/views/layouts/new_admin.html.erb @@ -9,6 +9,7 @@ <%= stylesheet_link_tag "new_admin" %> <%= javascript_include_tag "new_admin" %> + <%= javascript_include_tag "inc/ajax_setting" %> <%= yield :page_specific_css %> <%= yield :page_specific_javascript %> <%= csrf_meta_tag %> diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb index 0177cd12..cf966b24 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb @@ -20,7 +20,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle else @bulletin_category = @bulletin_categorys.first end - preload_object_auth = @bulletin_category.object_auths.where(title: 'fact_check').empty?? (@bulletin_category.object_auths.create! :title=> 'fact_check') : @bulletin_category.object_auths.where(title: 'fact_check') + preload_object_auth = @bulletin_category.get_object_auth_by_title('fact_check') @users_array = preload_object_auth.first.privilege_users rescue [] respond_to do |format| format.html diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb index 20a3d3eb..e9552141 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb @@ -4,7 +4,7 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController include AdminHelper def preview_and_approve - @news_bulletin = NewsBulletin.find params[:news_bulletin_id] + @news_bulletin = NewsBulletin.find params[:news_category][:id] end def approve @@ -14,19 +14,13 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController def setting @sys_users = User.all(conditions: {admin: false}) @news_bulletin_categorys = NewsBulletinCategory.all - if params.has_key?(:category_id) - first_category = NewsBulletinCategory.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 + @options_from_collection_for_select_news_bulletin_categorys = @news_bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] } + if params.has_key? :news_category + @news_bulletin_categorys = NewsBulletinCategory.find params[:news_category][:id] else - first_category = @news_bulletin_categorys.first + @news_bulletin_categorys = @news_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') + preload_object_auth = @news_bulletin_categorys.get_object_auth_by_title('fact_check') @users_array = preload_object_auth.first.privilege_users rescue [] respond_to do |format| format.html @@ -44,12 +38,12 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController end def user_list - @news_bulletin_category = NewsBulletinCategory.find params[:category_id] + @news_bulletin_category = NewsBulletinCategory.find params[:news_category][:id] end protected def update_setting_by_params - category = NewsBulletinCategory.find params[:category_id] + category = NewsBulletinCategory.find params[:news_category][:id] privilege_users = params[:users].collect{|key,value| User.find key } rescue [] object_auth_ary = category.object_auths.where(title: 'fact_check') || (category.object_auths.create :title=> 'fact_check') object_auth = object_auth_ary.first diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb index f611154d..7b8211b4 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb @@ -13,7 +13,7 @@