C0 code coverage information
Generated on Sun Aug 31 02:38:34 -0400 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 class SlideshowsController < ApplicationController
2 # GET /slideshows
3 # GET /slideshows.xml
4 def index
5 @slideshows = Slideshow.find(:all)
6
7 respond_to do |format|
8 format.html # index.html.erb
9 format.xml { render :xml => @slideshows }
10 end
11 end
12
13 # GET /slideshows/1
14 # GET /slideshows/1.xml
15 def show
16 @slideshow = Slideshow.find(params[:id])
17 session[:slideshow] = @slideshow
18 session[:slide_index] = 0
19 @slide = @slideshow.slides[0]
20 end
21
22 # GET /slideshows/new
23 # GET /slideshows/new.xml
24 def new
25 @slideshow = Slideshow.new
26
27 respond_to do |format|
28 format.html # new.html.erb
29 format.xml { render :xml => @slideshow }
30 end
31 end
32
33 # GET /slideshows/1/edit
34 def edit
35 @slideshow = Slideshow.find(params[:id])
36 session[:slideshow] = @slideshow
37 @photos = @slideshow.unused_photos
38 @all_categories = Category.find(:all, :order=>"name")
39 end
40
41 # POST /slideshows
42 # POST /slideshows.xml
43 def create
44 @slideshow = Slideshow.new(params[:slideshow])
45
46 respond_to do |format|
47 if @slideshow.save
48 flash[:notice] = 'Slideshow was successfully created.'
49 format.html { redirect_to(@slideshow) }
50 format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }
51 else
52 format.html { render :action => "new" }
53 format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }
54 end
55 end
56 end
57
58 # PUT /slideshows/1
59 # PUT /slideshows/1.xml
60 def update
61 @slideshow = Slideshow.find(params[:id])
62
63 respond_to do |format|
64 if @slideshow.update_attributes(params[:slideshow])
65 flash[:notice] = 'Slideshow was successfully updated.'
66 format.html { redirect_to(@slideshow) }
67 format.xml { head :ok }
68 else
69 format.html { render :action => "edit" }
70 format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }
71 end
72 end
73 end
74
75 # DELETE /slideshows/1
76 # DELETE /slideshows/1.xml
77 def destroy
78 @slideshow = Slideshow.find(params[:id])
79 @slideshow.destroy
80
81 respond_to do |format|
82 format.html { redirect_to(slideshows_url) }
83 format.xml { head :ok }
84 end
85 end
86
87 def show_slide
88 @slideshow = session[:slideshow]
89 session[:slide_index] += 1
90 @slide = @slideshow.slides[session[:slide_index]]
91 if @slide == nil
92 session[:slide_index] = 0
93 @slide = @slideshow.slides[0]
94 end
95 render :partial => "show_slide"
96 end
97
98 def update_slide_order
99 params[:sortable_thumbs].each_with_index do |id, position|
100 Slide.update(id, :position => position)
101 end
102 end
103
104 def add_photo
105 photo_id = params[:id].split("_")[1]
106 session[:slideshow] = @slideshow = Slideshow.find(session[:slideshow].id)
107 @slide = @slideshow.slides.build(:photo_id => photo_id)
108 flash[:notice] = 'Error: unable to add photo.' unless @slide.save
109 end
110
111 def remove_slide
112 @slide = Slide.find(params[:id].split("_")[1])
113 session[:slideshow] = @slideshow = @slide.slideshow
114 @unused_photo = @slide.photo
115 @slide.destroy
116 end
117
118 def change_filter
119 category_id = params[:category_id] || 1
120 session[:category_id] = category_id
121 session[:slideshow] = @slideshow = Slideshow.find(session[:slideshow].id)
122 category = Category.find(category_id)
123 render :partial => 'unused_photo',
124 :collection => category.photos_including_child_categories
125 end
126
127 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.2.