From 7b752584663733d0b046818eaeafeca22b5f88ec Mon Sep 17 00:00:00 2001 From: Alexander Kondratyev Date: Thu, 9 Mar 2017 12:56:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=20=D0=BF=D0=BE=20=D0=B2?= =?UTF-8?q?=D1=81=D0=B5=D0=BC=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 ++--- trademark/models.py | 5 +++- trademark/static/trademark/js/modal.js | 17 +++++--------- trademark/static/trademark/js/nice_ctrl.js | 2 ++ trademark/static/trademark/js/result.js | 4 ++-- trademark/templates/trademark/modal.html | 2 +- .../templates/trademark/nice_block_busy.html | 4 ++-- .../templates/trademark/search_detail.html | 23 +++++++++++-------- 8 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index aa9e6ed..8b9c96a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -static/* +static/ *.pyc -frontend/static/* -zsite/static/vendor/* +frontend/static/ +zsite/static/vendor/ _env/ media/ \ No newline at end of file diff --git a/trademark/models.py b/trademark/models.py index e5fbbe7..4fccd83 100644 --- a/trademark/models.py +++ b/trademark/models.py @@ -116,7 +116,10 @@ class Keyword(models.Model): @property def nice_objects(self): - nices = self.nices.split(',') + if not self.nices: + nices = range(1,46) + else: + nices = self.nices.split(',') return Nice.objects.filter(nice_id__in=nices) diff --git a/trademark/static/trademark/js/modal.js b/trademark/static/trademark/js/modal.js index fd1f597..788fd23 100644 --- a/trademark/static/trademark/js/modal.js +++ b/trademark/static/trademark/js/modal.js @@ -2,10 +2,9 @@ angular.module('zuykov') .controller('ModalTrademarkSearchCtrl', ['$scope', '$modal', '$location', function ($scope, $modal, $location) { - var selected_nices = $location.search().nices || false; $scope.nice = nicesRu; - $scope.classes_values = selected_nices ? selected_nices.split(',') : []; - $scope.classes = $scope.classes_values.length; + $scope.classes_values = []; + $scope.classes = 0; $scope.animationsEnabled = true; $scope.opened = false; $scope.callback = false; @@ -18,23 +17,18 @@ angular.module('zuykov') controller: 'ModalTrademarkSearchInstanceCtrl', windowClass: 'trademark-search-modal' }); - $scope.opened = true; - $scope.tm_url = false; - modalInstance.result.then(function (classes_values) { - var selected_nices = $location.search().nices || false; + console.log($scope.classes, $scope.classes_values); + modalInstance.result.then(function (classes_values) { $scope.classes_values = classes_values; $scope.classes = $scope.classes_values.length; - $scope.opened = false; - if ($scope.callback) { $scope.callback(); } }, function () { - $scope.opened = false; }); }; @@ -52,8 +46,9 @@ angular.module('zuykov') $scope.categories = nicesCategories; $scope.GetNoun = GetNoun; + $scope.ok = function () { - $modalInstance.close($scope.classes_values); + $modalInstance.close($scope.classes_values || []); }; $scope.cancel = function () { diff --git a/trademark/static/trademark/js/nice_ctrl.js b/trademark/static/trademark/js/nice_ctrl.js index 7d997e8..fa43c58 100644 --- a/trademark/static/trademark/js/nice_ctrl.js +++ b/trademark/static/trademark/js/nice_ctrl.js @@ -2,6 +2,8 @@ angular.module('zuykov') .controller('TrademarkSearchNiceCtrl', ['$scope', '$rootScope', '$location', function ($scope, $rootScope, $location) { + $rootScope.classes_values = []; + $rootScope.classes = 0; $scope.selectedCategory = 1; diff --git a/trademark/static/trademark/js/result.js b/trademark/static/trademark/js/result.js index 1ac3e2d..815d234 100644 --- a/trademark/static/trademark/js/result.js +++ b/trademark/static/trademark/js/result.js @@ -12,13 +12,13 @@ TrademarkSearchResult = (function (resultContainer) { } function prepare_load_more ($container, display_classes) { - var results_count = $container.find(".load-more-result.filtered").size(), + var results_count = $container.find(".load-more-result.filtered").length, showed = 6, $this = $container, $count = $container.find('.load-more-count'), $detail_count = $container.find(".trademark-search-results-detail-count"); - all_count = $container.find(".load-more-result").size(); + all_count = $container.find(".load-more-result").length; total_count += results_count; function update_count() { diff --git a/trademark/templates/trademark/modal.html b/trademark/templates/trademark/modal.html index b13227d..37b1130 100644 --- a/trademark/templates/trademark/modal.html +++ b/trademark/templates/trademark/modal.html @@ -74,7 +74,7 @@ {% verbatim %}
-

Поиск происходит {{ classes == 0 ? 'во всех классах' : 'в ' + classes + GetNoun(classes, ' классе', ' классах', ' классах') }}

+

Поиск происходит {{ classes > 0 ? 'в ' + classes + GetNoun(classes, ' классе', ' классах', ' классах') : 'во всех классах' }}