aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_covid19/templates/fulltext_search.html
blob: 55b25cc1b6c8b344da509d718839a5ee123a35c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{% import "entity_macros.html" as entity_macros %}
{% extends "base.html" %}

{% block title %}
{% if query %}
  {{ _("Search") }}: {{ query }}
{% else %}
  {{ _("Fulltext Search") }}
{% endif %}
{% endblock %}


{% block fullmain %}

<div class="ui vertical stripe segment" style="background-color: #EEE; padding-top: 2.5em; padding-bottom: 0.5em;">
  <div class="ui container text">
    <h1>{{ _("Search COVID-19 Research") }}</h1>
    <form class="" role="search" action="/fulltext/search" method="get">
      <div class="ui form">
        <div class="ui action input huge fluid">
          <input type="text" placeholder="{{ _("Query...") }}" name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search metadata">
          <button class="ui primary button">{{ _("Search") }}</button>
        </div>

        <div style="padding-top: 0.85em; padding-left: 1em;">
          {{ _("Include") }} &nbsp;
          <div class="ui inline dropdown">
            <input type="hidden" name="filter_type" value="{{ filter_type or 'papers' }}">
            <div class="text">{{ filter_type or "papers" }}</div>
            <i class="dropdown icon"></i>
            <div class="menu">
              <div class="header">
                <i class="filter icon"></i>
                {{ _("Resource Type") }}
              </div>
              <div class="divider"></div>
              <div class="{% if filter_type == 'papers'     %}active{% endif %} item" data-value="papers"    >{{ _("papers")        }}</div>
              <div class="{% if filter_type == 'reports'    %}active{% endif %} item" data-value="reports"   >{{ _("reports")       }}</div>
              <div class="{% if filter_type == 'datasets'   %}active{% endif %} item" data-value="datasets"  >{{ _("datasets")      }}</div>
              <div class="{% if filter_type == 'everything' %}active{% endif %} item" data-value="everything">{{ _("everything")    }}</div>
            </div>
          </div>

          {{ _("from") }}
          <div class="ui inline dropdown">
            <input type="hidden" name="filter_time" value="{{ filter_time or 'all' }}">
            <div class="text">{{ (filter_time and filter_time.replace("_", " ")) or "all time" }}</div>
            <i class="dropdown icon"></i>
            <div class="menu">
              <div class="header">
                <i class="filter icon"></i>
                {{ _("Time Period") }}
              </div>
              <div class="divider"></div>
              <div class="{% if filter_type == 'all'          %}active{% endif %} item" data-value="all"        >{{ _("all time")      }}</div>
              <div class="{% if filter_type == 'past_week'    %}active{% endif %} item" data-value="past_week"  >{{ _("past week")     }}</div>
              <div class="{% if filter_type == 'this_year'    %}active{% endif %} item" data-value="this_year"  >{{ _("this year")     }}</div>
              <div class="{% if filter_type == 'since_2000'   %}active{% endif %} item" data-value="since_2000" >{{ _("since 2000")    }}</div>
              <div class="{% if filter_type == 'before_1925'  %}active{% endif %} item" data-value="before_1925">{{ _("before 1925")   }}</div>
            </div>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>


{% if found %}
  {% if found.results %}

    <div class="ui container text" style="padding: 1em;">
      {{ entity_macros.top_results(found) }}
    </div>
    <div class="ui container" style="max-width: 1000px !important; font-size: 16px;">
      <div class="ui centered stackable grid">
        {% for paper in found.results %}
          {{ entity_macros.fulltext_search_result_row(paper) }}
        {% endfor %}
      </div>
    </div>
    {% if found.results|length > 8 %}
      <div class="ui container text">
        <div class="ui divider"></div>
        <div style="text-align: center">
          {{ entity_macros.bottom_results(found)}}
        </div>
      </div>
    {% endif %}

  {% else %}
    {# "did a query, but no results" #}
    <div class="ui container text">
      <br>
      {{ _("Raw query was:") }} <i>{{ found.query.q }}</i>

      <div class="ui centered stackable grid" style="padding-top: 15%;">
        <div class="row">
          <h2>{{ _("No results found!") }}</h2>
        </div>
        <div class="row">
          <div class="four wide column">
            <img src="/static/paper_man_confused.gif" alt="confused paper man">
          </div>
          <div class="six wide column">
            <br>
            <p>{{ _("Try searching elsewhere") }}:</p>
            <ul>
            <li><a href="https://www.ncbi.nlm.nih.gov/research/coronavirus/docsum?text={{ found.query.q | urlencode }}">NIH LitCovid</a></li>
            <li><a href="https://cord-19.apps.allenai.org/?q={{ found.query.q | urlencode }}">Allen AI CORD-19 Explorer</a></li>
            <li><a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li>
            </ul>
          </div>
        </div>
      </div>
    </div>

  {% endif %}
{% else %}
    {# "no query submitted" #}
{% endif %}

{% endblock %}

{% block postscript %}
<script>
$('.ui.inline.dropdown')
  .dropdown()
;
</script>
{% endblock %}