app/controllers/elt_controller.rb in parlement-0.8 vs app/controllers/elt_controller.rb in parlement-0.9
- old
+ new
@@ -13,17 +13,12 @@
def show
params[:id] = params[:id].gsub(/.html/, '')
@elt = Elt.find(params[:id])
@title = @elt.subject
@title += " (parlement)" if !@title.downcase.include? "parlement"
- if request.env['REQUEST_URI'].match '.dyndns'
- headers["Status"] = "301 Moved Permanently"
- redirect_to request.env['REQUEST_URI'].gsub(/.dyndns/, '')
- end
render :layout => 'top'
- # TODO
rescue ActiveRecord::RecordNotFound => e
flash[:error] = "Element '#{params[:id]}' does not exist"
headers["Status"] = "301 Moved Permanently"
redirect_to '/'
end
@@ -65,14 +60,10 @@
else
@elt.subject = 'Re: '+@elt.parent.subject
end
end
- def preview
- render :inline => format(params[:elt][:body])
- end
-
def create
@elt = Elt.new(params[:elt])
@elt.person = @session[:person]
if @elt.subject.match(/([<>\/]|href)/) then
@@ -80,10 +71,10 @@
logger.error "SPAM! '#{@elt.body}'"
flash[:error] = 'Sorry, to fight spam "<" ">" or "href" are forbidden in the subject!'
headers["Status"] = "404 Post considered as spam"
render :controller => 'elt', :action => 'new', :status => 404
elsif params[:submit] == "preview" or (@elt.publish and @elt.parent.add_child(@elt)) then
- headers["Status"] = "201 Created"
+ #headers["Status"] = "201 Created"
render :partial => '/elt/elt', :locals => { :elt => @elt, :eltTop => false }
else
flash[:notice] = 'Error'
render :controller => 'elt', :action => 'new'
end