aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_covid19/templates/fulltext_search.html
blob: 174acd91491719ae4904cd27b639badbfe783727 (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{% 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 documents") }}</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_time">
            <div class="text">{{ filter_time or 'any' }}</div>
            <i class="dropdown icon"></i>
            <div class="menu">
              <div class="header">
                <i class="filter icon"></i>
                Publication Stage
              </div>
              <div class="divider"></div>
              <div class="{% if filter_type == 'any'          %}active{% endif %} item" data-value="any"       >{{ _("any stage")     }}</div>
              <div class="{% if filter_type == 'published'    %}active{% endif %} item" data-value="published" >{{ _("only published")     }}</div>
              <div class="{% if filter_type == 'pre_print'    %}active{% endif %} item" data-value="pre_print" >{{ _("only pre-print")    }}</div>
            </div>
          </div>
#}

          <div class="ui inline dropdown">
            <input type="hidden" name="filter_type" value="{{ filter_type }}">
            <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" vale="{{ filter_time }}">
            <div class="text">{{ filter_time 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 %}