Skip to content

Commit

Permalink
Only show AddToPlaylist if the current user can create playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcolvar committed May 13, 2016
1 parent f88459b commit c6b954d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/avalon_player.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ class AvalonPlayer
@stream_info = stream_info
removeOpt = (key) -> value = opts[key]; delete opts[key]; value
thumbnail_selector = if removeOpt('thumbnailSelector') then 'thumbnailSelector' else null
add_to_playlist = if removeOpt('addToPlaylist') then 'addToPlaylist' else null
start_time = removeOpt('startTime')

features = ['playpause','current','progress','duration','volume','tracks','qualities',thumbnail_selector,'fullscreen','responsive', 'addToPlaylist']
features = ['playpause','current','progress','duration','volume','tracks','qualities',thumbnail_selector, add_to_playlist, 'fullscreen','responsive']
features = (feature for feature in features when feature?)
player_options =
mode: 'auto_plugin'
Expand Down
4 changes: 3 additions & 1 deletion app/views/media_objects/_item_view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Unless required by applicable law or agreed to in writing, software distributed
<% end %>
</section>

<%= render file: '_add_to_playlist.html.erb' %>
<%= render file: '_add_to_playlist.html.erb' if current_user.present? %>
<%= render 'workflow_progress' %>
<%= render 'share' if will_partial_list_render? :share %>
<%= render partial: 'sections',
Expand Down Expand Up @@ -91,6 +91,8 @@ Unless required by applicable law or agreed to in writing, software distributed
audioHeight: <%= MasterFile::AUDIO_HEIGHT %>,
mobileDisplayedDuration: <%= @currentStream ? (@currentStream.duration.to_f / 1000).round : -1 %>,
thumbnailSelector: <%= can?(:edit, @mediaobject) ? 'true' : 'false' %>,
//addToPlaylist: <%= can?(:create, Playlist) ? 'true' : 'false' %>,
addToPlaylist: <%= current_user.present? ? 'true' : 'false' %>,
startQuality: '<%= current_quality(@currentStreamInfo) %>',
customError: '<%= t("media_objects.player.customError").html_safe %>'
})
Expand Down

0 comments on commit c6b954d

Please sign in to comment.