atzorvas/ccradio

View on GitHub
app/views/streams/index.html.slim

Summary

Maintainability
Test Coverage
h1 Listing Streams
 
table.table.table-stripped
thead
tr
th Title
th Song
th Play
- if current_user && current_user.admin?
th
th
tbody
- @streams.each do |stream|
tr stream-id="#{stream.id}"
td.title = link_to stream.title, stream, id: "refresh-stream-#{stream.id}", refresh: "main-content", onclick: "event.preventDefault(); Page.refresh({url: '#{stream_path(stream)}', onlyKeys: ['main-content']});"
td.song = stream.playlist_items.last.song rescue nil
td.play = link_to "Play #{stream.title}", '#', class: 'player-link', 'data-title': stream.title, 'data-url': stream.url_play, id: "play-stream-#{stream.id}"
- if current_user && current_user.admin?
td = link_to 'Edit', edit_stream_path(stream)
td = link_to 'Destroy', stream, data: {:confirm => 'Are you sure?'}, :method => :delete