Sha256: 1969eb008cc32bc2435d9601a2b874898f7363692bd70413af27255ce94c377c

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

h1 動画アップロード

= render 'resizing/rails/videos/upload_form'

h1 動画一覧

= 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}"
        ul.list-group.list-group-flush
          li.list-group-item
            dl
              dt State
              dd.video-state
          li.list-group-item
            dl
              dt AVC
              dd
                a.card-link.avc-url.data-copy-url href='#'
                  | Copy URL
          li.list-group-item
            dl
              dt HEVC
              dd
                a.card-link.hevc-url.data-copy-url href='#'
                  | Copy URL
        .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

5 entries across 5 versions & 1 rubygems

Version Path
resizing-rails-0.4.1 app/views/resizing/rails/videos/index.html.slim
resizing-rails-0.4.0 app/views/resizing/rails/videos/index.html.slim
resizing-rails-0.3.0 app/views/resizing/rails/videos/index.html.slim
resizing-rails-0.2.0 app/views/resizing/rails/videos/index.html.slim
resizing-rails-0.1.0.pre2 app/views/resizing/rails/videos/index.html.slim