This file contains hidden or 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
import { Controller } from "@hotwired/stimulus"; | |
export default class extends Controller { | |
static targets = [ | |
"button", | |
"startTime", | |
"endTime", | |
"playbackSpeed", | |
"source", | |
]; |
This file contains hidden or 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
class Video::Search | |
SEARCHABLE_COLUMNS = %w[ | |
songs.title | |
songs.last_name_search | |
videos.channel_id | |
videos.performance_date | |
videos.view_count | |
videos.updated_at | |
videos.popularity | |
videos.like_count |
This file contains hidden or 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
<%= turbo_frame_tag "#{dom_id(@video)}_vote" do %> | |
<div class="like-buttons" style="display: flex; align-items: center;"> | |
<%= render partial: "videos/show/upvote_link" %> | |
<%= render partial: "videos/show/like_count" %> | |
<%= render partial: "videos/show/downvote_link" %> | |
</div> | |
<% end %> |
This file contains hidden or 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
<div | |
<% unless user_signed_in? %> | |
data-controller="popper" | |
<% end %> | |
> | |
<%= content_tag "div", { id: "downvote-#{video.id}", | |
data: { "popper-target": "element", | |
action: "click->popper#show click@window->popper#hide" } } do %> | |
<%= button_to downvote_video_path(video), method: :patch, | |
style: "display: flex; justify-content: center; align-items: center;" do %> |
This file contains hidden or 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
<div | |
<% unless current_user %> | |
data-controller="popper" | |
<% end %> | |
> | |
<%= content_tag "div", { id: "downvote-#{video.id}", | |
data: { "popper-target": "element", | |
action: "click->popper#show click@window->popper#hide" } } do %> | |
<%= button_to downvote_video_path(video), method: :patch, | |
remote: true, |
This file contains hidden or 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
<ul role="listbox" data-combobox-target="list"> | |
<% search_results.each_with_index do |result, index| %> | |
<li> | |
<%= link_to highlight(result, params[:query], :highlighter => '<b>\1</b>'), root_path(query: result.parameterize(separator: " ")), role: "option", id: "search_result_#{index}" %> | |
</li> | |
<% end %> | |
</ul> |
This file contains hidden or 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
import { Controller } from '@hotwired/stimulus' | |
import axios from 'axios' | |
import { autocomplete } from '@algolia/autocomplete-js' | |
export default class extends Controller { | |
static targets = ['field'] | |
search (query, callback) { | |
axios.get('/search_suggestions', { params: { query } }).then(response => { | |
callback(response.data) |
This file contains hidden or 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
import { Controller } from "@hotwired/stimulus" | |
import Combobox from '@github/combobox-nav' | |
// Connects to data-controller="combobox" | |
export default class extends Controller { | |
static get targets() { return [ "input", "list" ] } | |
disconnect() { | |
this.combobox?.destroy() | |
} |
This file contains hidden or 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
import { Controller } from '@hotwired/stimulus' | |
import axios from 'axios' | |
import { autocomplete } from '@algolia/autocomplete-js' | |
export default class extends Controller { | |
static targets = ['field'] | |
search (query, callback) { | |
axios.get('/search_suggestions', { params: { query } }).then(response => { | |
callback(response.data) |
This file contains hidden or 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
<div data-controller="popper"> | |
<%= button_tag type: "button", data: { "popper-target": "element", action: "click->popper#show click@window->popper#hide" } do %> | |
<%= content_tag "div", id: "downvote-#{video.id}" do %> | |
<%= link_to downvote_video_path(video), method: :patch, | |
remote: true, | |
style: "display: flex; justify-content: center; align-items: center;" do %> | |
<% if current_user %> | |
<% if current_user.voted_down_on? video %> | |
<%= fa_icon "thumbs-down solid", text: "Dislike", | |
style: "font-size: 30px; margin: 0 10px;" %> |