Sha256: 9a129f84c8364b4d8bdbc8a0564ce5ea7de10a596fb0651bd2da20e2d6a343e1
Contents?: true
Size: 795 Bytes
Versions: 11
Compression:
Stored size: 795 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(src: params[:file]) if @image.save render "redditor/admin/pages/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
11 entries across 11 versions & 1 rubygems