Class: FileuploadsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fileuploads_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#checkObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/fileuploads_controller.rb', line 9

def check
  @file = case params[:kind].try :to_sym
          when :link
            TranslationCms::Api::Materials::Weburl.find(params[:id])
          when :content
            TranslationCms::Api::Materials::Text.find(params[:id])
          else
            TranslationCms::Api::Materials::Attachment.find(params[:id])
          end

  render_json!
end

#destroyObject



22
23
24
25
26
27
28
29
# File 'app/controllers/fileuploads_controller.rb', line 22

def destroy
  @file = if params[:files].blank?
            remove_item(params[:id])
          else
            params[:files].map { |id| remove_item(id).try(:first) }
          end
  render_json!
end

#uploadObject



4
5
6
7
# File 'app/controllers/fileuploads_controller.rb', line 4

def upload
  send!
  render_json!
end