1 # Handles dealing with slideshows
3 # We use make_resourceful to create most of the
4 # RESTful actions of the controller. We use a custom
5 # new action because it behaves a little different,
6 # but otherwise the actions are generated by
8 class ShowsController < ApplicationController
9 in_place_edit_for :show, :title
12 # These are the only actions we need for now
13 actions :index, :show, :edit, :destroy
15 # This URL should not be used
16 response_for(:index) { set_default_redirect home_path }
17 # The slideshow needs to use the S5 layout
18 response_for(:show) { render :layout => false }
19 # We want to avoid the index URL
20 response_for(:destroy) do
21 set_default_flash :notice, "The show was deleted."
22 set_default_redirect home_path
26 # This behaves a little special
28 # See SongsController#new
30 @show = current_model.create(:title => 'Untitled')
31 redirect_to edit_show_path(@show)
34 # Assigns new positions to all the songs in
37 # This should be called from an Ajax request.
39 params[:songs_list].each_with_index do |id, idx|
40 Usage.update(id, :position => idx + 1)
42 render :nothing => true
46 # Make everything hang off the current user
48 # See SongsController#current_model