From 957917968591ecfadff31186bafd5829c315d05c Mon Sep 17 00:00:00 2001 From: Bohung Date: Thu, 30 Jun 2022 12:17:47 +0800 Subject: [PATCH] Add some search input. --- app/controllers/admin/admin_modules_controller.rb | 4 +++- app/views/admin/admin_modules/index.html.erb | 3 ++- .../admin/admin_modules/install_site_list.html.erb | 13 ++++++++++++- .../admin_modules/uninstall_site_list.html.erb | 13 ++++++++++++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/admin_modules_controller.rb b/app/controllers/admin/admin_modules_controller.rb index 4337dbc..2962ab4 100644 --- a/app/controllers/admin/admin_modules_controller.rb +++ b/app/controllers/admin/admin_modules_controller.rb @@ -6,8 +6,10 @@ class Admin::AdminModulesController < OrbitAdminController end def index - @registered_modules = RegisteredModule.where(:completed => true).page(params[:page]).per(10) + @filter_fields = {} + @registered_modules = RegisteredModule.where(:completed => true) @table_fields = table_fields + @registered_modules = search_data(@registered_modules,[:name, :module_key]).page(params[:page]).per(10) if request.xhr? render :partial => "index" end diff --git a/app/views/admin/admin_modules/index.html.erb b/app/views/admin/admin_modules/index.html.erb index 6dd49f4..62590d1 100644 --- a/app/views/admin/admin_modules/index.html.erb +++ b/app/views/admin/admin_modules/index.html.erb @@ -1,4 +1,5 @@ <%= javascript_include_tag "plugin/jquery.form.min" %> +<%= render_filter @filter_fields, "index_table" %> <%= render 'index'%> @@ -64,7 +65,7 @@ var actionsModal = $("#actionsModal"); var btn_type = null; var module_id = null; - $(".action-btns").on("click",function(){ + $(document).on("click", ".action-btns", function(){ btn_type = $(this).attr("for"); module_id = $(this).data("id"); $.ajax({ diff --git a/app/views/admin/admin_modules/install_site_list.html.erb b/app/views/admin/admin_modules/install_site_list.html.erb index 0cac3b3..13e0a14 100644 --- a/app/views/admin/admin_modules/install_site_list.html.erb +++ b/app/views/admin/admin_modules/install_site_list.html.erb @@ -2,11 +2,22 @@ <% if @registered_sites.blank? %> Sorry no sites active or all the websites already have this module. <% else %> + <% @registered_sites.each do |rs|%> -