Class: Boxroom::ShareLinksController

Inherits:
ApplicationController show all
Includes:
BaseController
Defined in:
app/controllers/boxroom/share_links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Note: @file and @folder are set in require_existing_file



28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/boxroom/share_links_controller.rb', line 28

def create
  @share_link = @file.share_links.build(permitted_params.share_link)
  @share_link.user = current_user

  if @share_link.save
    UserMailer.share_link_email(@share_link).deliver_now
    redirect_to @folder, :notice => t(:shared_successfully)
  else
    render :action => 'new'
  end
end

#destroyObject

Note: @share_link is set in require_existing_share_link



41
42
43
44
# File 'app/controllers/boxroom/share_links_controller.rb', line 41

def destroy
  @share_link.destroy
  redirect_to share_links_url
end

#indexObject



13
14
15
# File 'app/controllers/boxroom/share_links_controller.rb', line 13

def index
  @share_links = ShareLink.active_share_links
end

#newObject

Note: @file is set in require_existing_file



23
24
25
# File 'app/controllers/boxroom/share_links_controller.rb', line 23

def new
  @share_link = @file.share_links.build
end

#showObject

Note: @file is set in require_existing_file



18
19
20
# File 'app/controllers/boxroom/share_links_controller.rb', line 18

def show
  send_file @file.attachment.path, :filename => @file.attachment_file_name unless @file.nil?
end