Skip to content

Commit 4950f15

Browse files
author
root
committed
Add icons, fix css
1 parent 332ce2b commit 4950f15

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

app/helpers/extend_repositories_helper.rb

+10
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,14 @@ def link_to_repository(repo, current_repo)
4545
class: css_class
4646
end
4747

48+
49+
def icon_for_url_type(url_type)
50+
fa_icon RepositoryGitExtra::URLS_ICONS[url_type][:icon]
51+
end
52+
53+
54+
def label_for_url_type(url_type)
55+
RepositoryGitExtra::URLS_ICONS[url_type][:label]
56+
end
57+
4858
end

app/models/repository_git_extra.rb

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ class RepositoryGitExtra < ActiveRecord::Base
1515

1616
ALLOWED_URLS = %w[ssh http https go git git_annex]
1717

18+
URLS_ICONS = {
19+
go: {label: 'Go', icon: 'fa-google'},
20+
http: {label: 'HTTP', icon: 'fa-external-link'},
21+
https: {label: 'HTTPS', icon: 'fa-external-link'},
22+
ssh: {label: 'SSH', icon: 'fa-shield'},
23+
git: {label: 'Git', icon: 'fa-git'}
24+
}
25+
1826
## Attributes
1927
attr_accessible :git_http, :git_daemon, :git_notify, :git_annex, :default_branch, :protected_branch, :public_repo, :key, :urls_order
2028

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#sortable-url-messages
22

3-
%ul{ id: 'sortable-url', data: { 'update-url' => sort_urls_repository_git_extras_path(@repository), remote: true } }
4-
- @repository.available_urls_sorted.keys.each do |url|
5-
%li{ id: "repository_git_extra_#{url}" }= url
3+
%ul{ id: 'sortable-url', data: { 'update-url' => sort_urls_repository_git_extras_path(@repository), remote: 'true' }, class: 'list-unstyled' }
4+
- @repository.available_urls_sorted.keys.each do |url_type|
5+
%li{ id: "repository_git_extra_#{url_type}", class: 'url_type draggable' }
6+
= icon_for_url_type(url_type)
7+
%span= label_for_url_type(url_type)
68

79
:javascript
810
$(document).ready(function() { setSortableElement('#sortable-url', '#sortable-url'); });

assets/stylesheets/application.css

+9
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,12 @@ STATISTICS
256256
.repository-urls {
257257
margin-top: 15px;
258258
}
259+
260+
li.url_type {
261+
margin: 10px;
262+
padding: 5px;
263+
}
264+
265+
.draggable {
266+
cursor: move;
267+
}

0 commit comments

Comments
 (0)