Sha256: 4a761336b8d38c2205b91374f15ac2af4490df790a300b9e0ef03879dfe45211
Contents?: true
Size: 971 Bytes
Versions: 11
Compression:
Stored size: 971 Bytes
Contents
# coding: utf-8 class Redditor::Admin::SliderBlocksController < Redditor::Admin::BaseController def new @content_block = @page.slider_blocks.build(content_block_params) render "redditor/admin/pages/new" end def update @content_block = @page.slider_blocks.find(params[:id]) @content_block.update_attributes(content_block_params) render "redditor/admin/pages/wrapper" end def create temp_last_postion = @page.try(:content_blocks).try(:last).try(:position).to_i + 1 @content_block = @page.slider_blocks.build(content_block_params) @content_block.update_attributes(position: temp_last_postion) render "redditor/admin/pages/new" end def destroy @content_block = @page.slider_blocks.find(params[:id]) if @content_block.destroy render :js => "$('#slider_block_#{@content_block.id}').closest('dd').remove();" else render :js => "alert('Контент-блок не удален');" end end end
Version data entries
11 entries across 11 versions & 1 rubygems