Skip to content

Commit

Permalink
Merge pull request #883 from avalonmediasystem/revert-879-playlist-bo…
Browse files Browse the repository at this point in the history
…okmark-action

Revert "Add document action for adding to playlist"
  • Loading branch information
cjcolvar authored Jun 15, 2016
2 parents 5ba367e + 2504ba3 commit 85a15d4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 84 deletions.
15 changes: 1 addition & 14 deletions app/controllers/bookmarks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class BookmarksController < CatalogController

self.add_show_tools_partial( :delete, callback: :delete_action, if: Proc.new { |context, config, options| context.controller.user_can? :delete } )

self.add_show_tools_partial( :add_to_playlist, callback: :add_to_playlist_action )

before_filter :verify_permissions, only: :index

#HACK next two methods are a hack for problems in the puppet VM tomcat/solr
Expand All @@ -62,7 +60,7 @@ def user_can? action

def verify_permissions
@response, @documents = action_documents
@valid_user_actions = [:delete, :unpublish, :publish, :move, :update_access_control, :add_to_playlist]
@valid_user_actions = [:delete, :unpublish, :publish, :move, :update_access_control]
mos = @documents.collect { |doc| MediaObject.find( doc.id ) }
@documents.each do |doc|
mo = MediaObject.find(doc.id)
Expand Down Expand Up @@ -117,17 +115,6 @@ def access_control_action documents
MediaObject.access_control_bulk success_ids, params
end

def add_to_playlist_action documents
playlist = Playlist.find(params[:target_playlist_id])
Array(documents.map(&:id)).each do |id|
media_object = MediaObject.find(id)
media_object.parts.each do |mf|
annotation = AvalonAnnotation.create(master_file: mf)
PlaylistItem.create(annotation: annotation, playlist: playlist)
end
end
end

def status_action documents
errors = []
success_ids = []
Expand Down
50 changes: 0 additions & 50 deletions app/views/bookmarks/add_to_playlist.html.erb

This file was deleted.

8 changes: 0 additions & 8 deletions config/locales/blacklight.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ en:
other: "These items were not moved:"
}
error: "You do not have permission to add to collection %{collection_name}."
add_to_playlist:
form:
title: "Add to Playlist"
no_playlists: "You have no playlists"
confirm: "Please choose a playlist:"
button: "Add"
success: "Items successfully added to playlist."
fail: "Add to playlist failed."
status:
success: {
one: "One item is being %{status}ed.",
Expand Down
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
post '/bookmarks/update_access_control'
post '/bookmarks/publish', as: :publish_bookmarks
post '/bookmarks/unpublish', as: :unpublish_bookmarks
get '/bookmarks/add_to_playlist', as: :add_to_playlist_bookmarks
post '/bookmarks/add_to_playlist'

post '/media_objects/set_session_quality'

Expand Down
11 changes: 1 addition & 10 deletions spec/controllers/bookmarks_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Delayed::Worker.delay_jobs = false
login_user collection.managers.first
3.times do
media_objects << mo = FactoryGirl.create(:media_object_with_master_file, collection: collection)
media_objects << mo = FactoryGirl.create(:media_object, collection: collection)
post :create, id: mo.id
end
end
Expand Down Expand Up @@ -115,15 +115,6 @@
end
end

describe '#add_to_playlist' do
let!(:playlist) { FactoryGirl.create(:playlist) }
it 'added selected items to given playlist' do
expect {
post 'add_to_playlist', target_playlist_id: playlist.id
}.to change{PlaylistItem.where(playlist_id: playlist.id).count}.by(3)
end
end

describe '#update_access_control' do
it 'changes to hidden' do
post 'update_access_control', hidden: "true"
Expand Down

0 comments on commit 85a15d4

Please sign in to comment.