debian-mirror-gitlab/app/controllers/projects/static_site_editor_controller.rb

42 lines
929 B
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
class Projects::StaticSiteEditorController < Projects::ApplicationController
include ExtractsPath
include CreatesCommit
layout 'fullscreen'
prepend_before_action :authenticate_user!, only: [:show]
before_action :assign_ref_and_path, only: [:show]
before_action :authorize_edit_tree!, only: [:show]
2020-07-28 23:09:34 +05:30
before_action do
push_frontend_feature_flag(:sse_image_uploads)
end
2020-04-22 19:07:51 +05:30
def show
2020-11-24 15:15:51 +05:30
service_response = ::StaticSiteEditor::ConfigService.new(
container: project,
current_user: current_user,
params: {
ref: @ref,
path: @path,
return_url: params[:return_url]
}
).execute
if service_response.success?
@data = service_response.payload
else
respond_422
end
2020-04-22 19:07:51 +05:30
end
private
def assign_ref_and_path
2020-11-24 15:15:51 +05:30
@ref, @path = extract_ref(params.fetch(:id))
2020-04-22 19:07:51 +05:30
render_404 if @ref.blank? || @path.blank?
end
end