Ordem correta

master
Alinson S. Xavier 16 years ago
parent c2ac38da0c
commit c168bb62df

@ -20,9 +20,9 @@ class LogController < ApplicationController
def index
if @course
@log_entries = @course.log_entries.paginate(:page => params[:page], :per_page => 30)
@log_entries = @course.log_entries.paginate(:page => params[:page], :per_page => 30, :order => "created_at desc")
else
@log_entries = LogEntry.paginate(:page => params[:page], :per_page => 30)
@log_entries = LogEntry.paginate(:page => params[:page], :per_page => 30, :order => "created_at desc")
end
respond_to do |format|

@ -41,6 +41,9 @@ class Course < ActiveRecord::Base
:order => "position",
:dependent => :destroy
has_and_belongs_to_many :users,
:order => "last_seen desc"
# Validacao
generate_validations
validates_format_of :short_name, :with => /^[^0-9]/

@ -30,7 +30,7 @@ class WikiDeleteLogEntry < WikiLogEntry
end
def undo!(current_user)
wiki_page.update_attribute(:deleted_at, nil)
wiki_page.update_attribute(:position, wiki_page.course.wiki_pages.maximum(:position) + 1)
wiki_page.update_attribute(:position, (wiki_page.course.wiki_pages.maximum(:position)||0) + 1)
WikiRestoreLogEntry.create!(:target_id => wiki_page.id, :user_id => current_user.id, :course => wiki_page.course)
end
end

@ -15,9 +15,9 @@
.date
= tz(entry.created_at).strftime("%H:%M")
%img.avatar{:src => gravatar_url_for(entry.user.email, 27)}
= "Disciplina " + link_to(h(entry.course.full_name), course_url(entry.course))
%br
=link_to truncate(h(entry.user.display_name), :length => 20), user_url(entry.user.id)
= render(:partial => 'log/log_entry', :locals => { :entry => entry })
%br
= "Disciplina " + link_to(h(entry.course.full_name), course_url(entry.course))
= will_paginate @log_entries