adding css
This commit is contained in:
parent
45b71573b1
commit
5dd6cc6fb1
1 changed files with 7 additions and 8 deletions
15
game.go
15
game.go
|
@ -35,12 +35,14 @@ func requestHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "text/html")
|
w.Header().Set("Content-Type", "text/html")
|
||||||
i := rand.Intn(len(phrases.Phrases))
|
i := rand.Intn(len(phrases.Phrases))
|
||||||
fmt.Fprintf(w, `
|
fmt.Fprintf(w, `
|
||||||
<meta charset="UTF-8"><html><body>%s
|
<html><meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="https://zom.bi/assets/css/foundation.min.css"><body><header class="header"><h2 class="tagline show-for-medium" style="text-align:center; margin-top:2em;">¿subjuntivo o indicativo?</h2></header><div class="row main">%s<br/>
|
||||||
|
<i>Pon la palabra en la forma adecuada:</i>
|
||||||
<form action="/answer/%d" method="POST">
|
<form action="/answer/%d" method="POST">
|
||||||
<input type="text" autocomplete="off" name="answer" />
|
<input type="text" autocomplete="off" name="answer" />
|
||||||
<input type="submit" value="verifique" />
|
<input type="submit" value="verifique" />
|
||||||
</form>
|
</form>
|
||||||
</body></html>
|
</div></body></html>
|
||||||
`, phrases.Phrases[i].Phrase, i)
|
`, phrases.Phrases[i].Phrase, i)
|
||||||
}
|
}
|
||||||
func answerHandler(w http.ResponseWriter, r *http.Request) {
|
func answerHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -50,7 +52,7 @@ func answerHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
p := phrases.Phrases[i]
|
p := phrases.Phrases[i]
|
||||||
pageContent := "<meta charset=\"UTF-8\"><html><body><b>" + p.Phrase + "</b><br /"
|
pageContent := "<meta charset=\"UTF-8\"><html><link rel=\"stylesheet\" href=\"https://zom.bi/assets/css/foundation.min.css\"><body><header class=\"header\"><h2 class=\"tagline show-for-medium\" style=\"text-align:center; margin-top:2em;\">¿subjuntivo o indicativo?</h2></header><div class=\"row main\"><b>" + p.Phrase + "</b><br /"
|
||||||
if p.Mode == true {
|
if p.Mode == true {
|
||||||
pageContent += "<i>aquí nececitamos el subjuntivo:</i><br />"
|
pageContent += "<i>aquí nececitamos el subjuntivo:</i><br />"
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,7 +60,7 @@ func answerHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
pageContent += p.Answer + "<br /> tu respuesta estaba "
|
pageContent += p.Answer + "<br /> tu respuesta estaba "
|
||||||
if r.FormValue("answer") == p.Answer {
|
if r.FormValue("answer") == p.Answer {
|
||||||
pageContent += "<b>correcta!</b>. Buen hecho<br /"
|
pageContent += "<b>correcta!</b> Buen hecho<br />"
|
||||||
} else {
|
} else {
|
||||||
pageContent += "<b>falsa :'-(</b><br />"
|
pageContent += "<b>falsa :'-(</b><br />"
|
||||||
}
|
}
|
||||||
|
@ -66,7 +68,7 @@ func answerHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if j>=i {
|
if j>=i {
|
||||||
j++
|
j++
|
||||||
}
|
}
|
||||||
pageContent+= "<br />frase nueva: " + phrases.Phrases[j].Phrase + `<br />
|
pageContent+= "<hr /><br />frase nueva: " + phrases.Phrases[j].Phrase + `<br />
|
||||||
<form action="/answer/`+ strconv.Itoa(j) +`" method="POST">
|
<form action="/answer/`+ strconv.Itoa(j) +`" method="POST">
|
||||||
<input type="text" autocomplete="off" name="answer" />
|
<input type="text" autocomplete="off" name="answer" />
|
||||||
<input type="submit" value="verifique" />
|
<input type="submit" value="verifique" />
|
||||||
|
@ -76,9 +78,6 @@ func answerHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
func main() {
|
func main() {
|
||||||
ParseJSON()
|
ParseJSON()
|
||||||
/* for _, phrase := range phrases.Phrases {
|
|
||||||
fmt.Println(phrase.Phrase)
|
|
||||||
}*/
|
|
||||||
http.HandleFunc("/", requestHandler)
|
http.HandleFunc("/", requestHandler)
|
||||||
http.HandleFunc("/answer/", answerHandler)
|
http.HandleFunc("/answer/", answerHandler)
|
||||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
|
|
Loading…
Reference in a new issue