angular.module('tutorials', []) .directive('docTutorialNav', function(templateMerge) { var pages = [ '', 'step_00', 'step_01', 'step_02', 'step_03', 'step_04', 'step_05', 'step_06', 'step_07', 'step_08', 'step_09', 'step_10', 'step_11', 'step_12', 'the_end' ]; return { compile: function(element, attrs) { var seq = 1 * attrs.docTutorialNav, props = { seq: seq, prev: pages[seq], next: pages[2 + seq], diffLo: seq ? (seq - 1): '0~1', diffHi: seq }; element.addClass('btn-group'); element.addClass('tutorial-nav'); element.append(templateMerge( '
  • Previous
  • \n' + '
  • Live Demo
  • \n' + '
  • Code Diff
  • \n' + '
  • Next
  • ', props)); } }; }) .directive('docTutorialReset', function() { function tab(name, command, id, step) { return '' + '
    \n' + '
      \n' + '
    1. Reset the workspace to step ' + step + '.

      ' + '
      ' + command + '
    2. \n' + '
    3. Refresh your browser or check the app out on Angular\'s server.

    4. \n' + '
    \n' + '
    \n'; } return { compile: function(element, attrs) { var step = attrs.docTutorialReset; element.html( '
    ' + '

    Workspace Reset Instructions ➤

    ' + '
    \n' + '
    \n' + tab('Git on Mac/Linux', 'git checkout -f step-' + step, 'gitUnix', step) + tab('Git on Windows', 'git checkout -f step-' + step, 'gitWin', step) + '
    \n'); } }; });