Commit f56783e5 authored by Jacob Schatz's avatar Jacob Schatz Committed by Jacob Schatz

adds dropdown for cloning

parent 011a7a32
...@@ -91,10 +91,9 @@ ...@@ -91,10 +91,9 @@
} }
} }
.input-group { .git-clone-holder {
display: inline-table; display: inline-table;
position: relative; position: relative;
top: 17px;
} }
.project-repo-buttons { .project-repo-buttons {
...@@ -103,6 +102,7 @@ ...@@ -103,6 +102,7 @@
.count-buttons { .count-buttons {
display: block; display: block;
margin-bottom: 12px;
} }
.btn { .btn {
...@@ -187,6 +187,13 @@ ...@@ -187,6 +187,13 @@
margin-right: 45px; margin-right: 45px;
} }
.clone-options {
display: table-cell;
a.btn {
width: 100%;
}
}
.form-control { .form-control {
cursor: auto; cursor: auto;
@extend .monospace; @extend .monospace;
......
- if current_user - if current_user
= link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star has_tooltip', method: :post, remote: true, title: "Star project" do = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star has_tooltip', method: :post, remote: true, title: "Star project" do
= icon('star fw')
- if current_user.starred?(@project) - if current_user.starred?(@project)
= icon('star fw')
%span.starred Unstar %span.starred Unstar
- else - else
= icon('star-o fw')
%span Star %span Star
%div.count-with-arrow %div.count-with-arrow
%span.arrow %span.arrow
...@@ -14,16 +15,26 @@ ...@@ -14,16 +15,26 @@
$('.project-home-panel .toggle-star').on('ajax:success', function (e, data, status, xhr) { $('.project-home-panel .toggle-star').on('ajax:success', function (e, data, status, xhr) {
var $this = $(this); var $this = $(this);
var $starSpan = $this.find('span'); var $starSpan = $this.find('span');
var $starIcon = $this.find('i');
$this $this
.parent() .parent()
.find('span.count') .find('span.count')
.text(data.star_count); .text(data.star_count);
if($starSpan.hasClass('starred')){ if($starSpan.hasClass('starred')){
$starSpan.removeClass('starred'); $starSpan
$starSpan.text('Star'); .removeClass('starred')
.text('Star');
$starIcon
.removeClass('fa-star')
.addClass('fa-star-o');
} else { } else {
$starSpan.addClass('starred'); $starSpan
$starSpan.text('Unstar'); .addClass('starred')
.text('Unstar');
$starIcon
.removeClass('fa-star-o')
.addClass('fa-star');
} }
}) })
.on('ajax:error', function (e, xhr, status, error) { .on('ajax:error', function (e, xhr, status, error) {
......
- project = project || @project - project = project || @project
.git-clone-holder.input-group
.input-group-addon.git-protocols .git-clone-holder
.input-group-btn .btn-group.clone-options
= ssh_clone_button(project) %a.clone-dropdown-btn.btn{href: '#', 'data-toggle' => 'dropdown'}
.input-group-btn %span SSH
= http_clone_button(project) = icon('angle-down')
%ul.dropdown-menu.dropdown-menu-right.clone-options-dropdown
%li
%a{href: '#'}
SSH
%li
%a{href: '#'}
HTTPS
= text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control", readonly: true = text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control", readonly: true
.input-group-btn .input-group-btn
= clipboard_button(clipboard_target: '#project_clone') = clipboard_button(clipboard_target: '#project_clone')
:javascript
$('ul.clone-options-dropdown a').on('click',function(e){
e.preventDefault();
var $this = $(this);
$('a.clone-dropdown-btn span').text($this.text());
console.log("got it",$(this).text());
});
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