File tree Expand file tree Collapse file tree 5 files changed +34
-7
lines changed Expand file tree Collapse file tree 5 files changed +34
-7
lines changed Original file line number Diff line number Diff line change 7
7
< link rel ="stylesheet " type ="text/css " href ="{{{appRoot}}}/css/app.css ">
8
8
< link rel ="stylesheet " type ="text/css " href ="{{{appRoot}}}/styleguide.css ">
9
9
< link rel ="stylesheet " type ="text/css " href ="{{{appRoot}}}/styleguide_pseudo_styles.css ">
10
- < title > {{title}} </ title >
10
+ < title ng-bind =" $root.pageTitle " > </ title >
11
11
{{{extraHead}}}
12
12
{{#filesConfig}}
13
13
< script type ="text/javascript ">
Original file line number Diff line number Diff line change @@ -21,8 +21,16 @@ angular.module('sgApp', [
21
21
. state ( 'app.index.overview' , {
22
22
url : '/overview' ,
23
23
templateUrl : 'overview.html' ,
24
- controller : function ( $rootScope ) {
24
+ controller : function ( $rootScope , Styleguide ) {
25
25
$rootScope . currentSection = 'overview' ;
26
+
27
+ $rootScope . $watch ( function ( ) {
28
+ return Styleguide . config . data ;
29
+ } , function ( newVal , oldVal ) {
30
+ if ( newVal ) {
31
+ $rootScope . pageTitle = newVal . title ;
32
+ }
33
+ } ) ;
26
34
}
27
35
} )
28
36
. state ( 'app.index.section' , {
Original file line number Diff line number Diff line change @@ -14,6 +14,30 @@ angular.module('sgApp')
14
14
return ! / ( [ 0 - 9 ] \. ) / . test ( section . reference ) ;
15
15
}
16
16
17
+ $rootScope . $watch ( function ( ) {
18
+ return Styleguide . sections . data ;
19
+ } , function ( newVal , oldVal ) {
20
+ parseStateHeading ( $scope . currentSection ) ;
21
+ } ) ;
22
+
23
+ $rootScope . $watch ( function ( ) {
24
+ return Styleguide . config . data ;
25
+ } , function ( newVal , oldVal ) {
26
+ parseStateHeading ( $scope . currentSection ) ;
27
+ } ) ;
28
+
29
+ function parseStateHeading ( section ) {
30
+ if ( section === 'all' && typeof Styleguide . config . data !== 'undefined' ) {
31
+ $rootScope . pageTitle = 'All sections - ' + Styleguide . config . data . title ;
32
+ } else if ( typeof Styleguide . sections . data !== 'undefined' ) {
33
+ for ( var i = 0 ; i < Styleguide . sections . data . length ; i ++ ) {
34
+ if ( Styleguide . sections . data [ i ] . reference == section ) {
35
+ $rootScope . pageTitle = Styleguide . sections . data [ i ] . header + ' - ' + Styleguide . config . data . title
36
+ }
37
+ } ;
38
+ }
39
+ }
40
+
17
41
// Check section level (main/sub/sub-sub/sub-sub-sub)
18
42
$scope . getLevel = function ( section ) {
19
43
if ( / ( [ 0 - 9 ] \. [ 0 - 9 ] \. [ 0 - 9 ] \. ) / . test ( section . reference ) ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ <h1 class="sg">{{ config.data.title }}</h1>
8
8
</ div >
9
9
</ div >
10
10
</ header >
11
-
12
11
< div class ="sg wrapper " ng-class ="isNavCollapsed ? 'collapsed' : '' ">
13
12
< div class ="sg side-nav-toggle "
14
13
ng-click ="isNavCollapsed = !isNavCollapsed ">
Original file line number Diff line number Diff line change @@ -72,10 +72,6 @@ describe('index.html', function() {
72
72
expect ( indexHtml ) . to . be . an ( 'object' ) ;
73
73
} ) ;
74
74
75
- it ( 'should contain correct title' , function ( ) {
76
- expect ( indexHtml . contents . toString ( ) ) . to . contain ( '<title>Test Styleguide</title>' ) ;
77
- } ) ;
78
-
79
75
it ( 'should contain CSS style passed as parameter' , function ( ) {
80
76
expect ( indexHtml . contents . toString ( ) ) . to . contain ( '<link rel="stylesheet" type="text/css" href="your/custom/style.css">' ) ;
81
77
} ) ;
You can’t perform that action at this time.
0 commit comments