Commit 079d471e authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'web-ide-default-editor' into 'master'

Makes the Web IDE the default editor

Closes #42382

See merge request gitlab-org/gitlab-ce!25171
parents 2dcbc0fa e9b28a28
......@@ -31,12 +31,13 @@ module BlobHelper
edit_button_tag(blob,
common_classes,
_('Edit'),
edit_blob_path(project, ref, path, options),
Feature.enabled?(:web_ide_default) ? ide_edit_path(project, ref, path, options) : edit_blob_path(project, ref, path, options),
project,
ref)
end
def ide_edit_button(project = @project, ref = @ref, path = @path, options = {})
return unless Feature.enabled?(:web_ide_default)
return unless blob = readable_blob(options, path, project, ref)
edit_button_tag(blob,
......
---
title: Make the Web IDE the default editor
merge_request:
author:
type: added
......@@ -9,6 +9,10 @@ describe 'Editing file blob', :js do
let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] }
let(:readme_file_path) { 'README.md' }
before do
stub_feature_flags(web_ide_default: false)
end
context 'as a developer' do
let(:user) { create(:user) }
let(:role) { :developer }
......
......@@ -12,6 +12,8 @@ describe 'Projects > Files > User creates files' do
let(:user) { create(:user) }
before do
stub_feature_flags(web_ide_default: false)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -9,6 +9,8 @@ describe 'Projects > Files > User edits files', :js do
let(:user) { create(:user) }
before do
stub_feature_flags(web_ide_default: false)
sign_in(user)
end
......
......@@ -50,12 +50,20 @@ describe BlobHelper do
end
it 'returns a link with the proper route' do
stub_feature_flags(web_ide_default: false)
link = edit_blob_button(project, 'master', 'README.md')
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md")
end
it 'returns a link with a Web IDE route' do
link = edit_blob_button(project, 'master', 'README.md')
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/-/ide/project/#{project.full_path}/edit/master/-/README.md")
end
it 'returns a link with the passed link_opts on the expected route' do
stub_feature_flags(web_ide_default: false)
link = edit_blob_button(project, 'master', 'README.md', link_opts: { mr_id: 10 })
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md?mr_id=10")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment