Sha256: ba43e1c00dab3a0841756c957c5caf67d9c23091fa307a7f9c3c4734a0c03e57
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
# encoding: utf-8 module ConstructorPages class FieldsController < ConstructorCore::AdminController # TODO include ConstructorCore::DeviseHelper before_filter :authenticate_user! layout 'constructor_core/application_admin' def new @field = Field.new @field.template = Template.find(params[:template_id]) end def edit @field = Field.find(params[:id]) @field.template = Template.find(params[:template_id]) end def create @field = Field.new params[:field] if @field.save redirect_to edit_template_path(@field.template_id), :notice => "Поле «#{@field.name}» успешно добавлено." else render :action => 'new', :template_id => @field.template_id end end def update @field = Field.find params[:id] if @field.update_attributes params[:field] redirect_to edit_template_url(@field.template.id), :notice => "Поле «#{@field.name}» успешно обновлено." else render :action => "edit" end end def destroy @field = Field.find(params[:id]) name = @field.name template = @field.template.id @field.destroy redirect_to edit_template_url(template), :notice => "Поле «#{name}» успешно удалено." end def move_up @field = Field.find(params[:id]) @field.move_higher redirect_to :back, :notice => 'Поле успешно перемещено.' end def move_down @field = Field.find(params[:id]) @field.move_lower redirect_to :back, :notice => 'Поле успешно перемещено.' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
constructor-pages-0.2.8 | app/controllers/constructor_pages/fields_controller.rb |