Author: Adam <git@apiote.tk>
watch film on another date
libamuse/account.go | 2 +- router.go | 12 +++++++++++- static/style/style.css | 16 ++++++++++++++++ templates/film.html | 9 ++++++++- templates/tvserie.html | 6 +++---
diff --git a/libamuse/account.go b/libamuse/account.go index 0ab7ebb249e47fad6a11c6ccfa636443e86a86a1..7ac1346ea4b25c6a8ff65f674b6cc77302db1ad7 100644 --- a/libamuse/account.go +++ b/libamuse/account.go @@ -78,7 +78,7 @@ if datetime == "" { t = time.Now() } else { location, _ := time.LoadLocation(result.user.Timezone) - t, err = time.ParseInLocation(time.RFC3339, datetime, location) + t, err = time.ParseInLocation("2006-01-02T15:04:05", datetime, location) } t = t.In(time.UTC) result.result = t diff --git a/router.go b/router.go index eb8d41b7196808912988fc5709787c22b824aaad..1dafc435cbb5cdd59ba904ae9c0d6d0d4da3f07b 100644 --- a/router.go +++ b/router.go @@ -320,7 +320,17 @@ } else if r.Method == "POST" { r.ParseForm() itemId := r.PostForm.Get("itemId") itemType := r.PostForm.Get("itemType") - datetime := r.PostForm.Get("datetime") + isOtherTime := r.PostForm.Get("isOtherTime") == "true" + + var datetime string + if isOtherTime { + date := r.PostForm.Get("watchedDate") + time := r.PostForm.Get("watchedTime") + datetime = date+"T"+time+":00" + } else { + datetime = "" + } + masterItemId := strings.Split(itemId, "/")[0] target := "/" + itemType + "s/" + masterItemId err := libamuse.AddToExperiences(username, auth, itemId, itemType, datetime, acceptLanguages, mimetype) diff --git a/static/style/style.css b/static/style/style.css index ee4fbe3c6ee53f19ba82c63dc9611be050a3d2c4..85358cba10f8b1b741c19e781c426f7361ddd964 100644 --- a/static/style/style.css +++ b/static/style/style.css @@ -114,6 +114,14 @@ nav input:checked ~ ul { display: block; } +.watched-box { + display: none; +} + +.watched-datetime-check:checked ~ .watched-box { + display: block; +} + * { box-sizing: border-box; } @@ -526,6 +534,10 @@ .bottom-4 { bottom: 3.9rem; } +.top-m_3 { + top: -.3rem; +} + .top { top: 0; } @@ -684,6 +696,10 @@ animation-timing-function: ease-in-out; } /* HEIGHT */ + +.height-3_3 { + height: 3.3rem +} .height-30 { height: 30rem; diff --git a/templates/film.html b/templates/film.html index affe6c5d55a8f2ac8eb64a67e3f2dc72e9ede476..f32d158c6741ab62042a01b6b4d7bf51be9d69dd 100644 --- a/templates/film.html +++ b/templates/film.html @@ -117,7 +117,14 @@ {{end}} <form action="/users/{{.State.User.Username}}/experiences/" method="POST" class="margin-tb-_5 margin-lr-1"> <input type="hidden" name="itemId" value="{{.Data.Id}}" /> <input type="hidden" name="itemType" value="film" /> - <button type="submit" class="border-text hover-bg-dark-accent padding-tb-_25 cursor-hand text-black font-2"><span class="padding-lr-_5 material-icon font-2"></span><span class="sans padding-lr-_5">Watched now</span></button> + <button type="submit" class="border-text hover-bg-dark-accent padding-tb-_25 cursor-hand text-black font-2"><span class="padding-lr-_5 material-icon font-2"></span><span class="sans padding-lr-_5">Watched</span></button><label for="watched-datetime-check" class="cursor-hand bg-accent inline-block font-2 relative top-m_3 height-3_3"> + <span class="material-icon"></span> + </label> + <input type="checkbox" id="watched-datetime-check" class="display-none watched-datetime-check" name="isOtherTime" value="true"/> + <div class="watched-box absolute"> + <input type="date" name="watchedDate" class="margin-lr-_5 margin-tb-_5 text bg-none border-none" /> + <input type="time" name="watchedTime" class="margin-lr-_5 margin-tb-_5 text bg-none border-none" /> + </div> </form> </div> {{end}} diff --git a/templates/tvserie.html b/templates/tvserie.html index c1dfe015cbfd2aa2c61d374bda2c68dcca13859d..169749fbb5f1bff40ba53b60b70fafd6536f135c 100644 --- a/templates/tvserie.html +++ b/templates/tvserie.html @@ -142,7 +142,7 @@ {{if and (not $.State.User.IsEmpty) $.Data.IsOnWantList}} <form action="/users/{{$.State.User.Username}}/experiences/" method="POST"> <input type="hidden" name="itemId" value="{{$.Data.Id}}/{{.Data.Next_episode_to_watch.Episode_code}}" /> <input type="hidden" name="itemType" value="tvserie" /> - <input type="hidden" name="datetime" value="0001-01-01T00:00:00Z"/> + <input type="hidden" name="datetime" value="0001-01-01T00:00:00"/> <button type="submit" class="border-text hover-bg-grey cursor-hand text-white font-1_5"><span class="material-icon"></span></button> </form> <form action="/users/{{$.State.User.Username}}/experiences/" method="POST"> @@ -179,7 +179,7 @@ {{if eq .Season_number 0}} <form action="/users/{{$.State.User.Username}}/experiences/" method="POST" class="flex flex-centre"> <input type="hidden" name="itemId" value="{{$.Data.Id}}/S00A{{len .Episodes}}" /> <input type="hidden" name="itemType" value="tvserie" /> - <input type="hidden" name="datetime" value="0001-01-01T00:00:00Z"/> + <input type="hidden" name="datetime" value="0001-01-01T00:00:00"/> <button type="submit" class="border-text hover-bg-grey padding-tb-_25 cursor-hand text-white font-1_5"><span class="padding-lr-_5 material-icon font-1_5"></span><span class="sans padding-lr-_5">Skip all specials</span></button> </form> {{end}} @@ -208,7 +208,7 @@ {{if eq (len .Experiences) 0}} <form action="/users/{{$.State.User.Username}}/experiences/" method="POST"> <input type="hidden" name="itemId" value="{{$.Data.Id}}/{{.Episode_code}}" /> <input type="hidden" name="itemType" value="tvserie" /> - <input type="hidden" name="datetime" value="0001-01-01T00:00:00Z"/> + <input type="hidden" name="datetime" value="0001-01-01T00:00:00"/> <button type="submit" class="border-text hover-bg-grey cursor-hand text-white font-2"><span class="material-icon font-2"></span></button> </form> {{end}}