Quick-Search: Added Quick-search in the topbar
Changed how and what we store in elastic to unify it with how we store things in mongodb so we can have more generic javascript code to render the data. Elastic changes: Added: Node.project.url Altered to store id instead of url Node.picture Made Post searchable ./manage.py elastic reset_index ./manage.py elastic reindex Thanks to Pablo and Sybren
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
|
||||
| {% set node_type = asset.properties.content_type if asset.properties.content_type else asset.node_type %}
|
||||
|
||||
a.card.asset.card-image-fade.pr-0.mx-0.mb-2(
|
||||
a.card.asset.card-image-fade.mb-2(
|
||||
class="js-item-open {% if asset.permissions.world and not current_user.has_cap('subscriber') %}free{% endif %}",
|
||||
data-node_id="{{ asset._id }}",
|
||||
title="{{ asset.name }}",
|
||||
href='{{ url_for_node(node=asset) }}')
|
||||
.embed-responsive.embed-responsive-16by9
|
||||
.card-thumbnail
|
||||
| {% if asset.picture %}
|
||||
.card-img-top.embed-responsive-item(style="background-image: url({{ asset.picture.thumbnail('m', api=api) }})")
|
||||
img.card-img-top(src="{{ asset.picture.thumbnail('m', api=api) }}", alt="{{ asset.name }}")
|
||||
| {% else %}
|
||||
.card-img-top.card-icon.embed-responsive-item
|
||||
.card-img-top.card-icon
|
||||
i(class="pi-{{ node_type }}")
|
||||
| {% endif %}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ include ../../../mixins/components
|
||||
data-placement="top")
|
||||
i.pi-list
|
||||
|
||||
+card-deck(id="asset_list_{{node._id}}",class="px-2")
|
||||
+card-deck(id="asset_list_{{node._id}}",class="pl-4")
|
||||
| {% for child in children %}
|
||||
| {{ asset_list_item(child, current_user) }}
|
||||
| {% endfor %}
|
||||
|
@@ -17,6 +17,8 @@ include ../mixins/components
|
||||
| {% endif %}
|
||||
| {% endblock navigation_tabs %}
|
||||
|
||||
| {% block navigation_search %}{% endblock navigation_search %}
|
||||
|
||||
| {% block page_title %}Search{% if project %} {{ project.name }}{% endif %}{% endblock %}
|
||||
|
||||
| {% block head %}
|
||||
@@ -82,7 +84,7 @@ script.
|
||||
|
||||
.border-left.search-list
|
||||
|
||||
+card-deck(0)(id='hits', class="m-0 px-2 card-deck-vertical")
|
||||
+card-deck()(id='hits', class="m-0 px-2 card-deck-vertical")
|
||||
|
||||
#search-details.border-left.search-details
|
||||
#search-error
|
||||
@@ -94,7 +96,7 @@ script.
|
||||
script(type="text/template", id="facet-template")
|
||||
.card.border-0.p-0.m-2
|
||||
.card-body.p-3.m-0
|
||||
h6.text-muted {{ title }}
|
||||
h6.text-muted.facet-title {{ title }}
|
||||
| {{#values}}
|
||||
a.facet_link.toggleRefine(
|
||||
class='{{#refined}}refined{{/refined}}',
|
||||
@@ -106,38 +108,6 @@ script(type="text/template", id="facet-template")
|
||||
small.text-black-50.float-right {{ count }}
|
||||
| {{/values}}
|
||||
|
||||
|
||||
// Hit template
|
||||
script(type="text/template", id="hit-template")
|
||||
a.card.asset.card-image-fade.pl-0.mx-0.mb-1(
|
||||
data-hit-id='{{ objectID }}',
|
||||
href="/nodes/{{ objectID }}/redir",
|
||||
class="js-search-hit {{#is_free}}free{{/is_free}}")
|
||||
.embed-responsive.embed-responsive-16by9
|
||||
| {{#picture}}
|
||||
.card-img-top.embed-responsive-item(style="background-image: url({{{ picture }}})")
|
||||
| {{/picture}}
|
||||
| {{^picture}}
|
||||
.card-img-top.card-icon.embed-responsive-item
|
||||
| {{#media}}
|
||||
i(class="pi-{{{ media }}}")
|
||||
| {{/media}}
|
||||
| {{^media}}
|
||||
i(class="pi-{{{ node_type }}}")
|
||||
| {{/media}}
|
||||
| {{/picture}}
|
||||
.card-body.py-2.d-flex.flex-column
|
||||
.card-title.mb-1.font-weight-bold
|
||||
| {{ name }}
|
||||
|
||||
ul.card-text.list-unstyled.d-flex.text-black-50.mt-auto
|
||||
li.pr-2.project {{ project.name }}
|
||||
| {{#media}}
|
||||
li.pr-2.text-capitalize {{{ media }}}
|
||||
| {{/media}}
|
||||
li.pr-2 {{{ created_at }}}
|
||||
|
||||
|
||||
// Pagination template
|
||||
script(type="text/template", id="pagination-template")
|
||||
ul.search-pagination.
|
||||
@@ -184,7 +154,7 @@ script.
|
||||
loadingBarHide();
|
||||
loadingBarShow();
|
||||
|
||||
displayNode($(this).data('hit-id'));
|
||||
displayNode($(this).data('node-id'));
|
||||
$('.js-search-hit').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
|
@@ -21,15 +21,6 @@ include ../mixins/components
|
||||
a(href="{{url_for('projects.view', project_url=project.url, _external=True)}}")
|
||||
i.pi-folder
|
||||
|
||||
| {% if not project.is_private %}
|
||||
li.tabs-search(
|
||||
title="Search",
|
||||
data-toggle="tooltip",
|
||||
data-placement="left")
|
||||
a(href="{{url_for('projects.search', project_url=project.url, _external=True)}}")
|
||||
i.pi-search
|
||||
| {% endif %}
|
||||
|
||||
| {% if project.has_method('PUT') %}
|
||||
li.active(
|
||||
title="Edit Project",
|
||||
|
@@ -49,7 +49,7 @@ style.
|
||||
script(type="text/template", id="facet-template")
|
||||
.card.border-0.p-0.m-2
|
||||
.card-body.p-3.m-0
|
||||
h6.text-muted {{ title }}
|
||||
h6.text-muted.facet-title {{ title }}
|
||||
| {{#values}}
|
||||
a.facet_link.toggleRefine(
|
||||
class='{{#refined}}refined{{/refined}}',
|
||||
@@ -61,16 +61,6 @@ script(type="text/template", id="facet-template")
|
||||
small.text-black-50.float-right {{ count }}
|
||||
| {{/values}}
|
||||
|
||||
|
||||
// Hit template
|
||||
script(type="text/template", id="hit-template")
|
||||
.search-hit.users.cursor-pointer.p-2.border-bottom(data-user-id='{{ objectID }}')
|
||||
h6.mb-0.font-weight-bold {{ full_name }}
|
||||
small {{ username }}
|
||||
small.d-block.search-hit-roles.text-info
|
||||
| {{ roles }}
|
||||
|
||||
|
||||
// Pagination template
|
||||
script(type="text/template", id="pagination-template")
|
||||
ul.search-pagination.
|
||||
|
Reference in New Issue
Block a user