{% extends "master.html" %}
{% block title %}Home{% endblock %}
{% set tag = "home" %}i
{% from "_render_repo.html" import render_repos, render_user_repos%}
{% from "_browseheader.html" import browse_header %}
{% block header %}
<link href="{{ url_for('static', filename='vendor/selectize/selectize.bootstrap3.css') }}"
rel="stylesheet" />
{% endblock %}
{% block content %}
<div class="repo-header p-t-1">
<div class="container">
{{ browse_header(select=select) }}
</div>
</div>
<div class="container">
{{ render_repos(
repos, total_page, 'page', page,
'All Projects', repos_length, 'repos', username, sorting=sorting) }}
</div>
{% endblock %}
{% block jscripts %}
{{ super() }}
<script src="{{ url_for('static', filename='vendor/selectize/selectize.min.js') }}" type="text/javascript"> </script>
<script src="{{ url_for('static', filename='vendor/jquery.dotdotdot/jquery.dotdotdot.min.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#headerSearch').on('keypress keydown keyup', function(e) {
if (e.which == 13) {
e.preventDefault();
return false;
}
});
$('#term').selectize({
valueField: 'fullname',
labelField: 'fullname',
searchField: 'fullname',
maxItems: 1,
create: false,
onType: function(value){
if (value == ""){
this.close();
}
},
onChange: function(value){
if (value != ""){
$('#headerSearch').submit();
}
},
load: function(query, callback) {
if (!query.length) return callback();
$.getJSON(
"{{ url_for('api_ns.api_projects') }}", {
pattern: "*"+query+"*",
short: "1",
},
function( data ) {
callback( data.projects );
}
);
},
render: {
option: function(item, escape) {
{% set reponame = 'item.fullname' %}
return '<div>'
+ '<div class="projecticon-search pull-xs-left">'
+ '<span class="oi" data-glyph="document"></span>'
+ '</div>'
+ '<div class="title">'
+ '<span class="name">'
+ '<strong>' + escape(item.fullname) + '</strong>'
+ '</span>'
+ '</div>'
+ '<div class="description">'
+ '<small>' + escape(item.description) + '</small>'
+ '</div>'
+ '</div>';
}
},
});
$(".repo_desc").dotdotdot({
watch:"window"
});
{% if username %}
$(function(){
$('.show_parts input[type="checkbox"]').change(function(){
$('#' + $(this).attr('name')).toggle();
});
});
{% endif %}
});
</script>
{% endblock %}