luyadev/luya-module-cms

View on GitHub
src/admin/resources/js/cmsadmin.js

Summary

Maintainability
F
2 wks
Test Coverage

File cmsadmin.js has 1405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
    "use strict";
    
    // directive.js

Severity: Major
Found in src/admin/resources/js/cmsadmin.js - About 3 days to fix

    Function controller has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                controller : ['$scope', '$http', '$filter', 'ServiceMenuData', 'ServiceLanguagesData', 'AdminToastService', 'ServiceCurrentWebsite', function($scope, $http, $filter, ServiceMenuData, ServiceLanguagesData, AdminToastService, ServiceCurrentWebsite) {
    
                    $scope.error = [];
                    $scope.success = false;
    
    
    Severity: Major
    Found in src/admin/resources/js/cmsadmin.js - About 2 hrs to fix

      Function controller has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  controller : ['$scope', function($scope) {
      
                      $scope.changeModel = function(data) {
                          $scope.navId = data.id;
                      }
      Severity: Major
      Found in src/admin/resources/js/cmsadmin.js - About 2 hrs to fix

        Function initializer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function initializer() {
                    $scope.navData = $filter('filter')($scope.menuData.items, {id: $scope.id}, true)[0];
                    if ($scope.navData == undefined) {
                        $scope.isDraft = true;
                    } else {
        Severity: Minor
        Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

          Function updateNavItemData has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  $scope.updateNavItemData = function(itemCopy, typeDataCopy) {
                      $scope.errors = [];
                      var headers = {"headers" : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" }};
                      var navItemId = itemCopy.id;
          
          
          Severity: Minor
          Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

            Function dropItem has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    $scope.dropItem = function(dragged,dropped,position,element) {
                        var sortIndex = $scope.$index;
                        
                        if (position == 'bottom') {
                            sortIndex = sortIndex + 1;
            Severity: Minor
            Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

              Function getItem has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      $scope.getItem = function(langId, navId) {
                          $http({
                              url: 'admin/api-cms-navitem/nav-lang-item',
                              method: "GET",
                              params: { langId : langId, navId : navId }
              Severity: Minor
              Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                Function controller has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            controller : ['$scope', '$http', function($scope, $http) {
                
                                $scope.modules = [];
                                $scope.controllers = [];
                                $scope.actions = [];
                Severity: Minor
                Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                  Function dropItemPlaceholder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          $scope.dropItemPlaceholder = function(dragged,dropped,position) {
                              if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
                                  // its a new block
                                  $http.post('admin/api-cms-navitempageblockitem/create', {
                                      prev_id : dropped.prev_id,
                  Severity: Minor
                  Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                    Function dropItemPlaceholder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            $scope.dropItemPlaceholder = function(dragged,dropped,position) {
                                if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
                                    // its a new block
                                    $http.post('admin/api-cms-navitempageblockitem/create', {
                                        prev_id: dropped.prev_id, 
                    Severity: Minor
                    Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                      Function controller has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  controller : ['$scope', '$http', function($scope, $http) {
                      
                                      $scope.parent = $scope.$parent.$parent;
                                      $scope.navItemId = $scope.parent.item.id;
                      
                      
                      Severity: Minor
                      Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                        Function controller has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    controller : ['$scope', 'ServiceLayoutsData', 'ServiceMenuData', function($scope, ServiceLayoutsData, ServiceMenuData) {
                        
                                        $scope.data.use_draft = 0;
                                        $scope.data.layout_id = 0;
                                        $scope.data.from_draft_id = 0;
                        Severity: Minor
                        Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                          Function controller has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                      controller : ['$scope', '$http', '$filter', 'ServiceMenuData', 'ServiceLanguagesData', 'AdminToastService', 'ServiceCurrentWebsite', function($scope, $http, $filter, ServiceMenuData, ServiceLanguagesData, AdminToastService, ServiceCurrentWebsite) {
                          Severity: Major
                          Found in src/admin/resources/js/cmsadmin.js - About 50 mins to fix

                            Function renderTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    $scope.renderTemplate = function(template, dataVars, cfgVars, block, extras) {
                            Severity: Minor
                            Found in src/admin/resources/js/cmsadmin.js - About 35 mins to fix

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                          return $q(function(resolve, reject) {
                              
                                              if ($scope.data.nav_item_type == 1) {
                                                  $http.post('admin/api-cms-nav/create-page', $.param($scope.data), headers).then(function(response) {
                                                      resolve(response.data);
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 day to fix
                              src/admin/resources/js/cmsadmin.js on lines 845..870

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 275.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                          return $q(function(resolve, reject) {
                              
                                              if ($scope.data.nav_item_type == 1) {
                                                  $http.post('admin/api-cms-nav/create-page-item', $.param($scope.data), headers).then(function(response) {
                                                      resolve(response.data);
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 day to fix
                              src/admin/resources/js/cmsadmin.js on lines 802..827

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 275.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $scope.$watch(function() { return $scope.navData.is_hidden }, function(n, o) {
                                                  if (n !== o && n !== undefined) {
                                                      $http.get('admin/api-cms-nav/toggle-hidden', { params : { navId : $scope.navData.id , hiddenStatus : n }}).then(function(response) {
                                                          if ($scope.navData.is_hidden == 1) {
                                                              AdminToastService.info(i18nParam('js_state_hidden', {title: $scope.navData.title}));
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 7 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 1095..1105

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 187.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $scope.$watch(function() { return $scope.navData.is_offline }, function(n, o) {
                                                  if (n !== o && n !== undefined) {
                                                      $http.get('admin/api-cms-nav/toggle-offline', { params : { navId : $scope.navData.id , offlineStatus : n }}).then(function(response) {
                                                          if ($scope.navData.is_offline == 1) {
                                                              AdminToastService.info(i18nParam('js_state_offline', {title: $scope.navData.title}));
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 7 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 1107..1117

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 187.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                          } else if (dragged.hasOwnProperty('copystack')) {
                                              // its a block from copy stack
                                              $http.post('admin/api-cms-navitemblock/copy-block-from-stack', {
                                                  copyBlockId: dragged.id,
                                                  sort_index: 0,
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 1459..1490

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 94.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                          if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
                                              // its a new block
                                              $http.post('admin/api-cms-navitempageblockitem/create', {
                                                  prev_id: dropped.prev_id, 
                                                  sort_index:0, 
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 1470..1490

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 94.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                          angular.forEach($scope.block.vars, function(varItem) {
                                              if (varItem.required && $scope.isEmpty($scope.data, varItem.var)) {
                                                  AdminToastService.error(i18nParam('js_block_attribute_empty', {label: varItem.label}));
                                                  response = true;
                                              }
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 1727..1733

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 91.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                          angular.forEach($scope.block.cfgs, function(varItem) {
                              
                                              if (varItem.required && $scope.isEmpty($scope.cfgdata, varItem.var)) {
                                                  AdminToastService.error(i18nParam('js_block_attribute_empty', {label: varItem.label}));
                                                  response = true;
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 1720..1725

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 91.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $scope.arrayToSelect = function(input, valueField, labelField) {
                                                  var output = [];
                                                  angular.forEach(input, function(value) {
                                                      output.push({"label": value[labelField], "value": value[valueField]});
                                                  });
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 276..282

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 78.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $scope.arrayToSelect = function(input, valueField, labelField) {
                                                  var output = [];
                                                  angular.forEach(input, function(value) {
                                                      output.push({"label": value[labelField], "value": value[valueField]});
                                                  });
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
                              src/admin/resources/js/cmsadmin.js on lines 338..344

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 78.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $scope.$watch('data.alias', function(n, o) {
                                                  if (n!=o && n!=null) {
                                                      $scope.data.alias = $filter('slugify')(n);
                                                  }
                                              });
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 1289..1293

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 61.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      $scope.$watch('itemCopy.alias', function(n, o) {
                                          if (n!=o && n!=null) {
                                              $scope.itemCopy.alias = $filter('slugify')(n);
                                          }
                                      });
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 230..234

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 61.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      $scope.removeFromFav = function(item) {
                                          $http.post('admin/api-cms-block/remove-fav', {block: item }).then(function(response) {
                                              $scope.blocksDataReload();
                                          });
                                      };
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 1787..1791

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 59.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      $scope.addToFav = function(item) {
                                          $http.post('admin/api-cms-block/to-fav', {block: item }).then(function(response) {
                                              $scope.blocksDataReload();
                                          });
                                      };
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 1793..1797

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 59.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                                      $http.get('admin/api-cms-navitem/get-nav-container-name', { params : { navId : $scope.navId }}).then(function(response) {
                                                          $scope.container = response.data;
                                                      });
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 147..149

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 57.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $http.post('admin/api-cms-navitemblock/copy-block-from-stack', {
                                                  copyBlockId: dragged.id,
                                                  sort_index: 0,
                                                  prev_id:  dropped.prev_id,
                                                  placeholder_var : dropped.var,
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 1512..1520

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 57.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                                      $http.get('admin/api-cms-navitem/get-nav-item-path', { params : { navId : $scope.navId }}).then(function(response) {
                                                          $scope.path = response.data;
                                                      });
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 150..152

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 57.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $http.post('admin/api-cms-navitempageblockitem/create', {
                                                  prev_id : dropped.prev_id,
                                                  sort_index:0, 
                                                  block_id : dragged.id,
                                                  placeholder_var : dropped.var,
                              Severity: Major
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 hr to fix
                              src/admin/resources/js/cmsadmin.js on lines 1523..1531

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 57.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      $scope.isEditable = function() {
                                          return typeof $scope.block.vars != "undefined" && $scope.block.vars.length > 0;
                                      };
                              Severity: Minor
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 55 mins to fix
                              src/admin/resources/js/cmsadmin.js on lines 1622..1624

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 53.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      $scope.isConfigurable = function() {
                                          return typeof $scope.block.cfgs != "undefined" && $scope.block.cfgs.length > 0;
                                      };
                              Severity: Minor
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 55 mins to fix
                              src/admin/resources/js/cmsadmin.js on lines 1618..1620

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 53.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                              $scope.aliasSuggestion = function() {
                                                  $scope.data.alias = $filter('slugify')($scope.data.title);
                                              };
                              Severity: Minor
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 35 mins to fix
                              src/admin/resources/js/cmsadmin.js on lines 594..597

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 47.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      $scope.aliasSuggestion = function() {
                                          
                                          $scope.itemSelection.alias = $filter('slugify')($scope.itemSelection.title);
                                      };
                              Severity: Minor
                              Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 35 mins to fix
                              src/admin/resources/js/cmsadmin.js on lines 226..228

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 47.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              There are no issues that match your filters.

                              Category
                              Status