diff options
Diffstat (limited to 'app/controllers/projects/blob_controller.rb')
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 77672e7d9fc..0fc343336cc 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -55,7 +55,7 @@ class Projects::BlobController < Projects::ApplicationController if can_collaborate_with_project?(project, ref: @ref) blob.load_all_data! else - redirect_to action: 'show' + redirect_to action: "show" end end @@ -72,7 +72,7 @@ class Projects::BlobController < Projects::ApplicationController def preview @content = params[:content] @blob.load_all_data! - diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3', include_diff_info: true) + diffy = Diffy::Diff.new(@blob.data, @content, diff: "-U 3", include_diff_info: true) diff_lines = diffy.diff.scan(/.*\n/)[2..-1] diff_lines = Gitlab::Diff::Parser.new.parse(diff_lines) @diff_lines = Gitlab::Diff::Highlight.new(diff_lines, repository: @repository).highlight @@ -98,10 +98,10 @@ class Projects::BlobController < Projects::ApplicationController @lines = @lines[@form.since - 1..@form.to - 1].map(&:html_safe) if @form.bottom? - @match_line = '' + @match_line = "" else lines_length = @lines.length - 1 - line = [@form.since, lines_length].join(',') + line = [@form.since, lines_length].join(",") @match_line = "@@ -#{line}+#{line} @@" end @@ -144,7 +144,7 @@ class Projects::BlobController < Projects::ApplicationController # Match line is not needed when it reaches the top limit or bottom limit of the file. return unless new_pos - @match_line = Gitlab::Diff::Line.new(@match_line, 'match', nil, old_pos, new_pos) + @match_line = Gitlab::Diff::Line.new(@match_line, "match", nil, old_pos, new_pos) @form.bottom? ? @lines.push(@match_line) : @lines.unshift(@match_line) end @@ -203,7 +203,7 @@ class Projects::BlobController < Projects::ApplicationController @branch_name = params[:branch_name] @file_path = - if action_name.to_s == 'create' + if action_name.to_s == "create" if params[:file].present? params[:file_name] = params[:file].original_filename end @@ -217,7 +217,7 @@ class Projects::BlobController < Projects::ApplicationController if params[:file].present? params[:content] = Base64.encode64(params[:file].read) - params[:encoding] = 'base64' + params[:encoding] = "base64" end @commit_params = { @@ -226,7 +226,7 @@ class Projects::BlobController < Projects::ApplicationController previous_path: @path, file_content: params[:content], file_content_encoding: params[:encoding], - last_commit_sha: params[:last_commit_sha] + last_commit_sha: params[:last_commit_sha], } end @@ -242,11 +242,11 @@ class Projects::BlobController < Projects::ApplicationController end def show_html - environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit } + environment_params = @repository.branch_exists?(@ref) ? {ref: @ref} : {commit: @commit} @environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last @last_commit = @repository.last_commit_for_path(@commit.id, @blob.path) - render 'show' + render "show" end def show_json @@ -269,15 +269,15 @@ class Projects::BlobController < Projects::ApplicationController blame_path: project_blame_path(project, @id), commits_path: project_commits_path(project, @id), tree_path: project_tree_path(project, File.join(@ref, tree_path)), - permalink: project_blob_path(project, File.join(@commit.id, @path)) + permalink: project_blob_path(project, File.join(@commit.id, @path)), } - json.merge!(blob_json(@blob) || {}) unless params[:viewer] == 'none' + json.merge!(blob_json(@blob) || {}) unless params[:viewer] == "none" render json: json end def tree_path - @path.rpartition('/').first + @path.rpartition("/").first end end |