Skip to content
Snippets Groups Projects
Unverified Commit c888e73b authored by James Lopez's avatar James Lopez
Browse files

refactor methods inline

parent 73c4c995
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,6 +16,10 @@ module BlobHelper
options[:link_opts])
end
 
def ide_edit_path(project = @project, ref = @ref, path = @path, options = {})
"#{ide_path}/project#{edit_blob_path(project, ref, path, options)}"
end
def edit_blob_button(project = @project, ref = @ref, path = @path, options = {})
return unless blob = readable_blob(options, path, project, ref)
 
Loading
Loading
@@ -29,10 +33,6 @@ module BlobHelper
ref)
end
 
def display_modify_blob?(blob, project, ref)
!current_user || (current_user && can_modify_blob?(blob, project, ref))
end
def ide_edit_button(project = @project, ref = @ref, path = @path, options = {})
return unless show_new_ide?
return unless blob = readable_blob(options, path, project, ref)
Loading
Loading
@@ -42,7 +42,7 @@ module BlobHelper
edit_button_tag(blob,
common_classes,
_('Web IDE'),
"#{ide_path}/project#{edit_blob_path(project, ref, path, options)}",
ide_edit_path(project, ref, path, options),
project,
ref)
end
Loading
Loading
@@ -335,7 +335,7 @@ module BlobHelper
edit_disabled_button_tag(text, common_classes)
# This condition only applies to users who are logged in
# Web IDE (Beta) requires the user to have this feature enabled
elsif display_modify_blob?(blob, project, ref)
elsif !current_user || (current_user && can_modify_blob?(blob, project, ref))
edit_link_tag(text, edit_path, common_classes)
elsif current_user && can?(current_user, :fork_project, project)
edit_fork_button_tag(common_classes, project, text, edit_blob_fork_params(edit_path))
Loading
Loading
Loading
Loading
@@ -74,7 +74,7 @@
.tree-controls
- if show_new_ide?
= succeed " " do
= link_to "#{ide_path}/project#{edit_blob_path(@project, @id, @path, {})}", class: 'btn btn-default' do
= link_to ide_edit_path(@project, @id), class: 'btn btn-default' do
= _('Web IDE')
 
= link_to s_('Commits|History'), project_commits_path(@project, @id), class: 'btn'
Loading
Loading
Loading
Loading
@@ -74,7 +74,7 @@ describe BlobHelper do
end
end
 
describe "#edit_blob_element" do
describe "#edit_blob_link" do
let(:namespace) { create(:namespace, name: 'gitlab' )}
let(:project) { create(:project, :repository, namespace: namespace) }
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment