2016-08-19 09:19:06 +02:00
|
|
|
| {% extends 'layout.html' %}
|
2018-09-12 19:00:16 +02:00
|
|
|
| {% from '_macros/_asset_list_item.html' import asset_list_item %}
|
2018-09-20 12:05:46 +02:00
|
|
|
| {% from '_macros/_navigation.html' import navigation_homepage, navigation_project %}
|
2018-09-12 19:00:16 +02:00
|
|
|
include ../mixins/components
|
|
|
|
|
2018-09-19 18:22:27 +02:00
|
|
|
| {% if project %}
|
|
|
|
| {% set title = 'search-project' %}
|
|
|
|
| {% else %}
|
|
|
|
| {% set title = 'search' %}
|
|
|
|
| {% endif %}
|
|
|
|
|
|
|
|
| {% block navigation_tabs %}
|
|
|
|
| {% if project %}
|
2019-02-06 10:31:36 +01:00
|
|
|
| {{ navigation_project(project, navigation_links, extension_sidebar_links, title) }}
|
2018-09-19 18:22:27 +02:00
|
|
|
| {% else %}
|
|
|
|
| {{ navigation_homepage(title) }}
|
|
|
|
| {% endif %}
|
|
|
|
| {% endblock navigation_tabs %}
|
|
|
|
|
2018-11-22 15:31:53 +01:00
|
|
|
| {% block navigation_search %}{% endblock navigation_search %}
|
|
|
|
|
2016-08-19 09:19:06 +02:00
|
|
|
| {% block page_title %}Search{% if project %} {{ project.name }}{% endif %}{% endblock %}
|
|
|
|
|
2018-01-05 15:23:54 +01:00
|
|
|
| {% block head %}
|
2018-09-17 19:04:42 +02:00
|
|
|
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/video.min.js') }}")
|
2018-03-23 16:34:33 +01:00
|
|
|
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/videojs-ga-0.4.2.min.js') }}")
|
|
|
|
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/videojs-hotkeys-0.2.20.min.js') }}")
|
2018-10-05 14:37:32 +02:00
|
|
|
script(src="{{ url_for('static_pillar', filename='assets/js/video_plugins.min.js') }}")
|
2018-01-05 15:23:54 +01:00
|
|
|
| {% endblock %}
|
|
|
|
|
2016-08-19 09:19:06 +02:00
|
|
|
| {% block og %}
|
|
|
|
meta(property="og:type", content="website")
|
|
|
|
| {% if og_picture %}
|
|
|
|
meta(property="og:image", content="{{ og_picture.thumbnail('l', api=api) }}")
|
2017-02-06 14:37:53 +01:00
|
|
|
meta(property="twitter:image", content="{{ og_picture.thumbnail('l', api=api) }}")
|
2016-08-19 09:19:06 +02:00
|
|
|
| {% endif %}
|
|
|
|
| {% if project %}
|
|
|
|
meta(property="og:title", content="{{project.name}} - Blender Cloud")
|
2017-02-06 14:37:53 +01:00
|
|
|
meta(name="twitter:title", content="{{project.name}} on Blender Cloud")
|
2016-08-19 09:19:06 +02:00
|
|
|
meta(property="og:url", content="{{url_for('projects.view', project_url=project.url, _external=True)}}")
|
|
|
|
meta(property="og:description", content="{{project.summary}}")
|
|
|
|
meta(name="twitter:description", content="{{project.summary}}")
|
|
|
|
| {% endif %}
|
|
|
|
| {% endblock %}
|
|
|
|
|
|
|
|
| {% block body %}
|
2018-03-13 12:24:29 +01:00
|
|
|
| {% if project %}
|
|
|
|
script.
|
|
|
|
document.body.dataset["projectId"] = "{{project._id}}";
|
|
|
|
| {% endif %}
|
2016-08-19 09:19:06 +02:00
|
|
|
|
2018-09-12 19:00:16 +02:00
|
|
|
#search-container.d-flex(class="{% if project %}search-project{% endif %}")
|
2018-09-17 19:04:42 +02:00
|
|
|
|
|
|
|
.search-settings#search-sidebar.bg-light
|
2018-09-10 11:10:25 +02:00
|
|
|
input.search-field.p-2.bg-white(
|
2018-09-12 19:00:16 +02:00
|
|
|
type="text",
|
|
|
|
name="q",
|
|
|
|
id="q",
|
|
|
|
autocomplete="off",
|
|
|
|
spellcheck="false",
|
|
|
|
autocorrect="false",
|
|
|
|
placeholder="Search by Title, Type...")
|
|
|
|
|
|
|
|
#pagination.mt-3
|
|
|
|
#facets
|
|
|
|
#stats.search-list-stats
|
|
|
|
|
2018-09-17 19:04:42 +02:00
|
|
|
.border-left.search-list
|
|
|
|
|
2018-11-22 15:31:53 +01:00
|
|
|
+card-deck()(id='hits', class="m-0 px-2 card-deck-vertical")
|
2018-09-12 19:00:16 +02:00
|
|
|
|
|
|
|
#search-details.border-left.search-details
|
2016-08-19 09:19:06 +02:00
|
|
|
#search-error
|
2018-09-10 11:56:31 +02:00
|
|
|
#search-hit-container.w-100
|
2016-08-19 09:19:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
| {% raw %}
|
|
|
|
// Facet template
|
|
|
|
script(type="text/template", id="facet-template")
|
2018-09-17 19:04:42 +02:00
|
|
|
.card.border-0.p-0.m-2
|
|
|
|
.card-body.p-3.m-0
|
2018-11-22 15:31:53 +01:00
|
|
|
h6.text-muted.facet-title {{ title }}
|
2018-09-17 19:04:42 +02:00
|
|
|
| {{#values}}
|
|
|
|
a.facet_link.toggleRefine(
|
|
|
|
class='{{#refined}}refined{{/refined}}',
|
|
|
|
data-facet='{{ facet }}',
|
|
|
|
data-value='{{ value }}',
|
|
|
|
href='#')
|
|
|
|
span
|
|
|
|
| {{ label }}
|
|
|
|
small.text-black-50.float-right {{ count }}
|
|
|
|
| {{/values}}
|
2016-08-19 09:19:06 +02:00
|
|
|
|
|
|
|
// Pagination template
|
|
|
|
script(type="text/template", id="pagination-template")
|
|
|
|
ul.search-pagination.
|
2018-01-10 17:07:21 +01:00
|
|
|
<li {{^prev_page}}class="disabled"{{/prev_page}}><a href="#" {{#prev_page}} class="gotoPage" data-page="{{ prev_page.page }}" {{/prev_page}}><i class="pi-angle-left"></i></a></li>
|
2016-08-19 09:19:06 +02:00
|
|
|
{{#pages}}
|
2018-01-10 17:07:21 +01:00
|
|
|
<li class="{{#current}}active{{/current}}{{#disabled}}disabled{{/disabled}}"><a href="#" {{^disabled}} class="gotoPage" data-page="{{ number }}" {{/disabled}}>{{ shownr }}</a></li>
|
2016-08-19 09:19:06 +02:00
|
|
|
{{/pages}}
|
2018-01-10 17:07:21 +01:00
|
|
|
<li {{^next_page}}class="disabled"{{/next_page}}><a href="#" {{#next_page}} class="gotoPage" data-page="{{ page }}" {{/next_page}}><i class="pi-angle-right"></i></a></li>
|
2016-08-19 09:19:06 +02:00
|
|
|
|
|
|
|
// Stats template
|
|
|
|
script(type="text/template", id="stats-template")
|
|
|
|
span {{ nbHits }} result{{#nbHits_plural}}s{{/nbHits_plural}}
|
|
|
|
small ({{ processingTimeMS }}ms)
|
|
|
|
| {% endraw %}
|
|
|
|
|
|
|
|
| {% endblock %}
|
|
|
|
|
|
|
|
| {% block footer_scripts %}
|
2016-11-07 12:20:23 +01:00
|
|
|
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/hogan.common-3.0.0.js') }}")
|
2017-12-29 14:19:22 +01:00
|
|
|
script(src="{{ url_for('static_pillar', filename='assets/js/elasticsearch.min.js') }}")
|
2016-08-19 09:19:06 +02:00
|
|
|
|
2018-03-13 12:24:29 +01:00
|
|
|
script.
|
|
|
|
function displayNode(userId) {
|
2016-08-19 09:19:06 +02:00
|
|
|
var url = '/nodes/' + userId + '/view';
|
|
|
|
|
|
|
|
$.get(url, function(dataHtml){
|
|
|
|
$('#search-hit-container').html(dataHtml);
|
|
|
|
})
|
|
|
|
.done(function(){
|
2018-09-20 15:20:29 +02:00
|
|
|
loadingBarHide();
|
2016-08-19 09:19:06 +02:00
|
|
|
$('#search-error').hide();
|
|
|
|
$('#search-hit-container').show();
|
|
|
|
})
|
|
|
|
.fail(function(data){
|
2018-09-20 15:20:29 +02:00
|
|
|
loadingBarHide();
|
2016-08-19 09:19:06 +02:00
|
|
|
$('#search-hit-container').hide();
|
|
|
|
$('#search-error').show().html('Houston!\n\n' + data.status + ' ' + data.statusText);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-09-12 19:00:16 +02:00
|
|
|
$('body').on('click', '.js-search-hit', function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
|
2018-09-20 15:20:29 +02:00
|
|
|
loadingBarHide();
|
|
|
|
loadingBarShow();
|
2016-08-19 09:19:06 +02:00
|
|
|
|
2018-11-22 15:31:53 +01:00
|
|
|
displayNode($(this).data('node-id'));
|
2018-09-12 19:00:16 +02:00
|
|
|
$('.js-search-hit').removeClass('active');
|
2016-08-19 09:19:06 +02:00
|
|
|
$(this).addClass('active');
|
|
|
|
});
|
|
|
|
|
2018-09-12 19:00:16 +02:00
|
|
|
// Remove focus from search input so that the click event
|
|
|
|
// bound to .search-hit can be fired on the first click.
|
|
|
|
$('#search-list').hover(function(){
|
2016-08-19 09:19:06 +02:00
|
|
|
$('#q').blur();
|
|
|
|
});
|
|
|
|
$('#search-sidebar').hover(function(){
|
|
|
|
$('#q').focus();
|
|
|
|
});
|
|
|
|
|
|
|
|
/* UI Stuff */
|
|
|
|
/* Resize container so we can have custom scrollbars */
|
|
|
|
container_offset = $('#search-container').offset();
|
|
|
|
|
|
|
|
function containerResizeY(window_height){
|
|
|
|
|
|
|
|
var container_height = window_height - container_offset.top;
|
|
|
|
|
|
|
|
if (container_height > parseInt($('#search-container').css("min-height"))) {
|
|
|
|
$('#search-container').css(
|
|
|
|
{'max-height': container_height + 'px', 'height': container_height + 'px'}
|
|
|
|
);
|
|
|
|
$('#search-list, #search-hit-container').css(
|
|
|
|
{'max-height': container_height + 'px', 'height': container_height + 'px'}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
$(window).on("load resize",function(){
|
|
|
|
containerResizeY($(window).height());
|
|
|
|
});
|
|
|
|
|
|
|
|
| {% endblock %}
|
|
|
|
|
2018-09-17 19:04:42 +02:00
|
|
|
| {% block footer_container %}{% endblock %}
|
2016-08-19 09:19:06 +02:00
|
|
|
| {% block footer %}{% endblock %}
|