# -*- encoding : utf-8 -*-
class Admin::NoteFilesController < ApplicationController
 before_filter :auth_admin


layout "admin"

  def show
		@note_file = NoteFile.find(params[:id])
		
    
    if params[:inline] and !params[:force]
      
    else
      send_file @note_file.file.path, :filename => @note_file.abstract_file_name_slug, :disposition => (params[:download] ? "attachment" : "inline")
    end
    
  end

  
  def create

    @note_file = NoteFile.new(:original_filename => params[:files][0].original_filename ,:name => params[:files][0].original_filename, :note_id => params[:note_id], :file =>params[:files][0])

    if @note_file.save
     
    else
     
    end

  end

  def destroy
    @note_file = NoteFile.find(params[:id])
    @note_file.destroy

  end
end
