format.html # index.html.erb
end
else
- redirect_to new_demander_path, notice: 'Demander not found.'
+ flash[:notice] = I18n.t('demanders.flash.notice.not_found')
+ redirect_to new_demander_path
end
end
respond_to do |format|
if @demander.store
- format.html { redirect_to @demander, notice: 'Demander was successfully created.' }
+ flash[:notice] = I18n.t('flash.notice.created', :model => Demander.model_name.human)
+ format.html { redirect_to @demander }
format.json { render json: @demander.to_json(Demander.show_json_opt), status: :created, location: @demander }
else
format.html { render action: "new" }
@demander.overwrite @demand_user
respond_to do |format|
if @demander.store
- format.html { redirect_to @demander, notice: 'Demander was successfully updated.' }
+ flash[:notice] = I18n.t('flash.notice.updated', :model => Demander.model_name.human)
+ format.html { redirect_to @demander }
format.json { head :ok }
else
format.html { render action: "edit" }
@demander = @demand_user.demander
respond_to do |format|
if @demander.demander_status.request
- format.html { redirect_to demanders_path, notice: 'Demander was successfully updated.' }
+ flash[:notice] = I18n.t('demanders.flash.notice.requested')
+ format.html { redirect_to demanders_path }
format.json { head :ok }
else
- format.html { redirect_to demanders_path, notice: 'Demander was not successfully updated.' }
+ flash[:notice] = I18n.t('demanders.flash.notice.not_requested')
+ format.html { redirect_to demanders_path }
format.json { render json: @demander.errors, status: :unprocessable_entity }
end
end
@demander = Demander.edit(params[:id], @demand_user)
respond_to do |format|
if @demander.stop
- format.html { redirect_to demanders_url, notice: 'Demander was successfully stopped.' }
+ flash[:notice] = I18n.t('demanders.flash.notice.stopped')
+ format.html { redirect_to demanders_url }
format.json { head :ok }
else
- format.html { redirect_to demanders_url, notice: 'Demander was not successfully stopped.' }
+ flash[:notice] = I18n.t('demanders.flash.notice.not_stopped')
+ format.html { redirect_to demanders_url }
format.json { render json: @demander.errors, status: :unprocessable_entity }
end
end