diff --git a/static/mailing_settings/js/main.js b/static/mailing_settings/js/main.js index 2abd1401..553fd85f 100644 --- a/static/mailing_settings/js/main.js +++ b/static/mailing_settings/js/main.js @@ -179,6 +179,10 @@ // Выбор стран (function () { var $countries_modal = $('.popup-window.countries'), + $areas_select = $('#id_area'), + $co_select = $('#id_f_countries'), + $selected_areas = $('#selected_areas'), + $selected_co = $('#selected_countries'), user_countries = { area: {}, co: {} @@ -220,6 +224,29 @@ '' }; + // Записываем данные в user_countries при инициализации + $areas_select.find('option[selected]').each(function () { + $countries_modal.find('input[name="area"][value="' + $(this).val() + '"]').prop('checked', true); + + user_countries['area'][$(this).val()] = $(this).text(); + + var $area = $(renderSelectedThemes($(this).val(), 'area', $(this).text())); + $selected_areas.append($area); + }); + + $co_select.find('option[selected]').each(function () { + var $co = $(renderSelectedThemes($(this).val(), 'co', $(this).text())); + $selected_co.append($co); + }); + + + // Записываем данные в user_chice при инициализации + // $tags_select.find('option').each(function () { + // user_choice['tg'][$(this).val()] = $(this).text(); + // var $tag = $(renderSelectedThemes($(this).val(), 'tg', $(this).text())); + // $selected_tags.append($tag); + // }); + // открываем список тегов в теме $countries_modal.on('click', '.trigger', function (e) { e.preventDefault(); @@ -284,5 +311,4 @@ $(function () { $('.scroll-container').mCustomScrollbar(); - }); diff --git a/templates/client/accounts/mailing_settings.html b/templates/client/accounts/mailing_settings.html index f82c73f9..c78b7a8f 100644 --- a/templates/client/accounts/mailing_settings.html +++ b/templates/client/accounts/mailing_settings.html @@ -85,6 +85,7 @@ {% trans 'Выбрать страны' %} +