|
20 | 20 | "Our terminal prompt below is currently in a directory we decided to name 'octobox'. To initialize a Git repository here, type the following command:" |
21 | 21 | ], |
22 | 22 | "comando": "git init", |
23 | | - "errorMessages": ["fatal: Not a git repository (or any of the parent directories): .git"], |
| 23 | + "errorMessages": [ |
| 24 | + "fatal: Not a git repository (or any of the parent directories): .git" |
| 25 | + ], |
24 | 26 | "alert": "Did not create a Git repo", |
25 | | - "successMessages": ["Initialized empty Git repository in /.git/"], |
| 27 | + "successMessages": [ |
| 28 | + "Initialized empty Git repository in /.git/" |
| 29 | + ], |
| 30 | + "repoStatus": "Empty" |
| 31 | + }, |
| 32 | + "2": { |
| 33 | + "orden": "1.2", |
| 34 | + "titulo": "Checking the Status", |
| 35 | + "tareas": [ |
| 36 | + "Good job! As Git just told us, our 'octobox' directory now has an empty repository in /.git/. The repository is a hidden directory where Git operates.", |
| 37 | + "To save your progress as you go through this tutorial -- and earn a badge when you successfully complete it -- head over to create a free Code School account. We'll wait for you here.", |
| 38 | + "Next up, let's type the git status command to see what the current state of our project is:" |
| 39 | + ], |
| 40 | + "comando": "git status", |
| 41 | + "errorMessages": [ |
| 42 | + "fatal: Not a git repository (or any of the parent directories): .git" |
| 43 | + ], |
| 44 | + "alert": "Did not use git status", |
| 45 | + "successMessages": [ |
| 46 | + "# On branch master", |
| 47 | + "#", |
| 48 | + "# Initial commit", |
| 49 | + "#", |
| 50 | + "nothing to commit (create/copy files and use 'git add' to track)" |
| 51 | + ], |
26 | 52 | "repoStatus": "Empty" |
27 | 53 | } |
28 | 54 | } |
29 | 55 | }`; |
30 | 56 | var lecciones = JSON.parse(file).lecciones; |
| 57 | + // console.log(lecciones); |
31 | 58 | var config = JSON.parse(file).config; |
32 | 59 |
|
33 | | - var leccionActual = 0; |
| 60 | + var leccionActual = 1; |
34 | 61 |
|
35 | 62 | var consoleArea = document.querySelector('.console-area'); |
36 | 63 | var textarea = document.querySelector('#console-input'); |
|
40 | 67 | var areaTareas = document.querySelector('.tareas'); |
41 | 68 |
|
42 | 69 | function actualizarInstrucciones() { |
43 | | - leccionActual++; |
44 | 70 | // Actualizar titulo y orden |
45 | 71 | let titulo = document.querySelector('#instrucciones h3 .titulo'); |
46 | 72 | titulo.innerHTML = lecciones[leccionActual].titulo; |
|
51 | 77 | let button = document.querySelector('#instrucciones button'); |
52 | 78 | button.innerHTML = lecciones[leccionActual].comando; |
53 | 79 |
|
54 | | - // Actualizar tareas |
| 80 | + // Limpiar areaTareas |
| 81 | + while (areaTareas.firstChild) { |
| 82 | + areaTareas.removeChild(areaTareas.firstChild); |
| 83 | + } |
| 84 | + // Agregar nuevas Tareas |
55 | 85 | for (var i = 0; i < lecciones[leccionActual].tareas.length; i++) { |
56 | 86 | // let parrafo = document.createElement("P"); |
57 | 87 | // let tarea = document.createTextNode(lecciones[leccionActual].tareas[i]); |
|
83 | 113 | consoleArea.appendChild(parrafo); |
84 | 114 | } |
85 | 115 | } else { |
86 | | - let comandError = crearParrafo(textarea.value + ": " + config.errorComando); |
87 | | - consoleArea.lastElementChild.appendChild(comandError); |
| 116 | + let comandError = crearParrafo(textarea.value + ": " + config.errorComando); |
| 117 | + comandError.style.marginTop |
| 118 | + consoleArea.appendChild(comandError); |
88 | 119 | console.log(RegExp("(git)", "g").test(textarea.value.trim())); |
89 | 120 | } |
90 | 121 | // Red error message |
|
122 | 153 | lineaActual.innerHTML = '<span>$ </span><textarea id="console-input" spellcheck="false"></textarea>'; |
123 | 154 | // Ayudar listener para el textarea |
124 | 155 | addTextareaListener(); |
| 156 | + console.log(leccionActual); |
| 157 | + actualizarInstrucciones(); |
125 | 158 | textarea.value = ""; |
126 | 159 | textarea.focus(); |
127 | | - }, 2000); |
| 160 | + }, 1000); |
128 | 161 |
|
129 | 162 | } |
130 | 163 |
|
|
0 commit comments