diff --git a/app/controllers/admin/site_panel_controller.rb b/app/controllers/admin/site_panel_controller.rb index 1848dbd..795392c 100644 --- a/app/controllers/admin/site_panel_controller.rb +++ b/app/controllers/admin/site_panel_controller.rb @@ -79,13 +79,32 @@ class Admin::SitePanelController < OrbitAdminController path = site_construct.path site_construct_id = params[:id] Thread.new do - puts site_construct_id system("rake create_site:create_site['#{git_user}','#{git_password}','#{git_url}','#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}']") end render :json =>{"success"=>true} end + def edit_site + if params[:type] == 'delete' + Thread.new do + system("rake create_site:delete_site[#{params[:id]}]") + end + elsif params[:type] == 'close' + Thread.new do + system("rake create_site:exec_commands[#{params[:id]},,close_site]") + end + elsif params[:type] == 'open' + Thread.new do + system("rake create_site:exec_commands[#{params[:id]},,open_site]") + end + else + Thread.new do + system("rake create_site:exec_commands[#{params[:id]},'#{params[:commands]}',open_site]") + end + end + render :json =>{"success"=>true} + end def sites_list - @sites = SiteConstruct.all.desc(:id) + @sites = SiteConstruct.all.desc(:id).page(params[:page].to_i).per(10) end def site_infos site_construct = SiteConstruct.where(:id=>params[:id]).first diff --git a/app/models/site_construct.rb b/app/models/site_construct.rb index cbe4f02..e66a0d4 100644 --- a/app/models/site_construct.rb +++ b/app/models/site_construct.rb @@ -17,4 +17,14 @@ class SiteConstruct field :constructed, type: Boolean, :default => false field :status, type: String, :default => "" field :infos, type: Array, :default => [] + after_initialize do |record| + if record.status.nil? + record.status = "" + record.save + end + if record.infos.nil? + record.infos = [] + record.save + end + end end \ No newline at end of file diff --git a/app/views/admin/site_panel/sites_list.html.erb b/app/views/admin/site_panel/sites_list.html.erb index 524958c..49b5721 100644 --- a/app/views/admin/site_panel/sites_list.html.erb +++ b/app/views/admin/site_panel/sites_list.html.erb @@ -1,3 +1,5 @@ +<%= javascript_include_tag "lib/jquery-ui-1.12.1/jquery-ui" %> +<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui" %> <% if !params[:id].blank? %>