Class: Admin::SheetResourceController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Admin::SheetResourceController
show all
- Defined in:
- app/controllers/admin/sheet_resource_controller.rb
Instance Method Summary
collapse
Instance Method Details
#create ⇒ Object
28
29
30
31
32
|
# File 'app/controllers/admin/sheet_resource_controller.rb', line 28
def create
model.parent_id = @root.id
model.update_attributes!(params[model_symbol])
response_for :create
end
|
#new ⇒ Object
23
24
25
26
|
# File 'app/controllers/admin/sheet_resource_controller.rb', line 23
def new
self.model = model_class.new_with_defaults
response_for :new
end
|
#upload ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/admin/sheet_resource_controller.rb', line 8
def upload
if params[:upload].blank? render :text => '', :status => :bad_request
else
@sheet = model_class.create_or_update_from_upload!(params[:upload][:upload])
if @sheet.new_record?
response_for :create
else
slug = params[:upload][:upload].original_filename.to_slug().gsub(/-dot-css$/,'.css').gsub(/-js/,'.js')
flash[:notice] = "#{slug} was succesfully overwritten."
response_for :update
end
end
end
|