Mattias Bodlund 2 days ago
parent
commit
370d582fbe
2 changed files with 0 additions and 32 deletions
  1. +0
    -1
      app/assets/images/ico-thumb.svg
  2. +0
    -31
      app/javascript/rating_controller.js

+ 0
- 1
app/assets/images/ico-thumb.svg View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="19" viewBox="0 0 22 19"><path d="M21.48,8.88c-.07-.13-.16-.26-.25-.38-.83-1.04-2.24-1.04-5.05-1.04h-.4c-.44,0-.89,0-.99-.04-.05-.03-.09-.08-.1-.11,0-.11.12-.52.24-.91l.27-.86c.08-.25.12-.38.14-.49.29-1.18.1-2.41-.53-3.45-.07-.11-.14-.22-.29-.43-.11-.17-.17-.25-.23-.31-.64-.73-1.76-.8-2.5-.16-.06.05-.13.12-.26.27l-4.09,4.53c-1.02,1.13-1.58,1.75-1.88,2.54-.02.06-.04.13-.06.19-.66-.6-1.53-.97-2.49-.97-1.52,0-2.75,1.23-2.75,2.75v6c0,1.52,1.23,2.75,2.75,2.75,1.23,0,2.31-.6,2.99-1.51.11.16.23.3.37.44,1.11,1.07,2.64,1.07,5.7,1.07h.51c2.49,0,3.74,0,4.87-.65.11-.06.22-.13.32-.2,1.07-.73,1.59-1.85,2.62-4.07,1.17-2.51,1.75-3.77,1.1-4.95ZM5.25,15c0,1.24-1.01,2.25-2.25,2.25-.69,0-1.25-.56-1.25-1.25v-6c0-.69.56-1.25,1.25-1.25,1.24,0,2.25,1.01,2.25,2.25v4ZM19.02,13.21c-.92,1.97-1.38,2.96-2.11,3.46-.07.05-.14.09-.22.14-.78.45-1.9.45-4.12.45h-.51c-2.65,0-3.98,0-4.65-.65-.63-.61-.66-1.75-.66-4.48v-.97c0-1.36,0-2.04.21-2.58.21-.54.67-1.05,1.6-2.08L12.64,1.96c.07-.08.11-.12.14-.15.05-.04.12-.07.18-.07.08,0,.15.03.21.09.03.03.06.08.11.16.12.18.18.26.24.35.43.71.55,1.53.36,2.33-.02.1-.06.2-.12.4h0s-.27.87-.27.87c-.25.82-.39,1.27-.24,1.77.12.4.38.74.74.96.43.27.92.27,1.79.27h.4c2.18,0,3.49,0,3.88.48.04.05.08.11.11.17.28.51-.25,1.68-1.15,3.6Z"/></svg>

+ 0
- 31
app/javascript/rating_controller.js View File

@ -1,31 +0,0 @@
import { Controller } from "@hotwired/stimulus"
// Thumbs up / down on the results screen. Fire-and-forget: the button state
// flips immediately and the POST is not awaited, so a slow network never makes
// the tap feel dead. One rating per player -- tapping the other thumb just
// overwrites the previous one server-side.
export default class extends Controller {
static targets = ["button"]
static values = { url: String }
rate(event) {
const button = event.currentTarget
const direction = button.dataset.direction
this.buttonTargets.forEach((b) => b.classList.toggle("is-selected", b === button))
const body = new FormData()
body.append("direction", direction)
fetch(this.urlValue, {
method: "POST",
body,
headers: { "X-CSRF-Token": this.csrfToken },
credentials: "same-origin"
}).catch(() => {})
}
get csrfToken() {
return document.querySelector("meta[name='csrf-token']")?.content || ""
}
}

Loading…
Cancel
Save