Ordem correta
This commit is contained in:
@@ -20,9 +20,9 @@ class LogController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
if @course
|
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
|
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
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ class Course < ActiveRecord::Base
|
|||||||
:order => "position",
|
:order => "position",
|
||||||
:dependent => :destroy
|
:dependent => :destroy
|
||||||
|
|
||||||
|
has_and_belongs_to_many :users,
|
||||||
|
:order => "last_seen desc"
|
||||||
|
|
||||||
# Validacao
|
# Validacao
|
||||||
generate_validations
|
generate_validations
|
||||||
validates_format_of :short_name, :with => /^[^0-9]/
|
validates_format_of :short_name, :with => /^[^0-9]/
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class WikiDeleteLogEntry < WikiLogEntry
|
|||||||
end
|
end
|
||||||
def undo!(current_user)
|
def undo!(current_user)
|
||||||
wiki_page.update_attribute(:deleted_at, nil)
|
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)
|
WikiRestoreLogEntry.create!(:target_id => wiki_page.id, :user_id => current_user.id, :course => wiki_page.course)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
.date
|
.date
|
||||||
= tz(entry.created_at).strftime("%H:%M")
|
= tz(entry.created_at).strftime("%H:%M")
|
||||||
%img.avatar{:src => gravatar_url_for(entry.user.email, 27)}
|
%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)
|
=link_to truncate(h(entry.user.display_name), :length => 20), user_url(entry.user.id)
|
||||||
= render(:partial => 'log/log_entry', :locals => { :entry => entry })
|
= 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
|
= will_paginate @log_entries
|
||||||
|
|||||||
Reference in New Issue
Block a user