Class: PushType::AssetsController

Inherits:
AdminController show all
Defined in:
app/controllers/push_type/assets_controller.rb

Instance Method Summary collapse

Methods inherited from AdminController

#info

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
# File 'app/controllers/push_type/assets_controller.rb', line 18

def create
  if @asset.save
    flash[:notice] = 'File successfully uploaded.'
    redirect_to push_type.assets_path
  else
    render 'new'
  end
end

#destroyObject



43
44
45
46
47
# File 'app/controllers/push_type/assets_controller.rb', line 43

def destroy
  @asset.trash!
  flash[:notice] = 'Media trashed.'
  redirect_to push_type.assets_path
end

#editObject



31
32
# File 'app/controllers/push_type/assets_controller.rb', line 31

def edit
end

#indexObject



11
12
13
# File 'app/controllers/push_type/assets_controller.rb', line 11

def index
  @assets = PushType::Asset.not_trash.page(params[:page])
end

#newObject



15
16
# File 'app/controllers/push_type/assets_controller.rb', line 15

def new
end

#updateObject



34
35
36
37
38
39
40
41
# File 'app/controllers/push_type/assets_controller.rb', line 34

def update
  if @asset.update_attributes asset_params
    flash[:notice] = 'Media successfully updated.'
    redirect_to push_type.assets_path
  else
    render 'edit'
  end
end

#uploadObject



27
28
29
# File 'app/controllers/push_type/assets_controller.rb', line 27

def upload
  respond_with PushType::Asset.create(asset_params).to_json, location: false
end