summaryrefslogtreecommitdiff
path: root/app/controllers/pages_controller.rb
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-01 23:13:45 +0200
committerhukl <contact@smyck.org>2009-09-01 23:13:45 +0200
commitcae5b4accca2f880bbd4a5ffae265f78c689075c (patch)
tree1688c0e655559999b4963846a80ba34b95b79c7f /app/controllers/pages_controller.rb
parent656af6c97987e103c30946ec944cac433252fe75 (diff)
Added javascript goodness to add and sort and drag and drop images on pages
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