beef-slides 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -4,8 +4,8 @@ class Admin::SlidesController < Admin::BaseController
4
4
  # GET /slides
5
5
  # GET /slides.xml
6
6
  def index
7
- @slide_show = SlideShow.find(params[:slide_show_id])
8
- @slides = @slide_show.slides.paginate :page => params[:page], :order => sort_order(:default => 'asc')
7
+ @slide_show = SlideShow.find(params[:slide_show_id]) if params[:slide_show_id]
8
+ @slides = ( @slide_show ? @slide_show.slides : Slide ).paginate :page => params[:page], :order => sort_order(:default => 'asc')
9
9
 
10
10
  respond_to do |format|
11
11
  format.html # index.html.erb
@@ -44,7 +44,7 @@ class Admin::SlidesController < Admin::BaseController
44
44
  respond_to do |format|
45
45
  if @slide.save
46
46
  flash[:notice] = 'Slide was successfully created.'
47
- format.html { redirect_to(admin_slide_show_slides_url(@slide.slide_show)) }
47
+ format.html { redirect_to( @slide.slide_show ? admin_slide_show_slides_url(@slide.slide_show) : admin_slides_url ) }
48
48
  format.xml { render :xml => @slide, :status => :created, :location => @slide }
49
49
  else
50
50
  format.html { render :action => "show" }
@@ -61,7 +61,7 @@ class Admin::SlidesController < Admin::BaseController
61
61
  respond_to do |format|
62
62
  if @slide.update_attributes(params[:slide])
63
63
  flash[:notice] = 'Slide was successfully updated.'
64
- format.html { redirect_to(admin_slide_show_slides_url(@slide.slide_show)) }
64
+ format.html { redirect_to( @slide.slide_show ? admin_slide_show_slides_url(@slide.slide_show) : admin_slides_url ) }
65
65
  format.xml { head :ok }
66
66
  else
67
67
  format.html { render :action => "show" }
@@ -74,11 +74,10 @@ class Admin::SlidesController < Admin::BaseController
74
74
  # DELETE /slides/1.xml
75
75
  def destroy
76
76
  @slide = Slide.find(params[:id])
77
- slide_show = @slide.slide_show
78
77
  @slide.destroy
79
78
 
80
79
  respond_to do |format|
81
- format.html { redirect_to(admin_slide_show_slides_url(slide_show)) }
80
+ format.html { redirect_to( @slide.slide_show ? admin_slide_show_slides_url(@slide.slide_show) : admin_slides_url ) }
82
81
  format.xml { head :ok }
83
82
  end
84
83
  end
@@ -1,6 +1,6 @@
1
1
  class Slide < ActiveRecord::Base
2
2
  acts_as_publishable
3
- acts_as_list :insert_position => :top, :scope => :slide_show_id
3
+ acts_as_list :scope => :slide_show_id
4
4
  has_attachment :storage => :file_system, #Should be changed to S3 for production
5
5
  :path_prefix => 'public/assets/slides', #Should be changed to S3 for production
6
6
  :max_size => 5.megabytes,
@@ -1,7 +1,7 @@
1
- <h1>Listing slides for <%= @slide_show.title %></h1>
1
+ <h1>Listing slides<%= " for #{@slide_show.title}" if @slide_show %></h1>
2
2
 
3
3
  <ul class="choices">
4
- <li><%= link_to 'New slide', new_admin_slide_show_slide_path(@slide_show) %></li>
4
+ <li><%= link_to 'New slide', @slide_show ? new_admin_slide_show_slide_path(@slide_show) : new_admin_slide_path %></li>
5
5
  </ul>
6
6
 
7
7
  <table>
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{slides}
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Daniel Craig"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-slides
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Craig