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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
af65046c
Commit
af65046c
authored
Nov 22, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move HTTP/SSH clone button logic to helpers
parent
0fb5ffd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
16 deletions
+37
-16
app/helpers/button_helper.rb
app/helpers/button_helper.rb
+35
-0
app/views/shared/_clone_panel.html.haml
app/views/shared/_clone_panel.html.haml
+2
-16
No files found.
app/helpers/button_helper.rb
0 → 100644
View file @
af65046c
module
ButtonHelper
def
http_clone_button
(
project
)
klass
=
'btn'
klass
<<
' active'
if
default_clone_protocol
==
'http'
klass
<<
' has_tooltip'
if
current_user
.
try
(
:require_password?
)
protocol
=
gitlab_config
.
protocol
.
upcase
content_tag
:button
,
protocol
,
class:
klass
,
data:
{
clone:
project
.
http_url_to_repo
,
container:
'body'
,
html:
'true'
,
title:
"Set a password on your account<br>to pull or push via
#{
protocol
}
"
},
type: :button
end
def
ssh_clone_button
(
project
)
klass
=
'btn'
klass
<<
' active'
if
default_clone_protocol
==
'ssh'
klass
<<
' has_tooltip'
if
current_user
.
try
(
:require_ssh_key?
)
content_tag
:button
,
'SSH'
,
class:
klass
,
data:
{
clone:
project
.
ssh_url_to_repo
,
container:
'body'
,
html:
'true'
,
title:
'Add an SSH key to your profile<br>to pull or push via SSH.'
},
type: :button
end
end
app/views/shared/_clone_panel.html.haml
View file @
af65046c
...
...
@@ -2,23 +2,9 @@
.git-clone-holder.input-group
.input-group-addon.git-protocols
.input-group-btn
%button
{
|
type:
'button'
,
|
class:
"btn #{ 'active' if default_clone_protocol == 'ssh' }#{ ' has_tooltip' if current_user && current_user.require_ssh_key? }"
,
|
:"data-clone"
=>
project
.
ssh_url_to_repo
,
|
:"data-title"
=>
"Add an SSH key to your profile<br> to pull or push via SSH."
,
:"data-html"
=>
"true"
,
:"data-container"
=>
"body"
}
SSH
=
ssh_clone_button
(
project
)
.input-group-btn
%button
{
|
type:
'button'
,
|
class:
"btn #{ 'active' if default_clone_protocol == 'http' }#{ ' has_tooltip' if current_user && current_user.require_password? }"
,
|
:"data-clone"
=>
project
.
http_url_to_repo
,
|
:"data-title"
=>
"Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}."
,
:"data-html"
=>
"true"
,
:"data-container"
=>
"body"
}
=
gitlab_config
.
protocol
.
upcase
=
http_clone_button
(
project
)
=
text_field_tag
:project_clone
,
default_url_to_repo
(
project
),
class:
"js-select-on-focus form-control"
,
readonly:
true
-
if
project
.
kind_of?
(
Project
)
.input-group-addon.has_tooltip
{
title:
"#{visibility_level_label(project.visibility_level)} project"
,
data:
{
container:
"body"
}
}
...
...
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