app/controllers/spud/admin/media_controller.rb in spud_media-0.8.3 vs app/controllers/spud/admin/media_controller.rb in spud_media-0.9.0

- old
+ new

@@ -1,10 +1,11 @@ class Spud::Admin::MediaController < Spud::Admin::ApplicationController layout 'spud/admin/media/detail' add_breadcrumb "Media", :spud_admin_media_path belongs_to_spud_app :media - before_filter :load_media,:only => [:edit,:update,:show,:destroy] + before_filter :load_media,:only => [:edit,:update,:show,:destroy,:set_private,:set_access] + def index @media = SpudMedia.order("created_at DESC").paginate :page => params[:page] respond_with @media end @@ -29,15 +30,23 @@ add_breadcrumb @media.attachment_file_name, :new_spud_admin_media_path respond_with @media end def update + end def destroy flash[:notice] = "File successfully destroyed" if @media.destroy respond_with @media, :location => spud_admin_media_url end + + def set_access + is_protected = params[:protected] || false + @media.update_attribute(:is_protected, is_protected) + respond_with @media, :location => spud_admin_media_url + end + private def load_media @media = SpudMedia.where(:id => params[:id]).first if @media.blank? flash[:error] = "Media Asset not found!"