summaryrefslogtreecommitdiff
path: root/app/controllers/pages_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/pages_controller.rb')
-rw-r--r--app/controllers/pages_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index e298265..4b3b541 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -12,4 +12,18 @@ class PagesController < ApplicationController
12 end 12 end
13 13
14 end 14 end
15
16
17 def sort_images
18 page = Page.find(params[:id])
19
20 page.related_assets.destroy_all
21
22 params[:images].each_with_index do |id, index|
23 asset = Asset.find(id)
24 page.related_assets.create(:asset_id => asset.id, :position => index+1)
25 end
26
27 render :nothing => true, :status => 200
28 end
15end 29end