From 2da07127e45312ce22d894aa771b8797e9a301a1 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Tue, 24 May 2011 00:49:33 +0200 Subject: Add doc:tutorial-instructions widget --- docs/src/templates/doc_widgets.js | 82 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) (limited to 'docs/src/templates/doc_widgets.js') diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js index 6275012c..a3527c52 100644 --- a/docs/src/templates/doc_widgets.js +++ b/docs/src/templates/doc_widgets.js @@ -85,4 +85,86 @@ return {html: lines.join('\n'), hilite: lineNo.join(',') }; }; + var HTML_TPL = + 'Show Instructions' + + '
' + + '
' + + '' + + '
' + + '
' + + + '
' + + '
'; + + var HTML_NAV = '
  • {title}
  • '; + var HTML_CONTENT = '
    {content}
    '; + + var DEFAULT_NAV = + '
  • Git on Mac/Linux
  • ' + + '
  • Git on Windows
  • ' + + '
  • Snapshots on Mac/Linux
  • ' + + '
  • Snapshots on Windows
  • '; + + var DEFAULT_CONTENT = + '
    ' + + '
      ' + + '
    1. Reset the workspace to step {step}.

      ' + + '
       git checkout -f step-{step}
    2. ' + + '
    3. Refresh your browser or check the app out on anglar\'s server.

    4. ' + + '
    ' + + '
    ' + + + '
    ' + + '
      ' + + '
    1. Reset the workspace to step {step}.

      ' + + '
       git checkout -f step-{step}
    2. ' + + '
    3. Refresh your browser or check the app out on anglar\'s server.

    4. ' + + '
    ' + + '
    ' + + + '
    ' + + '
      ' + + '
    1. Reset the workspace to step {step}.

      ' + + '
       ./goto_step.sh {step}
    2. ' + + '
    3. Refresh your browser or check the app out on anglar\'s server.

    4. ' + + '
    ' + + '
    ' + + + '
    ' + + '
      ' + + '
    1. Reset the workspace to step {step}.

      ' + + '
       ./goto_step.bat {step}
    2. ' + + '
    3. Refresh your browser or check the app out on anglar\'s server.

    4. ' + + '
    ' + + '
    '; + + angular.widget('doc:tutorial-instructions', function(element) { + element.hide(); + this.descend(true); + + var tabs = angular.element(HTML_TPL.replace('{show}', element.attr('show') || 'false')), + nav = tabs.find('.tabs-nav ul'), + content = tabs.find('.tabs-content-inner'), + children = element.children(); + + if (children.length) { + // load custom content + angular.forEach(element.children(), function(elm) { + var elm = angular.element(elm), + id = elm.attr('id'); + + nav.append(HTML_NAV.replace('{title}', elm.attr('title')).replace(/\{id\}/g, id)); + content.append(HTML_CONTENT.replace('{id}', id).replace('{content}', elm.html())); + }); + } else { + // default + nav.append(DEFAULT_NAV); + content.append(DEFAULT_CONTENT.replace(/\{step\}/g, element.attr('step'))); + } + + element.html(''); + element.append(tabs); + element.show(); + }); })(); -- cgit v1.2.3