Class: Knitkit::ErpApp::Desktop::PositionController
- Inherits:
-
AppController
- Object
- ErpApp::Desktop::BaseController
- AppController
- Knitkit::ErpApp::Desktop::PositionController
show all
- Defined in:
- app/controllers/knitkit/erp_app/desktop/position_controller.rb
Constant Summary
AppController::KNIT_KIT_ROOT
Instance Method Summary
collapse
Instance Method Details
#update_article_position ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 36
def update_article_position
website_section = WebsiteSection.find(params[:section_id])
params[:position_array].each do |position|
article = website_section.website_section_contents.where('content_id = ?', position['id']).first
article.position = position['position'].to_i
article.save
end
render :json => {:success => true}
end
|
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 26
def
params[:position_array].each do |position|
website_nav_item = WebsiteNavItem.find(position['id'])
website_nav_item.position = position['position'].to_i
website_nav_item.save
end
render :json => {:success => true}
end
|
#update_section_position ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 8
def update_section_position
params[:position_array].each do |position|
website_section = WebsiteSection.find(position['id'])
if position['parent_id'].blank? || position['parent_id'] == 'root'
website_section.move_to_root
else
website_section.move_to_child_of(WebsiteSection.find(position['parent_id']))
end
website_section.position = position['position'].to_i
website_section.save
end
render :json => {:success => true}
end
|