app/controllers/spud/admin/media_controller.rb in spud_media-0.9.5 vs app/controllers/spud/admin/media_controller.rb in spud_media-0.9.6
- old
+ new
@@ -1,11 +1,11 @@
class Spud::Admin::MediaController < Spud::Admin::ApplicationController
layout 'layouts/spud/admin/detail'
add_breadcrumb "Media", :spud_admin_media_path
belongs_to_spud_app :media
- before_filter :load_media,:only => [:edit,:update,:show,:destroy,:set_private,:set_access]
-
+ before_filter :load_media,:only => [:edit,:update,:show,:destroy,:set_private,:set_access, :replace]
+
def index
@media = SpudMedia.order("created_at DESC").paginate :page => params[:page]
respond_with @media
end
@@ -20,11 +20,11 @@
@page_name = "New Media"
add_breadcrumb "New", :new_spud_admin_medium_path
@media = SpudMedia.new(params[:spud_media])
location = spud_admin_media_path
if @media.save
- flash[:notice] = "File uploaded successfully"
+ flash[:notice] = "File uploaded successfully"
if @media.is_image?
location = edit_spud_admin_medium_path(@media.id)
end
end
respond_with @media, :location => location
@@ -41,10 +41,13 @@
flash[:error] = "Unable to edit #{@media.attachment_file_name}"
redirect_to spud_admin_media_url
end
end
+ def replace
+ end
+
def update
if @media.update_attributes(params[:spud_media])
@media.attachment.reprocess!
end
respond_with @media, :location => spud_admin_media_url
@@ -66,8 +69,8 @@
@media = SpudMedia.where(:id => params[:id]).first
if @media.blank?
flash[:error] = "Media Asset not found!"
redirect_to spud_admin_media_url() and return
end
-
+
end
end