-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
4 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Switchhost</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Raleway:400,300,600" | ||
rel="stylesheet" | ||
type="text/css" | ||
/> | ||
<link rel="stylesheet" href="skeleton.min.css" /> | ||
<link rel="icon" type="image/png" href="images/favicon.png" /> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="row"> | ||
<h1>Switch Host</h1> | ||
<hr /> | ||
<img height="512" src="{GameBannerImageURI}" /> | ||
</div> | ||
<div class="row"> | ||
<h3>{GameTitle}</h3> | ||
<img height="512" src="{GameImageURI}" /> | ||
|
||
</div> | ||
<div class="row"> | ||
<table class="u-full-width"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Version</th> | ||
<th>Size</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{GameDetailsTableContents} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<br /> | ||
</body> | ||
</html> |
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,31 @@ | ||
package webui | ||
|
||
import "io" | ||
import ( | ||
"fmt" | ||
"io" | ||
"strings" | ||
) | ||
|
||
func (web *WebUI) RenderTitleInfo(path string, writer io.Writer) { | ||
func (web *WebUI) RenderTitleInfo(titleID uint64, writer io.Writer) error { | ||
//Render out a web page of the info we have on the title | ||
titleDetails, ok := web.titleDB.QueryGameFromTitleID(titleID) | ||
if !ok { | ||
return ErrBadTemplate | ||
} | ||
template := detailPageTemplate | ||
|
||
template = strings.Replace(template, "{GameImageURI}", titleDetails.IconURL, -1) | ||
template = strings.Replace(template, "{GameBannerImageURI}", titleDetails.BannerURL, -1) | ||
template = strings.Replace(template, "{GameTitle}", titleDetails.Name, -1) | ||
//Generate info table | ||
filesTracked := web.lib.FileIndex.GetAllRecordsForTitle(titleID) | ||
tableInfo := "" | ||
for _, record := range filesTracked { | ||
tableInfo += fmt.Sprintf("<tr><td>%s</td><td>%d</td><td>%d</td></tr>\n", record.Name, record.Version, record.Size) | ||
} | ||
template = strings.Replace(template, "{GameDetailsTableContents}", tableInfo, -1) | ||
if _, err := writer.Write([]byte(template)); err != nil { | ||
return ErrBadTemplate | ||
} | ||
return nil | ||
} |
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