diff --git a/frontend/frontend/locale/ru/LC_MESSAGES/django.mo b/frontend/frontend/locale/ru/LC_MESSAGES/django.mo index 797f17a..3d7f410 100644 Binary files a/frontend/frontend/locale/ru/LC_MESSAGES/django.mo and b/frontend/frontend/locale/ru/LC_MESSAGES/django.mo differ diff --git a/frontend/frontend/locale/ru/LC_MESSAGES/django.po b/frontend/frontend/locale/ru/LC_MESSAGES/django.po index 059a72e..2864136 100644 --- a/frontend/frontend/locale/ru/LC_MESSAGES/django.po +++ b/frontend/frontend/locale/ru/LC_MESSAGES/django.po @@ -93,7 +93,7 @@ msgstr "Предпросмотр" #: templates/frontend/setup.html:46 msgid "xpath.link" -msgstr "" +msgstr "http://zvon.org/xxl/XPathTutorial/Output_rus/examples.html" #: templates/frontend/setup.html:54 msgid "setup.you_are_creating_feed_with" diff --git a/frontend/frontend/setup_tool.py b/frontend/frontend/setup_tool.py index a786813..648e874 100644 --- a/frontend/frontend/setup_tool.py +++ b/frontend/frontend/setup_tool.py @@ -161,5 +161,6 @@ def build_xpathes_for_items(item_tag_ids, html_json): item_xpathes[name] = '/'.join([repr(path_item) for path_item in selection_pathes[name]]) else: item_xpathes[name] = '.' + item_xpathes[name] += '/child::node()' return [feed_xpath, item_xpathes] diff --git a/frontend/frontend/static/frontend/assets/js/setup-tool-ext.js b/frontend/frontend/static/frontend/assets/js/setup-tool-ext.js index 8b6142c..f36cef4 100644 --- a/frontend/frontend/static/frontend/assets/js/setup-tool-ext.js +++ b/frontend/frontend/static/frontend/assets/js/setup-tool-ext.js @@ -37,25 +37,37 @@ function check_pathes(pathes) { var _config = ['', {}]; var _active = false; +var _validated = false; function updateSelector(name, messages) { var control_group = $('#ste-'+ name).parent().parent(); var help_text = control_group.find('.help-inline'); + if ('error' in messages) { control_group.removeClass('info').addClass('error'); help_text.text(messages['error']); } - else { + else if ('count' in messages || $('#ste-'+ name).val().trim()) { + if (!('count' in messages)) + messages['count'] = 0; control_group.removeClass('error').addClass('info'); help_text.text(help_text.attr('count-tpl').replace('%s', messages['count'])); } + else { + control_group.removeClass('error').removeClass('info'); + help_text.text(''); + } } // show status and error messages function updateUIMessages(data) { updateSelector('parent', data[0]); - for (name in data[1]) - updateSelector(name, data[1][name]); + ['title', 'description', 'link'].forEach(function(name){ + if (name in data[1]) + updateSelector(name, data[1][name]); + else + updateSelector(name, {}); + }); } function updateUI(config) { @@ -103,6 +115,9 @@ function changed() { function active() { return _active; } +function validate() { + return _validate; +} window.ET = { 'showIcon': showIcon, @@ -111,7 +126,8 @@ window.ET = { 'updateUI': updateUI, 'updateUIMessages': updateUIMessages, 'getUIConfig': getUIConfig, - 'active': active + 'active': active, + 'validate': validate }; function show_ext(show) { @@ -137,6 +153,10 @@ $(document).ready(function(){ return true; }); + $("input[id^='ste-']").keyup(function(){ + $("#check")[0].style.display = changed() ? 'inline-block' : 'none'; + }); + /*var cfg = read('xpathes') if (cfg) { updateUI(cfg); diff --git a/frontend/frontend/templates/frontend/setup.html b/frontend/frontend/templates/frontend/setup.html index e98cfd4..bd7f654 100644 --- a/frontend/frontend/templates/frontend/setup.html +++ b/frontend/frontend/templates/frontend/setup.html @@ -60,14 +60,16 @@