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
#available_roles
Instance Method Details
#change_section_parent ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 6
def change_section_parent
begin
current_user.with_capability('drag_item', 'WebsiteTree') do
new_parent = WebsiteSection.where('id = ?', params[:parent_id]).first
website_section = WebsiteSection.find(params[:section_id])
if new_parent
website_section.move_to_child_of(new_parent)
else
website_section.move_to_root
end
render :json => {:success => true}
end
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
render :json => {:success => false, :message => ex.message}
end
end
|
#update_article_position ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 63
def update_article_position
begin
current_user.with_capability('drag_item', 'WebsiteTree') do
website_section = WebsiteSection.find(params[:section_id])
params[:position_array].each do |position|
model = website_section.website_section_contents.where('content_id = ?', position['id']).first
model.position = position['position'].to_i
model.save
end
render :json => {:success => true}
end
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
render :json => {:success => false, :message => ex.message}
end
end
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 45
def
begin
current_user.with_capability('drag_item', 'WebsiteTree') do
params[:position_array].each do |position|
model = WebsiteNavItem.find(position['id'])
model.position = position['position'].to_i
model.save
end
render :json => {:success => true}
end
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
render :json => {:success => false, :message => ex.message}
end
end
|
#update_section_position ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 27
def update_section_position
begin
current_user.with_capability('drag_item', 'WebsiteTree') do
params[:position_array].each do |position|
model = WebsiteSection.find(position['id'])
model.position = position['position'].to_i
model.save
end
render :json => {:success => true}
end
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
render :json => {:success => false, :message => ex.message}
end
end
|