Class: Iconly::PackagesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/iconly/packages_controller.rb', line 14

def create
  @package = current_user.packages.build(package_params)
  @package.icon_files_required = true

  if @package.save
    redirect_to path_after_create_package,
                notice: '<i class="iconly-baby mr-05"></i> Great, more new shiny icons in the bag!'
  else
    render :new
  end
end

#destroyObject



30
31
32
33
# File 'app/controllers/iconly/packages_controller.rb', line 30

def destroy
  @package.destroy
  redirect_to (request.referer || projects_path), notice: '<i class="iconly-baby mr-05"></i> Package is now gone'
end

#newObject



9
10
11
12
# File 'app/controllers/iconly/packages_controller.rb', line 9

def new
  store_path_after_create_package
  @package = Package.new
end

#shareObject



26
27
28
# File 'app/controllers/iconly/packages_controller.rb', line 26

def share
  @package.update!(shared: !@package.shared?)
end