- @title = "Changeset | #{@changeset.id}"
- rescue ActiveRecord::RecordNotFound
- @type = "changeset"
- render :action => "not_found", :status => :not_found
+ @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
+ @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] )
+ @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] )
+
+ @next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
+ @prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
+ rescue ActiveRecord::RecordNotFound
+ render :action => "not_found", :status => :not_found
+ end
+
+private
+
+ def timeout
+ SystemTimer.timeout_after(30) do
+ yield
+ end
+ rescue ActionView::TemplateError => ex
+ if ex.original_exception.is_a?(Timeout::Error)
+ render :action => "timeout", :status => :request_timeout
+ else
+ raise