Skip to content

Instantly share code, notes, and snippets.

@jmarsh24
Created March 5, 2021 15:34
Show Gist options
  • Save jmarsh24/dc732b44f19d7ac2c1bd8835950c9651 to your computer and use it in GitHub Desktop.
Save jmarsh24/dc732b44f19d7ac2c1bd8835950c9651 to your computer and use it in GitHub Desktop.
<div data-controller="filter">
<div class="filter-header">
<div class="filter-container-button-results">
<button data-action="click->toggle#toggle" class="filter-button"><%= fa_icon "sliders-h 2x", left: true %>
<div id="filter-button-text">Filters</div>
</button>
<div id="filter_results">
<%= "Displaying #{number_with_delimiter(@videos.size)} Results" %>
</div>
</div>
<div class="filter-hd">
<%= link_to "All", current_page_params.except(:hd) , class: "filter-hd-button", 'data-action': "click->filter#filter" %>
<%= link_to "HD", current_page_params.merge(hd: 1) , class: "filter-hd-button", 'data-action': "click->filter#filter" %>
</div>
</div>
<div class="filter-container isHidden" data-toggle-target="toggleable" id="filters">
<%= render partial: "videos/index/filter_item", locals: { model: @genres, model_count: @genre_count, title: :genre, id: 'genre-filter' } %>
<%= render partial: "videos/index/filter_item", locals: { model: @leaders, model_count: @leader_count, title: :leader, id: 'leader-filter' } %>
<%= render partial: "videos/index/filter_item", locals: { model: @followers, model_count: @follower_count, title: :follower, id: 'follower-filter' } %>
<%= render partial: "videos/index/filter_item", locals: { model: @artists, model_count: @artist_count, title: :orchestra, id: 'orchestra-filter' } %>
<div class="videos-sortable-container">
<label>
Sort By
</label>
<div class="videos-sortable-btn">
<%= sortable 'songs.title', "Song Title" %>
</div>
<div class="videos-sortable-btn">
<%= sortable 'songs.last_name_search', "Orchestra (last name)" %>
</div>
<div class="videos-sortable-btn">
<%= sortable 'leaders.name', "Leader" %>
</div>
<div class="videos-sortable-btn">
<%= sortable 'followers.name', "Follower" %>
</div>
<div class="videos-sortable-btn">
<%= sortable 'channels.title', "Channel" %>
</div>
<div class="videos-sortable-btn">
<%= sortable "videos.view_count", "View Count" %>
</div>
<div class="videos-sortable-btn">
<%= sortable "videos.upload_date", "Upload Date" %>
</div>
<div class="videos-sortable-btn">
<%= sortable 'videos.popularity', "Popularity" %>
</div>
</div>
</div>
</div>
<div class="filter-item">
<label>
<%= title.to_s.titleize %>
</label>
<%= select_tag title.to_s,
options_for_select(model, params[title.to_s].presence), include_blank: true, multiple: false,
data: { action: "filter#filter",
"filter-target": "filter",
"slimselect-target": "field",
controller:'slimselect'
},
class: 'select-filter',
id: id %>
</div>
<div class="attribute-row">
<div class="attribute-label">
<%= f.label id %>
</div>
<div class="attribute-value">
<%= f.select params_name, [],
{},
{ data: { controller: "slimselect",
'slimselect-target': 'field',
'slimselect-url': url,
'slimselect-data-value': value }, id: id, class: 'select-edit' } %>
</div>
</div>
<%= turbo_frame_tag dom_id(@video) do %>
<div class="video-info-details-main">
<div class="detail-section-label">
<h4>Performers</h4>
</div>
<%= form_with model: @video do |f| %>
<%= render partial: "videos/edit/video_info_detail_item_edit",
locals: { params_name: :leader_id,
id: 'leader',
f: f,
url: '/leaders',
value: @video.leader.name } %>
<%= render partial: "videos/edit/video_info_detail_item_edit",
locals: { params_name: :follower_id,
id: 'follower',
f: f,
url: '/followers',
value: @video.follower.name } %>
<div class="detail-section-label">
<h4>Event Info</h4>
</div>
<%= render partial: "videos/edit/video_info_detail_item_edit",
locals: { params_name: :event_id,
id: 'event',
f: f,
url: '/events',
value: @video.event.title } %>
<h4>Music</h4>
</div>
<%= render partial: "videos/edit/video_info_detail_item_edit",
locals: { params_name: :song_id,
id: 'song',
f: f,
url: '/songs',
value: @video.song.title } %>
<div>
<%= f.label 'hidden?' %>
<%= f.check_box :hidden ,{}, "true", "false" %>
</div>
<div>
<%= f.submit 'Update Video' %>
</div>
<% end %>
<div class="detail-section-label">
<h4>Video Info</h4>
</div>
<%= render partial: "videos/show/video_info_item",
locals: { header: "Title",
value: @video.title } %>
<%= render partial: "videos/show/video_info_item",
locals: { header: "Description",
value: auto_link(simple_format(truncate(@video.description, length: 200, omission: '')), html: { target: '_blank' }) } if @video.description.present? %>
<%= render partial: "videos/show/video_info_item",
locals: { header: "Upload Date",
value: @video.upload_date.to_formatted_s(:long) } %>
<%= render partial: "videos/show/video_info_item",
locals: { header: "Duration",
value: Time.at(@video.duration).utc.strftime("%M:%S") } %>
<div class="edit-video-item-container">
<div>
<%= link_to 'Back', watch_path(v: @video.youtube_id) %>
</div>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment