diff --git a/.gitignore b/.gitignore index 53476e0..2c196d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ -static/* +static/ *.pyc +<<<<<<< HEAD frontend/static/* -zsite/static/vendor/* \ No newline at end of file +zsite/static/vendor/* +======= +frontend/static/ +zsite/static/vendor/ +_env/ +media/ +>>>>>>> 7b75258... Поправил поиск по всем классам 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, ' классе', ' классах', ' классах') : 'во всех классах' }}