diff --git a/static/mailing_settings/css/main.css b/static/mailing_settings/css/main.css index 75a35655..7ee670b9 100644 --- a/static/mailing_settings/css/main.css +++ b/static/mailing_settings/css/main.css @@ -583,4 +583,47 @@ h3{ .modal_checkboxes .label{ padding-left: 14px; +} + +.buttons_block{ + padding-top: 25px; +} + +.buttons_block button{ + display: inline-block; + vertical-align: top; + height: 40px; + border: 1px solid #fff; + outline: 0; + color: #fff; + font-family: dindisplay_pro,Arial,sans-serif; + font-weight: 700; + font-size: 15px; + line-height: 41px; + text-transform: uppercase; + padding: 0 25px; + border-radius: 4px; + -moz-box-sizing: border-box; + box-sizing: border-box; + box-shadow: 0 1px 0 rgba(0,0,0,.2),inset 0 1px 0 rgba(0,0,0,.2); + -webkit-filter: none; + filter: none; +} + +.buttons_block .modal-approve{ + background: #f60; + background: -webkit-gradient(linear,left top,left bottom,color-stop(0,#ff8000),color-stop(100%,#f60)); + background: -webkit-linear-gradient(top,#ff8000 0,#f60 100%); + background: -o-linear-gradient(top,#ff8000 0,#f60 100%); + background: -webkit-linear-gradient(top,#ff8000 0,#f60 100%); + background: -o-linear-gradient(top,#ff8000 0,#f60 100%); + background: linear-gradient(to bottom,#ff8000 0,#f60 100%); +} + +.buttons_block button:hover{ + margin-top: -1px; +} + +.modals{ + display: none; } \ No newline at end of file diff --git a/static/mailing_settings/js/main.js b/static/mailing_settings/js/main.js index 1aff1cbc..2abd1401 100644 --- a/static/mailing_settings/js/main.js +++ b/static/mailing_settings/js/main.js @@ -3,6 +3,10 @@ // Выбор тем (function () { var $themes_modal = $('.popup-window.themes'), + $themes_select = $('#id_th'), + $tags_select = $('#id_tg'), + $selected_themes = $('#selected_themes'), + $selected_tags = $('#selected_tags'), user_choice = { th: {}, tg: {} @@ -12,6 +16,7 @@ return '
  • ' + '' + @@ -29,6 +34,10 @@ $sub_list .addClass('has_items') .append($sub_item); + + $tags_select.find('option').each(function () { + $themes_modal.find('.sub.has_items input[name="tg"][value="' + $(this).val() + '"]').prop('checked', true); + }); }); $loader.hide(); @@ -44,6 +53,25 @@ '
  • ' }; + // Записываем данные в user_chice при инициализации + $themes_select.find('option').each(function () { + $themes_modal.find('input[name="th"][value="' + $(this).val() + '"]').prop('checked', true); + + user_choice['th'][$(this).val()] = $(this).text(); + + var $theme = $(renderSelectedThemes($(this).val(), 'th', $(this).text())); + $selected_themes.append($theme); + }); + + + // Записываем данные в 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); + }); + + // открываем список тегов в теме $themes_modal.on('click', '.trigger', function (e) { e.preventDefault(); @@ -78,10 +106,8 @@ $themes_modal.on('click', '.modal-approve', function (e) { e.preventDefault(); - var $selected_themes = $('#selected_themes'), - $selected_tags = $('#selected_tags'); - $selected_themes.html(''); + $selected_tags.html(''); for (var theme_id in user_choice['th']) { var $theme = $(renderSelectedThemes(theme_id, 'th', user_choice['th'][theme_id])); @@ -95,20 +121,14 @@ $.fancybox.close(); }); - - if (checked_th.length){ - $.each(checked_th, function (i,val) { - console.log(val); - $('input[name="th"][value=' + val + ']').prop('checked', true); - - }); - } })(); // Выбор городов (function () { var $cities_modal = $('.popup-window.r_cities'), + $selected_cities = $('#selected_cities'), + $cities_select = $('#id_r_cities'), selected_cities = {}, renderSelectedCities = function (id, text) { @@ -119,6 +139,16 @@ '' }; + // Записываем данные в user_chice при инициализации + $cities_select.find('option').each(function () { + $cities_modal.find('input[name="r_cities"][value="' + $(this).val() + '"]').prop('checked', true); + + selected_cities[$(this).val()] = $(this).text(); + + var $city = $(renderSelectedCities($(this).val(), $(this).text())); + $selected_cities.append($city); + }); + $cities_modal.on('change', 'input[type="checkbox"]', function (e) { e.preventDefault(); var $checkbox = $(this); @@ -135,7 +165,6 @@ $cities_modal.on('click', '.modal-approve', function (e) { e.preventDefault(); - var $selected_cities = $('#selected_cities'); $selected_cities.html(''); for (var city_id in selected_cities) { diff --git a/templates/client/accounts/mailing_settings.html b/templates/client/accounts/mailing_settings.html index 68be3828..0dff0094 100644 --- a/templates/client/accounts/mailing_settings.html +++ b/templates/client/accounts/mailing_settings.html @@ -35,12 +35,12 @@ {{ form.th.label_tag }} {{ form.th }} + {% trans 'Уточнить темы' %} -

    {% trans 'Теги' %}

    - {{ form.tg.label_tag }} + {#

    {% trans 'Теги' %}

    #} + {{ form.tg }} -
    @@ -185,10 +185,32 @@