preferences.html 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. {% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle %}
  2. {% extends "oscar/base.html" %}
  3. {% block title %}{{ _('preferences') }} - {% endblock %}
  4. {% block site_alert_warning_nojs %}
  5. <noscript>
  6. {% include 'oscar/messages/js_disabled.html' %}
  7. </noscript>
  8. {% endblock %}
  9. {% block content %}
  10. <div>
  11. <h1>{{ _('Preferences') }}</h1>
  12. <form method="post" action="{{ url_for('preferences') }}" id="search_form">
  13. <!-- Nav tabs -->
  14. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  15. <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
  16. <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
  17. <li><a href="#tab_plugins" role="tab" data-toggle="tab">{{ _('Plugins') }}</a></li>
  18. </ul>
  19. <!-- Tab panes -->
  20. <noscript>
  21. <h3>{{ _('General') }}</h3>
  22. </noscript>
  23. <div class="tab-content">
  24. <div class="tab-pane active" id="tab_general">
  25. <fieldset>
  26. <div class="container-fluid">
  27. <div class="row form-group">
  28. {% if rtl %}
  29. <div class="col-sm-11 col-md-10">
  30. {% include 'oscar/categories.html' %}
  31. </div>
  32. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  33. {% else %}
  34. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  35. <div class="col-sm-11 col-md-10">
  36. {% include 'oscar/categories.html' %}
  37. </div>
  38. {% endif %}
  39. </div>
  40. {% set language_label = _('Search language') %}
  41. {% set language_info = _('What language do you prefer for search?') %}
  42. {{ preferences_item_header(language_info, language_label, rtl) }}
  43. <select class="form-control" name='language'>
  44. <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
  45. {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
  46. <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
  47. {% endfor %}
  48. </select>
  49. {{ preferences_item_footer(language_info, language_label, rtl) }}
  50. {% set locale_label = _('Interface language') %}
  51. {% set locale_info = _('Change the language of the layout') %}
  52. {{ preferences_item_header(locale_info, locale_label, rtl) }}
  53. <select class="form-control" name='locale'>
  54. {% for locale_id,locale_name in locales.items() | sort %}
  55. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  56. {% endfor %}
  57. </select>
  58. {{ preferences_item_footer(locale_info, locale_label, rtl) }}
  59. {% set autocomplete_label = _('Autocomplete') %}
  60. {% set autocomplete_info = _('Find stuff as you type') %}
  61. {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
  62. <select class="form-control" name="autocomplete">
  63. <option value=""> - </option>
  64. {% for backend in autocomplete_backends %}
  65. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  66. {% endfor %}
  67. </select>
  68. {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
  69. {% set image_proxy_label = _('Image proxy') %}
  70. {% set image_proxy_info = _('Proxying image results through searx') %}
  71. {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
  72. <select class="form-control" name='image_proxy'>
  73. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  74. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
  75. </select>
  76. {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
  77. {% set method_label = _('Method') %}
  78. {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %}
  79. {{ preferences_item_header(method_info, method_label, rtl) }}
  80. <select class="form-control" name='method'>
  81. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  82. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  83. </select>
  84. {{ preferences_item_footer(method_info, method_label, rtl) }}
  85. {% set safesearch_label = _('SafeSearch') %}
  86. {% set safesearch_info = _('Filter content') %}
  87. {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
  88. <select class="form-control" name='safesearch'>
  89. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  90. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  91. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  92. </select>
  93. {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
  94. {% set theme_label = _('Themes') %}
  95. {% set theme_info = _('Change searx layout') %}
  96. {{ preferences_item_header(theme_info, theme_label, rtl) }}
  97. <select class="form-control" name="theme">
  98. {% for name in themes %}
  99. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  100. {% endfor %}
  101. </select>
  102. {{ preferences_item_footer(theme_info, theme_label, rtl) }}
  103. </div>
  104. </fieldset>
  105. </div>
  106. <div class="tab-pane active_if_nojs" id="tab_engine">
  107. <!-- Nav tabs -->
  108. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  109. {% for (categ,search_engines) in categs %}
  110. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  111. {% endfor %}
  112. </ul>
  113. <noscript>
  114. <h3>{{ _('Engines') }}</h3>
  115. </noscript>
  116. <!-- Tab panes -->
  117. <div class="tab-content">
  118. {% for (categ,search_engines) in categs %}
  119. <noscript><label>{{ _(categ) }}</label>
  120. </noscript>
  121. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  122. <div class="container-fluid">
  123. <fieldset>
  124. {% for search_engine in search_engines %}
  125. {% if not search_engine.private %}
  126. <div class="row">
  127. {% if not rtl %}
  128. <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
  129. {% endif %}
  130. <div class="col-xs-6 col-sm-4 col-md-4">
  131. {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in blocked_engines) }}
  132. </div>
  133. {% if rtl %}
  134. <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</div>
  135. {% endif %}
  136. </div>
  137. {% endif %}
  138. {% endfor %}
  139. </fieldset>
  140. </div>
  141. </div>
  142. {% endfor %}
  143. </div>
  144. </div>
  145. <div class="tab-pane active_if_nojs" id="tab_plugins">
  146. <noscript>
  147. <h3>{{ _('Plugins') }}</h3>
  148. </noscript>
  149. <fieldset>
  150. <div class="container-fluid">
  151. {% for plugin in plugins %}
  152. <div class="panel panel-default">
  153. <div class="panel-heading">
  154. <h3 class="panel-title">{{ plugin.name }}</h3>
  155. </div>
  156. <div class="panel-body">
  157. <div class="col-xs-6 col-sm-4 col-md-6">{{ plugin.description }}</div>
  158. <div class="col-xs-6 col-sm-4 col-md-6">
  159. {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }}
  160. </div>
  161. </div>
  162. </div>
  163. {% endfor %}
  164. </div>
  165. </fieldset>
  166. </div>
  167. </div>
  168. <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
  169. <br />
  170. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  171. </p>
  172. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  173. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  174. </form>
  175. </div>
  176. {% endblock %}