diff --git a/app/assets/javascripts/.DS_Store b/app/assets/javascripts/.DS_Store index 51582ef8..9134f2a5 100644 Binary files a/app/assets/javascripts/.DS_Store and b/app/assets/javascripts/.DS_Store differ diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js deleted file mode 100644 index 70507fc6..00000000 --- a/app/assets/javascripts/inc/search.js +++ /dev/null @@ -1,34 +0,0 @@ -// JavaScript Document - -// can copy code to any of ur desired javascsript - -//extended jquery to search fast. -$.extend($.expr[':'], { - 'containsi': function (elem, i, match, array) { - return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; - } -}); -var interval,sval; -$(document).ready(function(){ - $("#user_filter").keyup(function(){ - sval = $(this).val(); - $(".checkbox").popover("hide"); - $("div.checkblock").hide(); - clearInterval(interval); - interval = setInterval(waitForSearch,1000); - }) -}) -var waitForSearch = function(){ - if(sval){ - var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length - if(totalfoundbyname!=0){ - $("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show(); - }else if(totalfoundbyname==0){ - $("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show(); - } - }else{ - $(".checkbox").popover('hide'); - $("div.checkblock").show(); - } - clearInterval(interval); -} \ No newline at end of file diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index e44be291..c6a8d2b2 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -17,6 +17,10 @@ class Admin::ModuleAppsController < ApplicationController end end + def module_auth_proc + @module_app = ModuleApp.find(params[:id]) + end + def edit @module_app = ModuleApp.find(params[:id]) end diff --git a/app/controllers/admin/new_interface_module_apps_controller.rb b/app/controllers/admin/new_interface_module_apps_controller.rb new file mode 100644 index 00000000..6603334c --- /dev/null +++ b/app/controllers/admin/new_interface_module_apps_controller.rb @@ -0,0 +1,66 @@ +class Admin::NewInterfaceModuleAppsController < ApplicationController + before_filter :authenticate_user! + before_filter :is_admin? + include AdminHelper + + layout "new_admin" + + def setting + @sys_users = User.all + @module_app = ModuleApp.find(params[:module_app_id]) + @options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] } + # if params.has_key? :category + # @bulletin_category = BulletinCategory.find params[:category][:id] + # else + # @bulletin_category = @bulletin_categorys.first + # end + @users_array = @module_app.managing_users rescue [] + + respond_to do |format| + format.html + format.js + end + end + + def update_setting + module_app = update_setting_by_params + if module_app.save! + flash[:notice] = "Update Done" + else + flash[:notice] = "Update Failed" + end + end + + def user_list + @module_app = ModuleApp.find params[:module_app][:id] + end + + protected + def update_setting_by_params + ma = ModuleApp.find params[:module_app][:id] + user_sat = User.find params[:users].keys + users_to_new = user_sat - ma.managing_users + users_to_remove = ma.managing_users - user_sat + + users_to_new.each do |new_user| + ma.assign_manager(new_user,current_user) + end + + users_to_remove.each do |remove_user| + ma.remove_manager(remove_user) + end + ma + 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 \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 74d3e662..844fbe14 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -68,9 +68,9 @@ module ApplicationHelper end end - def active_sys_call_for_app(controller_name,action_name,app_title) + def active_sys_call_for_app(controller_name,action_name,app_title,field = :id) unless active_for_action(controller_name,action_name).nil? - app = ModuleApp.find params[:id] + app = ModuleApp.find params[field] app.title == app_title ? 'active' : nil else nil diff --git a/app/views/admin/new_interface_module_apps/_modal_list.html.erb b/app/views/admin/new_interface_module_apps/_modal_list.html.erb new file mode 100644 index 00000000..b5b0ebcd --- /dev/null +++ b/app/views/admin/new_interface_module_apps/_modal_list.html.erb @@ -0,0 +1,42 @@ +<% if module_app -%> + +