You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

articles.controller.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536
  1. angular.module('app')
  2. .controller('articlesController', ['$scope', '$stateParams', 'articlesBusiness', 'listControllerBuilder',
  3. function($scope, $stateParams, articlesBusiness, listControllerBuilder) {
  4. $scope.business = articlesBusiness;
  5. $scope.itemType = 'articles';
  6. $scope.defaultOrder = 'id';
  7. listControllerBuilder.create($scope, $stateParams);
  8. $scope.getAddItem = function()
  9. {
  10. return {
  11. title: $scope.query.filter
  12. };
  13. };
  14. $scope.getFilter = function (filter) {
  15. var label = $scope.appUtils.tr('articles.type').toLowerCase();
  16. return filter.replace(new RegExp(label + ': *([a-zA-Z0-9]*)'), function(match, p1)
  17. {
  18. var type = null;
  19. for (var t in $scope.appUtils.articleTypes)
  20. {
  21. var str = $scope.appUtils.articleTypes[t];
  22. if ($scope.appUtils.tr('articles.types.' + str).toLowerCase() == p1.toLowerCase())
  23. {
  24. type = str;
  25. break;
  26. }
  27. }
  28. return type == null ? '' : 'type:' + type;
  29. });
  30. };
  31. $scope.init();
  32. }]);