end
def new
- @scroll = Scroll.new
- @scroll.supply_default
- respond_to do |format|
- format.html
- format.js
- format.json { render json: @scroll.to_json(Scroll.show_json_opt) }
- end
+ form_new
end
-
+
def edit
- @scroll = Scroll.edit(params[:id], @operators)
- respond_to do |format|
- format.html
- format.js
- end
+ form_edit
end
-
+
def create
- @scroll = Scroll.new
- @scroll.supply_default
- @scroll.attributes = params[:scroll]
- @scroll.overwrite @operators
+ @item = Scroll.new
+ @item.supply_default
+ @item.attributes = params[:scroll]
+ @item.overwrite @operators
- respond_to do |format|
- if @scroll.save
+ if @item.save
+ respond_to do |format|
flash[:notice] = I18n.t('flash.notice.created', :model => Scroll.model_name.human)
- format.html { redirect_to @scroll }
- format.json { render json: @scroll.to_json(Scroll.show_json_opt), status: :created, location: @scroll }
- else
- flash[:notice] = I18n.t('flash.notice.not_created', :model => Scroll.model_name.human)
- format.html { render action: "new" }
- format.json { render json: @scroll.errors, status: :unprocessable_entity }
+ format.html { redirect_to @item }
+ format.json { render json: @item.to_json(Scroll.show_json_opt), status: :created, location: @item }
end
+ else
+ flash[:notice] = I18n.t('flash.notice.not_created', :model => Scroll.model_name.human)
+ render_new
+ format.html { render action: "new" }
+ format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
def update
- @scroll = Scroll.edit(params[:id], @operators)
- @scroll.attributes = params[:scroll]
- @scroll.overwrite @operators
+ @item = Scroll.edit(params[:id], @operators)
+ @item.attributes = params[:scroll]
+ @item.overwrite @operators
respond_to do |format|
- if @scroll.save
+ if @item.save
flash[:notice] = I18n.t('flash.notice.updated', :model => Scroll.model_name.human)
- format.html { redirect_to @scroll }
+ format.html { redirect_to @item }
format.json { head :ok }
else
flash[:notice] = I18n.t('flash.notice.not_updated', :model => Scroll.model_name.human)
format.html { render action: "edit" }
- format.json { render json: @scroll.errors, status: :unprocessable_entity }
+ format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
end
def destroy
- @scroll = Scroll.edit(params[:id], @operators)
+ @item = Scroll.edit(params[:id], @operators)
respond_to do |format|
- if @scroll.destroy_with_scroll_panel
+ if @item.destroy_with_scroll_panel
flash[:notice] = I18n.t('flash.notice.destroyed', :model => Scroll.model_name.human)
format.html { redirect_to '/home/scrolls' }
format.json { head :ok }
else
flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Scroll.model_name.human)
- format.html { redirect_to @scroll }
- format.json { render json: @scroll.errors, status: :unprocessable_entity }
+ format.html { redirect_to @item }
+ format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
end