Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9f3bf824
Commit
9f3bf824
authored
May 31, 2018
by
Sam Beckham
Committed by
Phil Hughes
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Remove links from Web IDE unexpectedly navigate you to a different page"
parent
b8198897
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
148 deletions
+84
-148
app/assets/javascripts/ide/components/external_link.vue
app/assets/javascripts/ide/components/external_link.vue
+41
-0
app/assets/javascripts/ide/components/ide_file_buttons.vue
app/assets/javascripts/ide/components/ide_file_buttons.vue
+0
-84
app/assets/javascripts/ide/components/repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+3
-3
changelogs/unreleased/45520-remove-links-from-web-ide.yml
changelogs/unreleased/45520-remove-links-from-web-ide.yml
+5
-0
spec/javascripts/ide/components/external_link_spec.js
spec/javascripts/ide/components/external_link_spec.js
+35
-0
spec/javascripts/ide/components/ide_file_buttons_spec.js
spec/javascripts/ide/components/ide_file_buttons_spec.js
+0
-61
No files found.
app/assets/javascripts/ide/components/external_link.vue
0 → 100644
View file @
9f3bf824
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
export
default
{
components
:
{
Icon
,
},
props
:
{
file
:
{
type
:
Object
,
required
:
true
,
},
},
computed
:
{
showButtons
()
{
return
this
.
file
.
permalink
;
},
},
};
</
script
>
<
template
>
<div
v-if=
"showButtons"
class=
"pull-right ide-btn-group"
>
<a
:href=
"file.permalink"
target=
"_blank"
:title=
"s__('IDE|Open in file view')"
rel=
"noopener noreferrer"
>
<span
class=
"vertical-align-middle"
>
Open in file view
</span>
<icon
name=
"external-link"
css-classes=
"vertical-align-middle space-right"
:size=
"16"
/>
</a>
</div>
</
template
>
app/assets/javascripts/ide/components/ide_file_buttons.vue
deleted
100644 → 0
View file @
b8198897
<
script
>
import
{
__
}
from
'
~/locale
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
export
default
{
components
:
{
Icon
,
},
directives
:
{
tooltip
,
},
props
:
{
file
:
{
type
:
Object
,
required
:
true
,
},
},
computed
:
{
showButtons
()
{
return
(
this
.
file
.
rawPath
||
this
.
file
.
blamePath
||
this
.
file
.
commitsPath
||
this
.
file
.
permalink
);
},
rawDownloadButtonLabel
()
{
return
this
.
file
.
binary
?
__
(
'
Download
'
)
:
__
(
'
Raw
'
);
},
},
};
</
script
>
<
template
>
<div
v-if=
"showButtons"
class=
"float-right ide-btn-group"
>
<a
v-tooltip
v-if=
"!file.binary"
:href=
"file.blamePath"
:title=
"__('Blame')"
class=
"btn btn-sm btn-transparent blame"
>
<icon
name=
"blame"
:size=
"16"
/>
</a>
<a
v-tooltip
:href=
"file.commitsPath"
:title=
"__('History')"
class=
"btn btn-sm btn-transparent history"
>
<icon
name=
"history"
:size=
"16"
/>
</a>
<a
v-tooltip
:href=
"file.permalink"
:title=
"__('Permalink')"
class=
"btn btn-sm btn-transparent permalink"
>
<icon
name=
"link"
:size=
"16"
/>
</a>
<a
v-tooltip
:href=
"file.rawPath"
target=
"_blank"
class=
"btn btn-sm btn-transparent prepend-left-10 raw"
rel=
"noopener noreferrer"
:title=
"rawDownloadButtonLabel"
>
<icon
name=
"download"
:size=
"16"
/>
</a>
</div>
</
template
>
app/assets/javascripts/ide/components/repo_editor.vue
View file @
9f3bf824
...
...
@@ -6,12 +6,12 @@ import ContentViewer from '~/vue_shared/components/content_viewer/content_viewer
import
{
activityBarViews
,
viewerTypes
}
from
'
../constants
'
;
import
monacoLoader
from
'
../monaco_loader
'
;
import
Editor
from
'
../lib/editor
'
;
import
IdeFileButtons
from
'
./ide_file_buttons
.vue
'
;
import
ExternalLink
from
'
./external_link
.vue
'
;
export
default
{
components
:
{
ContentViewer
,
IdeFileButtons
,
ExternalLink
,
},
props
:
{
file
:
{
...
...
@@ -224,7 +224,7 @@ export default {
</a>
</li>
</ul>
<
ide-file-buttons
<
external-link
:file=
"file"
/>
</div>
...
...
changelogs/unreleased/45520-remove-links-from-web-ide.yml
0 → 100644
View file @
9f3bf824
---
title
:
Change the IDE file buttons for an "Open in file view" button
merge_request
:
19129
author
:
Sam Beckham
type
:
changed
spec/javascripts/ide/components/external_link_spec.js
0 → 100644
View file @
9f3bf824
import
Vue
from
'
vue
'
;
import
externalLink
from
'
~/ide/components/external_link.vue
'
;
import
createVueComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../helpers
'
;
describe
(
'
ExternalLink
'
,
()
=>
{
const
activeFile
=
file
();
let
vm
;
function
createComponent
()
{
const
ExternalLink
=
Vue
.
extend
(
externalLink
);
activeFile
.
permalink
=
'
test
'
;
return
createVueComponent
(
ExternalLink
,
{
file
:
activeFile
,
});
}
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'
renders the external link with the correct href
'
,
done
=>
{
activeFile
.
binary
=
true
;
vm
=
createComponent
();
vm
.
$nextTick
(()
=>
{
const
openLink
=
vm
.
$el
.
querySelector
(
'
a
'
);
expect
(
openLink
.
href
).
toMatch
(
`/
${
activeFile
.
permalink
}
`
);
done
();
});
});
});
spec/javascripts/ide/components/ide_file_buttons_spec.js
deleted
100644 → 0
View file @
b8198897
import
Vue
from
'
vue
'
;
import
repoFileButtons
from
'
~/ide/components/ide_file_buttons.vue
'
;
import
createVueComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../helpers
'
;
describe
(
'
RepoFileButtons
'
,
()
=>
{
const
activeFile
=
file
();
let
vm
;
function
createComponent
()
{
const
RepoFileButtons
=
Vue
.
extend
(
repoFileButtons
);
activeFile
.
rawPath
=
'
test
'
;
activeFile
.
blamePath
=
'
test
'
;
activeFile
.
commitsPath
=
'
test
'
;
return
createVueComponent
(
RepoFileButtons
,
{
file
:
activeFile
,
});
}
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'
renders Raw, Blame, History and Permalink
'
,
done
=>
{
vm
=
createComponent
();
vm
.
$nextTick
(()
=>
{
const
raw
=
vm
.
$el
.
querySelector
(
'
.raw
'
);
const
blame
=
vm
.
$el
.
querySelector
(
'
.blame
'
);
const
history
=
vm
.
$el
.
querySelector
(
'
.history
'
);
expect
(
raw
.
href
).
toMatch
(
`/
${
activeFile
.
rawPath
}
`
);
expect
(
raw
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
Raw
'
);
expect
(
blame
.
href
).
toMatch
(
`/
${
activeFile
.
blamePath
}
`
);
expect
(
blame
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
Blame
'
);
expect
(
history
.
href
).
toMatch
(
`/
${
activeFile
.
commitsPath
}
`
);
expect
(
history
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
History
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.permalink
'
).
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
Permalink
'
,
);
done
();
});
});
it
(
'
renders Download
'
,
done
=>
{
activeFile
.
binary
=
true
;
vm
=
createComponent
();
vm
.
$nextTick
(()
=>
{
const
raw
=
vm
.
$el
.
querySelector
(
'
.raw
'
);
expect
(
raw
.
href
).
toMatch
(
`/
${
activeFile
.
rawPath
}
`
);
expect
(
raw
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
Download
'
);
done
();
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment