aboutsummaryrefslogtreecommitdiff
path: root/templates/index.html
blob: b0ea615b1081b4414c2a7ed0f72fee7832c575b5 (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
151
152
153
154
{# This file is part of GCIDE                                           #}
{# Copyright (C) 2012 Sergey Poznyakoff                                 #}

{# GCIDE is free software; you can redistribute it and/or modify        #}
{# it under the terms of the GNU General Public License as published by #}
{# the Free Software Foundation; either version 3, or (at your option)  #}
{# any later version.                                                   #}

{# GCIDE is distributed in the hope that it will be useful,             #}
{# but WITHOUT ANY WARRANTY; without even the implied warranty of       #}
{# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #}
{# GNU General Public License for more details.                         #}

{# You should have received a copy of the GNU General Public License    #}
{# along with GCIDE.  If not, see <http://www.gnu.org/licenses/>.       #}

{% extends 'base.html' %}
{% load dictlookup %}
{% load macros %}
{% load withsetting %}

{% block warning %}
{% withsetting DEBUG as debug %}
{% if debug %}
<div class="warning">
<p>Warning! This is a development version. It may be incomplete and contain dangling links</p>
</div>
<div class="topmargin"><br /></div>
{% endif %}
{% endwithsetting %}
{% endblock %}

{% block search %}

<div id="searchform">
  <form id="form" method="get" action="">
    <div id="define">
      <input type="text" id="q" name="q" size="35"
	     style="width:350px" value="{{ q|escape }}" />
      <input type="submit" name="define" value="Define" />
    </div>
    <div id="search">
      <input type="submit" name="search" value="Search" />
      <select name="strategy" style="width:350px">
	      {{ selects.st.html|safe }}
      </select>
    </div>
  </form>
</div>

{% endblock %}

{% macro matches title items %}
  <div class="match results">
    <h3><a name="match-results"></a>{{ title }}</h3>
    <ul>
      {% for mt in items %}
      <li>
        {% for term in mt.1 %}
        <a href="?q={{ term|urlencode }}&amp;db={{ mt.0|urlencode }}&amp;define=1" title="Define {{ term }}">{{ term|title }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
      </li>
      {% endfor %}
    </ul>
  </div>
{% endmacro %}

{% block results %}

{% if result.error %}
<div class="derror">
  {{ result.msg }}
</div>
{% else %}
 {% if result.type == "define" %}
  <div class="definition results">
  {% if result.definitions %}
    {% if mtc.matches %}
    <a href="#match-results" class="link-lmr">last match results</a>
    {% endif %}
    <h3>
      {% if result.count == 1 %}
      Found one definition
      {% else %}
      Found {{ result.count }} definitions
      {% endif %}
    </h3>
    <ol class="definitions">
    {% for df in result.definitions %}
    <li>
    <pre>
      {% if df.format_html %}
{{ df.desc|safe }}
      {% else %}
{{ df.desc|safe|linebreaksbr }}
      {% endif %}
    </pre></li>
    {% endfor %}
    </ol>
    {% if mtc.matches %}
     {% usemacro matches "Last match results" mtc.matches.items %}
    {% endif %}
  {% else %}
   {% if result.matches %}
    {% usemacro matches "No exact match found.  Perhaps you meant one of the following:" result.matches.items %} 
   {% endif %} 
  </div>
  {% endif %}
 {% else %}
  {% if result.type == "search" %}
   {% if mtc.matches %}
    {% usemacro matches "Matches" mtc.matches.items %}
   {% endif %}
  {% else %}
   {% if result.desc %}
    {% if result.type == "info" %}
     <div class="info">
      <pre>
       {{ result.desc }}
      </pre>
     </div>
    {% else %}
     <div class="results">
      <pre>
       {{ result.desc|linebreaksbr }}
      </pre>
     </div>
    {% endif %}
   {% else %}
    <div id="description">
     {% if item %}
      {% include item %}
     {% else %}
      {% include "about.html" %}
     {% endif %}
    </div>
   {% endif %}
  {% endif %}
 {% endif %}
{% endif %}

{% endblock %}

{% block license %}
<p>
This text is available under
the
{% if result %}
<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>  
{% else %}
<a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative
Commons Attribution-ShareAlike License</a>
{% endif %}  
.</p>
{% endblock %}    

Return to:

Send suggestions and report system problems to the System administrator.