Commit e9b28a28 authored by Phil Hughes's avatar Phil Hughes

Makes the Web IDE the default editor

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/42382
parent b0097199
...@@ -31,12 +31,13 @@ module BlobHelper ...@@ -31,12 +31,13 @@ module BlobHelper
edit_button_tag(blob, edit_button_tag(blob,
common_classes, common_classes,
_('Edit'), _('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, project,
ref) ref)
end end
def ide_edit_button(project = @project, ref = @ref, path = @path, options = {}) 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) return unless blob = readable_blob(options, path, project, ref)
edit_button_tag(blob, 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 ...@@ -9,6 +9,10 @@ describe 'Editing file blob', :js do
let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] } let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] }
let(:readme_file_path) { 'README.md' } let(:readme_file_path) { 'README.md' }
before do
stub_feature_flags(web_ide_default: false)
end
context 'as a developer' do context 'as a developer' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:role) { :developer } let(:role) { :developer }
......
...@@ -12,6 +12,8 @@ describe 'Projects > Files > User creates files' do ...@@ -12,6 +12,8 @@ describe 'Projects > Files > User creates files' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(web_ide_default: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
end end
......
...@@ -9,6 +9,8 @@ describe 'Projects > Files > User edits files', :js do ...@@ -9,6 +9,8 @@ describe 'Projects > Files > User edits files', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(web_ide_default: false)
sign_in(user) sign_in(user)
end end
......
...@@ -50,12 +50,20 @@ describe BlobHelper do ...@@ -50,12 +50,20 @@ describe BlobHelper do
end end
it 'returns a link with the proper route' do it 'returns a link with the proper route' do
stub_feature_flags(web_ide_default: false)
link = edit_blob_button(project, 'master', 'README.md') 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") expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md")
end 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 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 }) 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") 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