created file sync
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class ConfigurationFilesController < ApplicationController
|
||||
before_filter :selected_server, only: [:new, :edit]
|
||||
before_filter :selected_server, only: [:new]
|
||||
skip_before_action :verify_authenticity_token, only: [:update_by_api]
|
||||
|
||||
active_scaffold :"configuration_file" do |conf|
|
||||
conf.columns[:file_type].form_ui = :select
|
||||
@@ -11,6 +12,33 @@ class ConfigurationFilesController < ApplicationController
|
||||
end
|
||||
|
||||
def create_from_template
|
||||
template = ConfigurationTemplate.find(params[:template_id])
|
||||
template = ConfigurationTemplate.find(params[:template_id].to_i)
|
||||
file = ConfigurationFile.create_from_template!(template, params[:server_id].to_i)
|
||||
redirect_to edit_configuration_file_path(file)
|
||||
end
|
||||
|
||||
def update_by_form
|
||||
file = ConfigurationFile.find(params[:id].to_i)
|
||||
file.update_by_form(params[:content], params[:file_path])
|
||||
redirect_to edit_configuration_file_path(file)
|
||||
end
|
||||
|
||||
def update_by_api
|
||||
file = ConfigurationFile.find(params[:id].to_i)
|
||||
uploaded_file = params[:content]
|
||||
file.update_by_api(uploaded_file)
|
||||
render text: "OK"
|
||||
end
|
||||
|
||||
def content
|
||||
file = ConfigurationFile.find(params[:id].to_i)
|
||||
render text: file.last_version.content
|
||||
end
|
||||
|
||||
def destroy
|
||||
file = ConfigurationFile.find(params[:id])
|
||||
server = file.server
|
||||
file.destroy!
|
||||
redirect_to server_path(server)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user