Skip to content

Commit

Permalink
Refresh Shows on Hompage reload (#53)
Browse files Browse the repository at this point in the history
* Add function to refresh shows for the home page

* Bump version

* Update changelog

* Update to build process

Fixes #50
  • Loading branch information
danstis authored Oct 28, 2017
1 parent e06883a commit 4decbd4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before_build:
- goverage -v .\...
- dir *.out
- echo %APPVEYOR_REPO_COMMIT%
- godacov -t %CODACY_TOKEN% -r coverage.out -c %APPVEYOR_REPO_COMMIT%
- ps: Invoke-Expression -Command "godacov -t $env:CODACY_TOKEN -r coverage.out -c $env:APPVEYOR_REPO_COMMIT" -ErrorAction "SilentlyContinue"
- go tool cover -func coverage.out

build_script:
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
- Refresh shows when reloading the WebUI homepage.

## [v0.3.3]
### Added
- Script to bump version using GitVersion.
Expand Down Expand Up @@ -47,7 +51,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Spaces in TV Show names cause errors.

[unreleased]: https://github.com/danstis/Plex-Sync/compare/v0.3.3...HEAD
[v0.3.2]: https://github.com/danstis/Plex-Sync/compare/v0.3.1...v0.3.3
[v0.3.3]: https://github.com/danstis/Plex-Sync/compare/v0.3.1...v0.3.3
[v0.3.1]: https://github.com/danstis/Plex-Sync/compare/v0.3.0...v0.3.1
[v0.3.0]: https://github.com/danstis/Plex-Sync/compare/v0.2.0...v0.3.0
[v0.2.0]: https://github.com/danstis/Plex-Sync/compare/v0.1.0...v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion plex/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package plex

// Version contains the version of the app.
const Version = "0.3.5-ci.1"
const Version = "0.3.5-refresh-shows-onreload-homepage.4"
10 changes: 10 additions & 0 deletions webui/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ var v = PageData{
Shows: ss,
}

// refreshShows updates the PageData with the latest shows.
func refreshShows() {
ss, _ = plex.SelectedShows()
v = PageData{
Version: plex.Version,
Shows: ss,
}
}

// RootHandler returns the default page.
func rootHandler(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles(path.Join("webui", "templates", "index.html")))
refreshShows()
tmpl.Execute(w, v)
}

Expand Down

0 comments on commit 4decbd4

Please sign in to comment.