diff --git a/lib/app/js/controllers/sections.js b/lib/app/js/controllers/sections.js index b772e780..07eda24b 100644 --- a/lib/app/js/controllers/sections.js +++ b/lib/app/js/controllers/sections.js @@ -37,6 +37,10 @@ angular.module('sgApp') } } + $scope.isMainSection = function(section) { + return section.reference.indexOf('.') === -1; + }; + $scope.isEmptyMainSection = function(section) { return section.reference.indexOf('.') === -1 && !section.renderMarkup && (!section.modifiers || section.modifiers.length === 0); }; diff --git a/lib/app/views/main.html b/lib/app/views/main.html index 02d97c7b..8e0f2b26 100644 --- a/lib/app/views/main.html +++ b/lib/app/views/main.html @@ -55,6 +55,7 @@

Error: {{status.error.name}}

+ diff --git a/lib/app/views/sections.html b/lib/app/views/sections.html index c8458f51..f4514260 100644 --- a/lib/app/views/sections.html +++ b/lib/app/views/sections.html @@ -1,4 +1,31 @@
-
\ No newline at end of file + +
+ + + +
\ No newline at end of file diff --git a/test/angular/unit/controllers/sections.test.js b/test/angular/unit/controllers/sections.test.js index d6bf1622..3a0455c5 100644 --- a/test/angular/unit/controllers/sections.test.js +++ b/test/angular/unit/controllers/sections.test.js @@ -87,6 +87,16 @@ describe('SectionsCtrl', function() { }); describe('empty main section detection', function() { + it('should return true if main section', function() { + var section = { + header: 'Section header text', + reference: '1', + renderMarkup: '', + markup: '' + }; + expect(scope.isMainSection(section)).to.eql(true); + }); + it('should return true for empty main sections', function() { var section = { header: 'Section header text',