62 lines
1.4 KiB
Ruby
62 lines
1.4 KiB
Ruby
|
class Admin::CustomizationLogsController < OrbitAdminController
|
||
|
before_action ->(module_app = @app_title) { set_variables module_app }
|
||
|
|
||
|
def initialize
|
||
|
super
|
||
|
@app_title = "registered_site"
|
||
|
end
|
||
|
|
||
|
def index
|
||
|
@registeredsites = RegisteredSite.all.order_by(sort)
|
||
|
.with_categories(filters("category"))
|
||
|
.with_tags(filters("tag"))
|
||
|
@table_fields = table_fields
|
||
|
@tags = @module_app.tags
|
||
|
@categories = @module_app.categories.enabled
|
||
|
@filter_fields = filter_fields_without_status(@categories, @tags)
|
||
|
@registeredsites = search_data(@registeredsites,[:title]).page(params[:page]).per(10)
|
||
|
if request.xhr?
|
||
|
render :partial => "index"
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def get_log
|
||
|
@site = RegisteredSite.find(params[:id])
|
||
|
@logs = @site.site_logs.desc(:created_at)
|
||
|
render :layout => false
|
||
|
end
|
||
|
|
||
|
def new
|
||
|
@log = SiteLog.new
|
||
|
@site = RegisteredSite.find(params[:id])
|
||
|
end
|
||
|
|
||
|
def update
|
||
|
log = SiteLog.find(params[:id])
|
||
|
log.update_attributes(site_log_params)
|
||
|
log.save
|
||
|
redirect_to params['referer_url']
|
||
|
end
|
||
|
|
||
|
def edit
|
||
|
@log = SiteLog.find(params[:id])
|
||
|
@site = @log.registered_site
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
log = SiteLog.new
|
||
|
log.update_attributes(site_log_params)
|
||
|
log.save
|
||
|
redirect_to params['referer_url']
|
||
|
end
|
||
|
|
||
|
private
|
||
|
def table_fields
|
||
|
[:domain, :category, :tags, :actions]
|
||
|
end
|
||
|
|
||
|
def site_log_params
|
||
|
params.require(:site_log).permit!
|
||
|
end
|
||
|
|
||
|
end
|