diff --git a/Makefile b/Makefile index 800fb2f8..866d7257 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ run: run-public: @PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings ipython manage.py runserver 0.0.0.0:8000 +shell: + @PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings python manage.py shell + makemessages: -@ipython manage.py makemessages --all diff --git a/static/client/html-cut/subscribe.html b/static/client/html-cut/subscribe.html index ca605e9a..96eb7e8a 100644 --- a/static/client/html-cut/subscribe.html +++ b/static/client/html-cut/subscribe.html @@ -875,8 +875,8 @@ //-->
  • - - + Яндекс цитирования diff --git a/static/client/js/rejs/banners.js b/static/client/js/rejs/banners.js index 70e4998b..1e083b5a 100644 --- a/static/client/js/rejs/banners.js +++ b/static/client/js/rejs/banners.js @@ -38,6 +38,15 @@ return API_URL_ROOT + "?" + search.join("&"); }; + var runCallback = function (callback, arg) { + try { + callback(JSON.parse(arg)); + } catch (error) { + // do nothing + } + console.info('callback Done'); + }; + var getBanners = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); @@ -45,10 +54,13 @@ xhr.onreadystatechange = function (event) { if (event.target.readyState === 4) { if (event.target.status === 200) { - try { - callback(JSON.parse(event.target.responseText)); - } catch (error) { - // do nothing + if (document.readyState === "loading") { + console.info('setting DOMContentLoaded event listener'); + document.addEventListener("DOMContentLoaded", function() { + runCallback(callback, event.target.responseText); + }); + } else { + runCallback(callback, event.target.responseText); } } } @@ -109,5 +121,6 @@ getBanners(getUrl(), insertBanners); }; - window.addEventListener("load", main); + // window.addEventListener("load", main); + document.addEventListener("DOMContentLoaded", main); })(); diff --git a/static/client/js/rejs/tops.js b/static/client/js/rejs/tops.js index 31bee27b..46ee4a01 100644 --- a/static/client/js/rejs/tops.js +++ b/static/client/js/rejs/tops.js @@ -34,6 +34,15 @@ return API_URL_ROOT + "?" + search.join("&"); }; + var runCallback = function (callback, arg) { + try { + callback(arg); + } catch (error) { + // do nothing + } + console.info('callback Done'); + }; + var getTops = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); @@ -41,10 +50,14 @@ xhr.onreadystatechange = function (event) { if (event.target.readyState === 4) { if (event.target.status === 200) { - try { - callback(event.target.responseText); - } catch (error) { - // do nothing + console.info(document.readyState); + if (document.readyState === "loading") { + console.info('setting DOMContentLoaded event listener'); + document.addEventListener("DOMContentLoaded", function() { + runCallback(callback, event.target.responseText); + }); + } else { + runCallback(callback, event.target.responseText); } } } @@ -64,6 +77,14 @@ var main = function () { getTops(getUrl(), insertTops); }; + // main(); + // window.addEventListener("load", main); + document.addEventListener("DOMContentLoaded", main); + + // function ready() { + // console.info( 'DOM готов' ); + // // alert( "Размеры картинки: " + img.offsetWidth + "x" + img.offsetHeight ); + // } - window.addEventListener("load", main); + // document.addEventListener("DOMContentLoaded", ready); })(); diff --git a/templates/client/accounts/feed.html b/templates/client/accounts/feed.html index c8f14674..ea05fe26 100644 --- a/templates/client/accounts/feed.html +++ b/templates/client/accounts/feed.html @@ -13,6 +13,11 @@

    {% trans 'Моя лента событий' %}

    {% endblock %} +{% if object_list %} + {% block head_scripts %} + + {% endblock head_scripts %} +{% endif %} {% block page_body %}
    diff --git a/templates/client/accounts/user_events.html b/templates/client/accounts/user_events.html index 0bcfade7..c7d134a0 100644 --- a/templates/client/accounts/user_events.html +++ b/templates/client/accounts/user_events.html @@ -15,11 +15,16 @@

    {% if meta %}{{ meta.h1 }}{% else %}{{ event_type }}{% endif %}

    - {% endblock %} +{% if object_list %} + {% block head_scripts %} + + {% endblock head_scripts %} +{% endif %} + {% block content_list %} {% with object_list=object_list %} {% include 'includes/exposition/exposition_list.html' %} {% endwith %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/client/blank.html b/templates/client/blank.html index 605e7c6b..a4df0c0d 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -45,9 +45,22 @@ This template include basic anf main styles and js files, + {% block head_scripts %} {% endblock %} + + + + + {% if request.GET.debug == '1' %} {% else %} @@ -177,15 +190,6 @@ This template include basic anf main styles and js files, {% endif %} - - - + diff --git a/templates/client/city/city.html b/templates/client/city/city.html index 0b15857e..21a6027a 100644 --- a/templates/client/city/city.html +++ b/templates/client/city/city.html @@ -12,6 +12,12 @@ {% block page_title %} {% endblock %} +{% if object.get_events %} + {% block head_scripts %} + + {% endblock head_scripts %} +{% endif %} + {% block content_list %}
    @@ -141,4 +147,4 @@
    {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/client/country/country.html b/templates/client/country/country.html index 696be820..e788083b 100644 --- a/templates/client/country/country.html +++ b/templates/client/country/country.html @@ -12,6 +12,12 @@ {% block page_title %} {% endblock %} +{% if object.get_events %} + {% block head_scripts %} + + {% endblock head_scripts %} +{% endif %} + {% block content_list %}
    @@ -178,4 +184,4 @@ {% include 'includes/organiser/organiser_list.html' with object_list=object.get_organisers %}
    {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/client/exposition/catalog.html b/templates/client/exposition/catalog.html index cb8941dc..f36c3035 100644 --- a/templates/client/exposition/catalog.html +++ b/templates/client/exposition/catalog.html @@ -21,6 +21,11 @@
    {% endblock %} +{% if object_list %} + {% block head_scripts %} + + {% endblock head_scripts %} +{% endif %} {% block page_title %}
    @@ -38,4 +43,4 @@ {% block paginator %} {% include 'includes/catalog_paginator.html' with page_obj=page_obj %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/client/exposition/catalog_theme.html b/templates/client/exposition/catalog_theme.html index 8d199340..6a6450c9 100644 --- a/templates/client/exposition/catalog_theme.html +++ b/templates/client/exposition/catalog_theme.html @@ -1,6 +1,14 @@ {% extends 'base_catalog.html' %} {% load template_filters %} {% load i18n %} +{% load static %} + +{% if object_list %} + {% block head_scripts %} + + {% endblock head_scripts %} +{% endif %} + {% block bread_scrumbs %} {% endblock %} - {% block page_title %}

    {% if meta %}{{ meta.h1 }}{% else %}{% trans 'Выставки' %}: {{ filter_object.name }}{% endif %}

    @@ -61,4 +68,4 @@ {% block paginator %} {% include 'includes/catalog_paginator.html' with page_obj=page_obj %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/client/includes/banners/tops.html b/templates/client/includes/banners/tops.html index f1678855..3a496741 100644 --- a/templates/client/includes/banners/tops.html +++ b/templates/client/includes/banners/tops.html @@ -1,7 +1 @@ -{% load static %} - -
    - -
    - - \ No newline at end of file +
    diff --git a/templates/client/includes/footer.html b/templates/client/includes/footer.html index 0cbe4ab9..cadc8dc4 100644 --- a/templates/client/includes/footer.html +++ b/templates/client/includes/footer.html @@ -58,8 +58,8 @@ //-->
  • - - + Яндекс цитирования
  • - + diff --git a/templates/client/includes/social_widjet.html b/templates/client/includes/social_widjet.html index 33ab8299..b78ef258 100644 --- a/templates/client/includes/social_widjet.html +++ b/templates/client/includes/social_widjet.html @@ -7,7 +7,6 @@ - {% else %}