2012-09-17 17:49:57 +00:00
|
|
|
# Controller for viewing a file's blame
|
2013-06-23 16:47:22 +00:00
|
|
|
class Projects::BlobController < Projects::ApplicationController
|
2012-09-20 17:55:14 +00:00
|
|
|
include ExtractsPath
|
2012-09-17 17:49:57 +00:00
|
|
|
|
|
|
|
# Authorize
|
|
|
|
before_filter :authorize_read_project!
|
|
|
|
before_filter :authorize_code_access!
|
|
|
|
before_filter :require_non_empty_project
|
|
|
|
|
2013-11-19 14:14:48 +00:00
|
|
|
before_filter :blob
|
|
|
|
|
2012-09-17 17:49:57 +00:00
|
|
|
def show
|
2013-11-19 14:14:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
result = Files::DeleteContext.new(@project, current_user, params, @ref, @path).execute
|
|
|
|
|
|
|
|
if result[:status] == :success
|
2013-12-16 08:57:50 +00:00
|
|
|
flash[:notice] = "Your changes have been successfully committed"
|
2013-11-19 14:14:48 +00:00
|
|
|
redirect_to project_tree_path(@project, @ref)
|
|
|
|
else
|
|
|
|
flash[:alert] = result[:error]
|
|
|
|
render :show
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def blob
|
|
|
|
@blob ||= @repository.blob_at(@commit.id, @path)
|
|
|
|
|
|
|
|
return not_found! unless @blob
|
2013-10-01 15:26:55 +00:00
|
|
|
|
2013-11-19 14:14:48 +00:00
|
|
|
@blob
|
2012-09-17 17:49:57 +00:00
|
|
|
end
|
|
|
|
end
|