This commit is contained in:
BoHung Chiu 2021-04-12 14:39:11 +08:00
parent 9d06684ed9
commit 5cd65d997f
2 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,11 @@ class Admin::RulingTemplatesController < OrbitAdminController
FileUtils.remove_dir(directory)
render :json => {"psd_id" => psd.id.to_s, "path" => psd.psd_zip.path}.to_json
end
def destroy
template = RTemplate.find(params[:id])
template.destroy
redirect_to :back
end
private
def template_params

View File

@ -2,7 +2,7 @@ class RulingTemplatesController < ApplicationController
def index
store_token = params[:store_token]
site_domain = RegisteredSite.find_by(:uid => store_token).site_domain.sub(/(?:(?!\.).)*\./,'') rescue ''
templates = RTemplate.where(allow_domain: site_domain,:git_url.ne=> '').asc(:updated_at).collect do |v|
templates = RTemplate.where(:allow_domain.in => [site_domain,'',nil]).asc(:updated_at).collect do |v|
{
'install_flag' => v.installed_site_tokens.include?(store_token),
'uid' => v.uid,