Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b24bb5

Browse files
committed
Add lesson 2
1 parent c97d834 commit 9b24bb5

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

‎js/main.js‎

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,44 @@
2020
"Our terminal prompt below is currently in a directory we decided to name 'octobox'. To initialize a Git repository here, type the following command:"
2121
],
2222
"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+
],
2426
"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+
],
2652
"repoStatus": "Empty"
2753
}
2854
}
2955
}`;
3056
var lecciones = JSON.parse(file).lecciones;
57+
// console.log(lecciones);
3158
var config = JSON.parse(file).config;
3259

33-
var leccionActual = 0;
60+
var leccionActual = 1;
3461

3562
var consoleArea = document.querySelector('.console-area');
3663
var textarea = document.querySelector('#console-input');
@@ -40,7 +67,6 @@
4067
var areaTareas = document.querySelector('.tareas');
4168

4269
function actualizarInstrucciones() {
43-
leccionActual++;
4470
// Actualizar titulo y orden
4571
let titulo = document.querySelector('#instrucciones h3 .titulo');
4672
titulo.innerHTML = lecciones[leccionActual].titulo;
@@ -51,7 +77,11 @@
5177
let button = document.querySelector('#instrucciones button');
5278
button.innerHTML = lecciones[leccionActual].comando;
5379

54-
// Actualizar tareas
80+
// Limpiar areaTareas
81+
while (areaTareas.firstChild) {
82+
areaTareas.removeChild(areaTareas.firstChild);
83+
}
84+
// Agregar nuevas Tareas
5585
for (var i = 0; i < lecciones[leccionActual].tareas.length; i++) {
5686
// let parrafo = document.createElement("P");
5787
// let tarea = document.createTextNode(lecciones[leccionActual].tareas[i]);
@@ -83,8 +113,9 @@
83113
consoleArea.appendChild(parrafo);
84114
}
85115
} 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);
88119
console.log(RegExp("(git)", "g").test(textarea.value.trim()));
89120
}
90121
// Red error message
@@ -122,9 +153,11 @@
122153
lineaActual.innerHTML = '<span>$ </span><textarea id="console-input" spellcheck="false"></textarea>';
123154
// Ayudar listener para el textarea
124155
addTextareaListener();
156+
console.log(leccionActual);
157+
actualizarInstrucciones();
125158
textarea.value = "";
126159
textarea.focus();
127-
}, 2000);
160+
}, 1000);
128161

129162
}
130163

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /