forked from hs3city/goexplorers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hs3city#7 from hs3city/session-8
Session 8: CYOA complete implementation
- Loading branch information
Showing
3 changed files
with
32 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,14 @@ | ||
package main | ||
|
||
type StoryLine struct { | ||
Intro Intro `json:"intro"` | ||
NewYork NewYork `json:"new-york"` | ||
Debate Debate `json:"debate"` | ||
SeanKelly SeanKelly `json:"sean-kelly"` | ||
MarkBates MarkBates `json:"mark-bates"` | ||
Denver Denver `json:"denver"` | ||
Home Home `json:"home"` | ||
} | ||
type StoryLine map[string]Section | ||
|
||
type Options struct { | ||
Text string `json:"text"` | ||
Arc string `json:"arc"` | ||
} | ||
|
||
type Intro struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []Options `json:"options"` | ||
} | ||
|
||
type NewYork struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []Options `json:"options"` | ||
} | ||
|
||
type Debate struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []Options `json:"options"` | ||
} | ||
|
||
type SeanKelly struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []Options `json:"options"` | ||
} | ||
|
||
type MarkBates struct { | ||
type Section struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []Options `json:"options"` | ||
} | ||
|
||
type Denver struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []Options `json:"options"` | ||
} | ||
|
||
type Home struct { | ||
Title string `json:"title"` | ||
Story []string `json:"story"` | ||
Options []any `json:"options"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
<html> | ||
|
||
<body> | ||
<h1> {{ . }} </h1> | ||
|
||
<h1> {{ .Title }} </h1> | ||
<div class="our-story"> | ||
{{range $idx, $para := .Story}} | ||
<div> | ||
<p>{{$para}}</p> | ||
</div> | ||
{{end}} | ||
</div> | ||
{{ if .Options }} | ||
<h2>Go to:</h2> | ||
{{ end}} | ||
{{range $idx, $option := .Options}} | ||
<div> | ||
<p>{{$option.Text}}</p> | ||
<a href="{{$option.Arc}}">{{$option.Arc}}</a> | ||
</div> | ||
{{end}} | ||
|
||
|
||
</body> | ||
|
||
</html> |