diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-05-09 15:32:51 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-05-09 16:11:28 +0200 |
commit | 3f1bd22dc86753fc87c1cb00040caa836185fb11 (patch) | |
tree | 89f20542bbac962667470dfea744316e098dc34b | |
parent | f16e30d07859678a24d2e9aec2e79a2c122feca8 (diff) | |
download | Ishtar-3f1bd22dc86753fc87c1cb00040caa836185fb11.tar.bz2 Ishtar-3f1bd22dc86753fc87c1cb00040caa836185fb11.zip |
Settings js in an external (generated but cachable) file. Manually set l10n for town sheet.
-rw-r--r-- | ishtar_common/templates/base.html | 47 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_map.html | 7 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_town.html | 6 | ||||
-rw-r--r-- | ishtar_common/urls.py | 1 | ||||
-rw-r--r-- | ishtar_common/views.py | 4 |
5 files changed, 12 insertions, 53 deletions
diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 426ae7655..8937fe735 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -51,53 +51,8 @@ <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/jqplot/plugins/jqplot.cursor.js?ver={{VERSION}}"></script> <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/jquery-resizable.js?ver={{VERSION}}"></script> {{EXTRA_JS|safe}} - <script type='text/javascript'> - var current_language = "{{LANGUAGE_CODE}}"; - var static_path = "{{STATIC_URL}}"; - var limit_map_nb = {{ISHTAR_MAP_MAX_ITEMS}}; - var shortcut_url = '{% url "shortcut-menu" %}'; - {% if DISPLAY_PIN_MENU %}var show_shortcut_menu = true;{% endif %} - var alert_url = '{% url "alert-list" %}'; - var get_file_url = '{% url "get-file-shortcut" %}'; - var pin_search_url = '{% url "pin-search" "item" %}'; - var get_operation_url = '{% url "get-operation-shortcut" %}'; - var get_contextrecord_url = '{% url "get-contextrecord-shortcut" %}'; - var get_find_url = '{% url "get-find-shortcut" %}'; - var activate_all_search_url = '{% url "activate-all-search" %}'; - var activate_own_search_url = '{% url "activate-own-search" %}'; - var activate_all_search_msg = "{% trans 'Searches in the shortcut menu deal with all items.' %}"; - var activate_own_search_msg = "{% trans 'Searches in the shortcut menu deal with only your items.' %}"; - var search_pinned_msg = "{% trans 'Search pinned' %}"; - var complete_list_label = "{% trans 'complete list...' %}"; - var added_message = "{% trans " items added." %}"; - var select_only_one_msg = "{% trans "Select only one item." %}"; - var YES = "{% trans 'yes' %}"; - var NO = "{% trans 'no' %}"; - var fetching_msg = "{% trans 'Fetching data...' %}"; - var base_maps_msg = "{% trans 'Base maps' %}"; - var layers_msg = "{% trans 'Layers' %}"; - var stats_incompatible_modality = "{% trans 'This graph type accept only one modality.' %}"; - var show_msg = "{% trans "Show" %}"; - var entries_msg = "{% trans "entries" %}"; - var info_show_msg = "{% trans "Showing" %}"; - var info_entries_msg = "{% trans "entrie(s)" %}"; - var table_to_msg = "{% trans "to" %}"; - var table_of_msg = "{% trans "of" %}"; - var no_data_gallery_msg = "{% trans "No data available in the gallery" %}"; - var item_list_msg = "{% trans "Item list" %}"; - var autorefresh_message_start = "{% trans 'Autorefresh start. The form is disabled.' %}"; - var autorefresh_message_end = "{% trans 'Autorefresh end. The form is re-enabled.' %}"; - var track_me_msg = "{% trans "Geolocalize me" %}"; - var geoloc_activated_msg = "{% trans "Geolocation activated" %}"; - var geoloc_disabled_msg = "{% trans "Geolocation disabled" %}"; - var limit_map_msg = "{% trans "Limit to {0} items" %}"; - var display_poly_map_msg = "{% trans "Display lines, polygons" %}"; - var limit_map_help_msg = "{% trans "Unchecking this limit on a poorly performing device may result in web browser freeze" %}"; - var displayed_map_msg = "{% trans "{0} items displayed on the map" %}"; - var non_displayed_map_msg = "{% trans "{0} items not displayed" %}"; - var non_displayed_map_link_msg = "{% trans "(list)" %}"; - </script> {% endcompress %} + <script language="javascript" type="text/javascript" src="/js/settings.js?ver={{VERSION}}"></script> <link rel="stylesheet" href="{{STATIC_URL}}ol/ol.css?ver={{VERSION}}"> <link rel="stylesheet" href="{{STATIC_URL}}ol-layerswitcher/ol-layerswitcher.css?ver={{VERSION}}"> <link rel="stylesheet" href="{{STATIC_URL}}bootstrap/bootstrap.css?ver={{VERSION}}"> diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html index 74182a2e1..1ecdb204f 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_map.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html @@ -1,5 +1,6 @@ -{% load i18n window_field %}{% if PROFILE.mapping and geo_item.main_geodata %} +{% load i18n l10n window_field %}{% if PROFILE.mapping and geo_item.main_geodata %} {% with geodata_list=geo_item.geodata_list %} +{% localize off %} <div class="col-12 col-lg-6 flex-wrap"> <div class="window-map" id="map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"> </div> @@ -73,8 +74,6 @@ const display_map_{{geo_item.SLUG}}_{{geo_item.pk}} = function() { display_map_{{geo_item.SLUG}}_{{geo_item.pk}}(); refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}}(true); - - -</script> +{% endlocalize %}</script> {% endwith %} {% endif %} diff --git a/ishtar_common/templates/ishtar/sheet_town.html b/ishtar_common/templates/ishtar/sheet_town.html index 4f154f40d..7b86b9bf1 100644 --- a/ishtar_common/templates/ishtar/sheet_town.html +++ b/ishtar_common/templates/ishtar/sheet_town.html @@ -91,7 +91,7 @@ {% endif %} {% endwith %} <hr class="clearfix"> - {% if PROFILE.mapping and geo_item.main_geodata %} + {% if PROFILE.mapping and item.main_geodata %} <h3>{% trans "Geographic localisation" %}</h3> <div class="row"> {% with geo_item=item %} @@ -133,7 +133,7 @@ </div> -<script type="text/javascript"> +<script type="text/javascript">{% localize off %} $(document).ready( function () { datatable_options = { "dom": 'ltip', @@ -148,7 +148,7 @@ $(document).ready( function () { } }); } ); -</script> +{% endlocalize %}</script> {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 61d15f390..7b0c69a68 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -42,6 +42,7 @@ urlpatterns = [ ), # internationalization url(r"^i18n/", include("django.conf.urls.i18n")), + url(r"^js/settings.js", views.settings_js, name="settings-js"), # General url(r"shortcut_menu/", views.shortcut_menu, name="shortcut-menu"), url( diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 0f0798381..e584ad8ae 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -428,6 +428,10 @@ def activate_simple_shortcut_menu(request): return HttpResponse("OK", content_type="text/plain") +def settings_js(request): + return render(request, "ishtar/settings.js") + + def shortcut_menu(request): profile = get_current_profile() CURRENT_ITEMS = [] |