mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +01:00
License page: suggest the license to a repository
This commit is contained in:
parent
3e59b04824
commit
8f177d9c77
@ -19,6 +19,7 @@
|
|||||||
<script src="/assets/vendor/jquery/jquery.min.js"></script>
|
<script src="/assets/vendor/jquery/jquery.min.js"></script>
|
||||||
<script src="/assets/vendor/qtip2/jquery.qtip.min.js"></script>
|
<script src="/assets/vendor/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script src="/assets/vendor/clipboard/dist/clipboard.min.js"></script>
|
<script src="/assets/vendor/clipboard/dist/clipboard.min.js"></script>
|
||||||
|
<script src="/assets/vendor/javascript-auto-complete/auto-complete.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.annotations = {{ site.data.rules | jsonify }};
|
window.annotations = {{ site.data.rules | jsonify }};
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Chivo:900">
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Chivo:900">
|
||||||
<link rel="stylesheet" href="/assets/css/application.css?v={{ site.github.build_revision }}">
|
<link rel="stylesheet" href="/assets/css/application.css?v={{ site.github.build_revision }}">
|
||||||
|
<link rel="stylesheet" href="/assets/vendor/javascript-auto-complete/auto-complete.css">
|
||||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="/assets/vendor/html5shiv/dist/html5shiv.js"></script>
|
<script src="/assets/vendor/html5shiv/dist/html5shiv.js"></script>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
|
|
||||||
<a href="#" data-clipboard-target="#license-text" data-proofer-ignore="true" class="js-clipboard-button button">Copy license text to clipboard</a>
|
<a href="#" data-clipboard-target="#license-text" data-proofer-ignore="true" class="js-clipboard-button button">Copy license text to clipboard</a>
|
||||||
|
<h3>Suggest this license</h3>
|
||||||
|
<input type="text" data-license-id="{{ page.spdx-id }}" placeholder="Type a project name" id="reposiory-search" />
|
||||||
|
|
||||||
<div class="how-to-apply">
|
<div class="how-to-apply">
|
||||||
<h3>How to apply this license</h3>
|
<h3>How to apply this license</h3>
|
||||||
|
@ -294,6 +294,11 @@ strong {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar input#reposiory-search {
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.note {
|
.note {
|
||||||
color: #687072;
|
color: #687072;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class Choosealicense
|
|||||||
constructor: ->
|
constructor: ->
|
||||||
@initTooltips()
|
@initTooltips()
|
||||||
@initClipboard()
|
@initClipboard()
|
||||||
|
@initAutocomplete()
|
||||||
|
|
||||||
# Init tooltip action
|
# Init tooltip action
|
||||||
initTooltips: ->
|
initTooltips: ->
|
||||||
@ -71,5 +72,25 @@ class Choosealicense
|
|||||||
clipboardComplete: (client, args) ->
|
clipboardComplete: (client, args) ->
|
||||||
@textContent = "Copied!"
|
@textContent = "Copied!"
|
||||||
|
|
||||||
|
# Initializes JavaScript-autoComplete plugin
|
||||||
|
initAutocomplete: ->
|
||||||
|
new autoComplete {
|
||||||
|
selector: "#reposiory-search",
|
||||||
|
delay: 300,
|
||||||
|
source: (term, response) ->
|
||||||
|
$.getJSON "https://api.github.com/search/repositories", {q: term}, (data) ->
|
||||||
|
if data and data.total_count > 0
|
||||||
|
response (data.items
|
||||||
|
.filter (item) -> item.archived == false && !item.license
|
||||||
|
.map (item) -> item.full_name)
|
||||||
|
else
|
||||||
|
response([])
|
||||||
|
onSelect: (event, repository, item) ->
|
||||||
|
licenseId = event.target.getAttribute("data-license-id")
|
||||||
|
if licenseId
|
||||||
|
window.open 'https://github.com/'+repository+'/community/license/new?template='+licenseId
|
||||||
|
else
|
||||||
|
window.open 'https://github.com/'+repository+'/community/license/new'
|
||||||
|
}
|
||||||
$ ->
|
$ ->
|
||||||
new Choosealicense()
|
new Choosealicense()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user