Sha256: bc49f5f9e29182acb5fad7828f9101ed81f9f8c4abb155d9958fa0098cac4325

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

h1 動画アップロード

= render 'resizing/rails/videos/upload_form'

= paginate(@videos)

.row.row-cols-1.row-cols-md-4.g-3
  - @videos.each do |video|
    .col
      .card.h-100 data-video-url=video.data_self_url
        img.js-video-thumbnail.card-img-top
        .card-body
          h5.card-title = "#{video.id}:#{video.data_id}"
        ul.list-group.list-group-flush
          li.list-group-item
            | State:
            span.video-state = video.data_state
          li.list-group-item
            | AVC
            a.card-link.avc-url.data-copy-url href='#'
              | Copy URL
          li.list-group-item
            | HEVC
            a.card-link.hevc-url.data-copy-url href='#'
              | Copy URL
        .card-footer
          small.text-muted = 'asfadf'
        .card-body
          = link_to 'Show video details', video, class: 'btn btn-primary'

= paginate(@videos)

javascript:
  document.addEventListener('DOMContentLoaded', ()=> {
    let setDataCopyURLOrRemoveElement = (elem, value) => {
      if(value) {
        elem.setAttribute('data-copy-url', value)
      } else {
        elem.remove()
      }
    }
    elements = document.querySelectorAll('[data-video-url]')
    elements.forEach(elem => {
      url = elem.getAttribute('data-video-url')
      fetcher = new Resizing.Rails.VideoFetcher(url)
      fetcher.fetch().then(data => {
        elem.querySelector('.js-video-thumbnail').setAttribute('src', data.thumbnail_url)
        elem.querySelector('.video-state').textContent = data.state
        setDataCopyURLOrRemoveElement(elem.querySelector('.avc-url'), data.avc_url)
        setDataCopyURLOrRemoveElement(elem.querySelector('.hevc-url'), data.hevc_url)
      })
    })
  })

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resizing-rails-0.1.0.pre app/views/resizing/rails/videos/index.html.slim