preferences.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. {% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl %}
  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. </ul>
  18. <!-- Tab panes -->
  19. <noscript>
  20. <h3>{{ _('General') }}</h3>
  21. </noscript>
  22. <div class="tab-content">
  23. <div class="tab-pane active" id="tab_general">
  24. <fieldset>
  25. <div class="container-fluid">
  26. <div class="row form-group">
  27. {% if rtl %}
  28. <div class="col-sm-11 col-md-10">
  29. {% include 'oscar/categories.html' %}
  30. </div>
  31. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  32. {% else %}
  33. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  34. <div class="col-sm-11 col-md-10">
  35. {% include 'oscar/categories.html' %}
  36. </div>
  37. {% endif %}
  38. </div>
  39. {% set language_label = _('Search language') %}
  40. {% set language_info = _('What language do you prefer for search?') %}
  41. {{ preferences_item_header(language_info, language_label, rtl) }}
  42. <select class="form-control" name='language'>
  43. <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
  44. {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
  45. <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
  46. {% endfor %}
  47. </select>
  48. {{ preferences_item_footer(language_info, language_label, rtl) }}
  49. {% set locale_label = _('Interface language') %}
  50. {% set locale_info = _('Change the language of the layout') %}
  51. {{ preferences_item_header(locale_info, locale_label, rtl) }}
  52. <select class="form-control" name='locale'>
  53. {% for locale_id,locale_name in locales.items() | sort %}
  54. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  55. {% endfor %}
  56. </select>
  57. {{ preferences_item_footer(locale_info, locale_label, rtl) }}
  58. {% set autocomplete_label = _('Autocomplete') %}
  59. {% set autocomplete_info = _('Find stuff as you type') %}
  60. {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
  61. <select class="form-control" name="autocomplete">
  62. <option value=""> - </option>
  63. {% for backend in autocomplete_backends %}
  64. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  65. {% endfor %}
  66. </select>
  67. {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
  68. {% set image_proxy_label = _('Image proxy') %}
  69. {% set image_proxy_info = _('Proxying image results through searx') %}
  70. {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
  71. <select class="form-control" name='image_proxy'>
  72. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  73. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
  74. </select>
  75. {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
  76. {% set method_label = _('Method') %}
  77. {% 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>') %}
  78. {{ preferences_item_header(method_info, method_label, rtl) }}
  79. <select class="form-control" name='method'>
  80. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  81. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  82. </select>
  83. {{ preferences_item_footer(method_info, method_label, rtl) }}
  84. {% set safesearch_label = _('SafeSearch') %}
  85. {% set safesearch_info = _('Filter content') %}
  86. {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
  87. <select class="form-control" name='safesearch'>
  88. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  89. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  90. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  91. </select>
  92. {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
  93. {% set theme_label = _('Themes') %}
  94. {% set theme_info = _('Change searx layout') %}
  95. {{ preferences_item_header(theme_info, theme_label, rtl) }}
  96. <select class="form-control" name="theme">
  97. {% for name in themes %}
  98. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  99. {% endfor %}
  100. </select>
  101. {{ preferences_item_footer(theme_info, theme_label, rtl) }}
  102. </div>
  103. </fieldset>
  104. </div>
  105. <div class="tab-pane active_if_nojs" id="tab_engine">
  106. <!-- Nav tabs -->
  107. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  108. {% for (categ,search_engines) in categs %}
  109. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  110. {% endfor %}
  111. </ul>
  112. <noscript>
  113. <h3>{{ _('Engines') }}</h3>
  114. </noscript>
  115. <!-- Tab panes -->
  116. <div class="tab-content">
  117. {% for (categ,search_engines) in categs %}
  118. <noscript><label>{{ _(categ) }}</label>
  119. </noscript>
  120. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  121. <div class="container-fluid">
  122. <fieldset>
  123. {% for search_engine in search_engines %}
  124. {% if not search_engine.private %}
  125. <div class="row">
  126. {% if not rtl %}
  127. <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
  128. {% endif %}
  129. <div class="col-xs-6 col-sm-4 col-md-4">
  130. <div class="checkbox">
  131. <input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} />
  132. <label class="btn btn-success label_hide_if_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
  133. <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
  134. </div>
  135. </div>
  136. {% if rtl %}
  137. <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</div>
  138. {% endif %}
  139. </div>
  140. {% endif %}
  141. {% endfor %}
  142. </fieldset>
  143. </div>
  144. </div>
  145. {% endfor %}
  146. </div>
  147. </div>
  148. </div>
  149. <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.') }}
  150. <br />
  151. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  152. </p>
  153. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  154. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  155. </form>
  156. </div>
  157. {% endblock %}