|
86 | 86 | }; |
87 | 87 |
|
88 | 88 | var HTML_TPL = |
89 | | - '<a ng:init="showInstructions = {show}" ng:show="!showInstructions" ng:click="showInstructions = true" href>Show Instructions</a>' + |
| 89 | + '<p><a ng:init="showInstructions = {show}" ng:show="!showInstructions" ng:click="showInstructions = true" href>Workspace Reset Instructions</a></p>' + |
90 | 90 | '<div ng:controller="TutorialInstructionsCtrl" ng:show="showInstructions">' + |
91 | 91 | '<div class="tabs-nav">' + |
92 | 92 | '<ul>' + |
|
111 | 111 | '<ol>' + |
112 | 112 | '<li><p>Reset the workspace to step {step}.</p>' + |
113 | 113 | '<pre><code> git checkout -f step-{step}</code></pre></li>' + |
114 | | - '<li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-{step}/app">anglar\'s server</a>.</p></li>' + |
| 114 | + '<li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-{step}/app">angular\'s server</a>.</p></li>' + |
115 | 115 | '</ol>' + |
116 | 116 | '</div>' + |
117 | 117 |
|
|
135 | 135 | '<ol>' + |
136 | 136 | '<li><p>Reset the workspace to step {step}.</p>' + |
137 | 137 | '<pre><code> ./goto_step.bat {step}</code></pre></li>' + |
138 | | - '<li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-{step}/app">anglar\'s server</a>.</p></li>' + |
| 138 | + '<li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-{step}/app">angular\'s server</a>.</p></li>' + |
139 | 139 | '</ol>' + |
140 | 140 | '</div>'; |
141 | 141 |
|
|
167 | 167 | element.append(tabs); |
168 | 168 | element.show(); |
169 | 169 | }); |
| 170 | + |
| 171 | + |
| 172 | + angular.directive('doc:tutorial-nav', function(step) { |
| 173 | + return function(element) { |
| 174 | + var prevStep, codeDiff, nextStep, |
| 175 | + content; |
| 176 | + |
| 177 | + step = parseInt(step, 10); |
| 178 | + |
| 179 | + if (step === 0) { |
| 180 | + prevStep = ''; |
| 181 | + nextStep = 'step_01'; |
| 182 | + codeDiff = 'step-0~7...step-0'; |
| 183 | + } else if (step === 11){ |
| 184 | + prevStep = 'step_10'; |
| 185 | + nextStep = 'the_end'; |
| 186 | + codeDiff = 'step-10...step-11'; |
| 187 | + } else { |
| 188 | + prevStep = 'step_' + pad(step - 1) |
| 189 | + nextStep = 'step_' + pad(step + 1); |
| 190 | + codeDiff = 'step-' + step + '...step-' + step; |
| 191 | + } |
| 192 | + |
| 193 | + content = angular.element( |
| 194 | + '<li><a href="#!tutorial/' + prevStep + '">Previous</a></li>' + |
| 195 | + '<li><a href="http://angular.github.com/angular-phonecat/step-' + step + '/app">Live Demo</a></li>' + |
| 196 | + '<li><a href="https://github.com/angular/angular-phonecat/compare/' + codeDiff + '">Code Diff</a></li>' + |
| 197 | + '<li><a href="#!tutorial/' + nextStep + '">Next</a></li>' |
| 198 | + ); |
| 199 | + |
| 200 | + element.attr('id', 'tutorial-nav'); |
| 201 | + element.append(content); |
| 202 | + } |
| 203 | + |
| 204 | + function pad(step) { |
| 205 | + return (step < 10) ? ('0' + step) : step; |
| 206 | + } |
| 207 | + }); |
170 | 208 | })(); |
0 commit comments