Sha256: cf211c2a7e57ac2f73d7075e8652f21cb6e74ed78f2955a1673b1829ea8b6589
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
# coding: utf-8 class Redditor::Admin::ImagesController < Redditor::Admin::BaseController layout false def sort params[:slider_block_image].each_with_index do |id, idx| p = Redditor::Image.find(id) p.position = idx p.save end render nothing: true end def create @slider_block = @page.slider_blocks.find(params[:slider_block_id]) @image = @slider_block.images.build if @image.update_attributes(src: params[:file]) render "redditor/admin/slider_block_image" end end def destroy @image = Redditor::Image.find(params[:id]) if @image.destroy render js: "$('#slider_block_image_#{@image.id}').remove()" else render js: 'Ошибка! Изображение не было удалено.' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redditor-0.1.22 | app/controllers/redditor/admin/images_controller.rb |
redditor-0.1.20 | app/controllers/redditor/admin/images_controller.rb |