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
Jérome Perrin
gitlab-ce
Commits
bc59fc37
Commit
bc59fc37
authored
Jun 05, 2018
by
André Luís
Committed by
Phil Hughes
Jun 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Add Xcode Button in UI"
parent
7eb2f184
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
0 deletions
+61
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+8
-0
app/views/projects/_home_panel.html.haml
app/views/projects/_home_panel.html.haml
+4
-0
app/views/projects/buttons/_xcode_link.html.haml
app/views/projects/buttons/_xcode_link.html.haml
+2
-0
changelogs/unreleased/45820-add-xcode-link.yml
changelogs/unreleased/45820-add-xcode-link.yml
+5
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+42
-0
No files found.
app/helpers/projects_helper.rb
View file @
bc59fc37
...
...
@@ -238,6 +238,14 @@ module ProjectsHelper
"git push --set-upstream
#{
repository_url
}
/$(git rev-parse --show-toplevel | xargs basename).git $(git rev-parse --abbrev-ref HEAD)"
end
def
show_xcode_link?
(
project
=
@project
)
browser
.
platform
.
mac?
&&
project
.
repository
.
xcode_project?
end
def
xcode_uri_to_repo
(
project
=
@project
)
"xcode://clone?repo=
#{
CGI
.
escape
(
default_url_to_repo
(
project
))
}
"
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
app/views/projects/_home_panel.html.haml
View file @
bc59fc37
...
...
@@ -42,6 +42,10 @@
.project-clone-holder
=
render
"shared/clone_panel"
-
if
show_xcode_link?
(
@project
)
.project-action-button.project-xcode.inline
=
render
"projects/buttons/xcode_link"
-
if
current_user
-
if
can?
(
current_user
,
:download_code
,
@project
)
=
render
'projects/buttons/download'
,
project:
@project
,
ref:
@ref
...
...
app/views/projects/buttons/_xcode_link.html.haml
0 → 100644
View file @
bc59fc37
%a
.btn.btn-default
{
href:
xcode_uri_to_repo
(
@project
)
}
=
_
(
"Open in Xcode"
)
changelogs/unreleased/45820-add-xcode-link.yml
0 → 100644
View file @
bc59fc37
---
title
:
Add Open in Xcode link for xcode repositories
merge_request
:
author
:
type
:
added
spec/helpers/projects_helper_spec.rb
View file @
bc59fc37
...
...
@@ -435,4 +435,46 @@ describe ProjectsHelper do
expect
(
helper
.
send
(
:git_user_name
)).
to
eq
(
'John \"A\" Doe53'
)
end
end
describe
'show_xcode_link'
do
let!
(
:project
)
{
create
(
:project
)
}
let
(
:mac_ua
)
{
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36'
}
let
(
:ios_ua
)
{
'Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3'
}
context
'when the repository is xcode compatible'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:xcode_project?
).
and_return
(
true
)
end
it
'returns false if the visitor is not using macos'
do
allow
(
helper
).
to
receive
(
:browser
).
and_return
(
Browser
.
new
(
ios_ua
))
expect
(
helper
.
show_xcode_link?
(
project
)).
to
eq
(
false
)
end
it
'returns true if the visitor is using macos'
do
allow
(
helper
).
to
receive
(
:browser
).
and_return
(
Browser
.
new
(
mac_ua
))
expect
(
helper
.
show_xcode_link?
(
project
)).
to
eq
(
true
)
end
end
context
'when the repository is not xcode compatible'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:xcode_project?
).
and_return
(
false
)
end
it
'returns false if the visitor is not using macos'
do
allow
(
helper
).
to
receive
(
:browser
).
and_return
(
Browser
.
new
(
ios_ua
))
expect
(
helper
.
show_xcode_link?
(
project
)).
to
eq
(
false
)
end
it
'returns false if the visitor is using macos'
do
allow
(
helper
).
to
receive
(
:browser
).
and_return
(
Browser
.
new
(
mac_ua
))
expect
(
helper
.
show_xcode_link?
(
project
)).
to
eq
(
false
)
end
end
end
end
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