Log global
This commit is contained in:
@@ -19,7 +19,12 @@ class LogController < ApplicationController
|
||||
before_filter :find_course
|
||||
|
||||
def index
|
||||
if @course
|
||||
@log_entries = @course.log_entries.find(:all, :limit => 50) #.paginate(:page => params[:page], :per_page => 30)
|
||||
else
|
||||
@log_entries = LogEntry.find(:all, :limit => 50)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.rss { response.content_type = Mime::RSS }
|
||||
@@ -38,7 +43,9 @@ class LogController < ApplicationController
|
||||
|
||||
protected
|
||||
def find_course
|
||||
unless params[:course_id].nil?
|
||||
params[:course_id] = Course.find_by_short_name(params[:course_id]).id if !params[:course_id].is_numeric? and !Course.find_by_short_name(params[:course_id]).nil?
|
||||
@course = Course.find(params[:course_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
- @title = "#{App.title} - #{h(@course.full_name)} - Mudanças recentes"
|
||||
- @location = capture do
|
||||
- if @course
|
||||
- @title = "#{App.title} - #{h(@course.full_name)} - Mudanças recentes"
|
||||
- @location = capture do
|
||||
= link_to(App.title, index_url) + "›"
|
||||
= link_to("Disciplinas", courses_url) + "›"
|
||||
= link_to(h(@course.full_name), course_url(@course)) + "›"
|
||||
= link_to("Log", course_log_url(@course))
|
||||
|
||||
- @left_panel = render 'courses/_left_panel'
|
||||
- @content = yield
|
||||
- @left_panel = render 'courses/_left_panel'
|
||||
- @content = yield
|
||||
|
||||
- else
|
||||
- @title = "#{App.title} - Mudanças recentes"
|
||||
- @location = capture do
|
||||
= link_to(App.title, index_url) + "›"
|
||||
= link_to("Mudanças recentes", log_url)
|
||||
|
||||
- @content = yield
|
||||
- @left_panel = render('widgets/menu_navigation') + render('widgets/menu_user')
|
||||
|
||||
= render 'layouts/base'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= "Anexo " + link_to(h(entry.attachment.file_name), course_attachment_url(@course, entry.attachment))
|
||||
= "Anexo " + link_to(h(entry.attachment.file_name), course_attachment_url(entry.course, entry.attachment))
|
||||
|
||||
= "criado " if entry.kind_of?(AttachmentCreateLogEntry)
|
||||
= "editado " if entry.kind_of?(AttachmentEditLogEntry)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= "Evento " + link_to(h(entry.event.title), course_event_url(@course, entry.event))
|
||||
= "Evento " + link_to(h(entry.event.title), course_event_url(entry.course, entry.event))
|
||||
|
||||
= "criado " if entry.kind_of?(EventCreateLogEntry)
|
||||
= "editado " if entry.kind_of?(EventEditLogEntry)
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
= render(:partial => 'log/event_log_entry.html.haml', :locals => { :entry => entry }) if entry.kind_of?(EventLogEntry)
|
||||
= render(:partial => 'log/news_log_entry.html.haml', :locals => { :entry => entry }) if entry.kind_of?(NewsLogEntry)
|
||||
= render(:partial => 'log/wiki_log_entry.html.haml', :locals => { :entry => entry }) if entry.kind_of?(WikiLogEntry)
|
||||
= "(" + link_to("undo", undo_course_log_url(@course, entry)) + ")" if entry.reversible?
|
||||
= "(" + link_to("undo", undo_course_log_url(entry.course, entry.id)) + ")" if entry.reversible?
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= "Notícia " + link_to(h(entry.news.title), course_news_url(@course, entry.news))
|
||||
= "Notícia " + link_to(h(entry.news.title), course_news_url(entry.course, entry.news))
|
||||
|
||||
= "criada " if entry.kind_of?(NewsCreateLogEntry)
|
||||
= "editada " if entry.kind_of?(NewsEditLogEntry)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= "Página " + link_to(h(entry.wiki_page.versions.last.title), course_wiki_url(@course, entry.wiki_page.id, :version => entry.wiki_page.version))
|
||||
= "Página " + link_to(h(entry.wiki_page.versions.last.title), course_wiki_url(entry.course, entry.wiki_page.id, :version => entry.wiki_page.version))
|
||||
|
||||
= "criada " if entry.kind_of?(WikiCreateLogEntry)
|
||||
= "editada " if entry.kind_of?(WikiEditLogEntry)
|
||||
@@ -8,6 +8,6 @@
|
||||
- if entry.kind_of?(WikiEditLogEntry)
|
||||
- if entry.wiki_page.description and !entry.wiki_page.description.empty?
|
||||
= "(<i>#{h(entry.wiki_page.description)}</i>)"
|
||||
= "(" + link_to("diff", diff_course_wiki_url(@course, entry.wiki_page.id, :from => entry.wiki_page.version - 1, :to => entry.wiki_page.version)) + ")"
|
||||
= "(" + link_to("edit", edit_course_wiki_url(@course, entry.wiki_page.id, :description => "Revertendo para versão #{entry.wiki_page.version}", :version => entry.wiki_page.version)) + ")"
|
||||
= "(" + link_to("undo", edit_course_wiki_url(@course, entry.wiki_page.id, :description => "Revertendo para versão #{entry.wiki_page.version-1}", :version => entry.wiki_page.version - 1)) + ")"
|
||||
= "(" + link_to("diff", diff_course_wiki_url(entry.course, entry.wiki_page.id, :from => entry.wiki_page.version - 1, :to => entry.wiki_page.version)) + ")"
|
||||
= "(" + link_to("edit", edit_course_wiki_url(entry.course, entry.wiki_page.id, :description => "Revertendo para versão #{entry.wiki_page.version}", :version => entry.wiki_page.version)) + ")"
|
||||
= "(" + link_to("undo", edit_course_wiki_url(entry.course, entry.wiki_page.id, :description => "Revertendo para versão #{entry.wiki_page.version-1}", :version => entry.wiki_page.version - 1)) + ")"
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
%h4.title= h(@course.full_name)
|
||||
%h4.title= @course ? h(@course.full_name) : App.title
|
||||
%h1.title Mudanças recentes
|
||||
|
||||
= auto_discovery_link_tag :rss, formatted_course_log_url(@course, :rss)
|
||||
- if @course
|
||||
= auto_discovery_link_tag :rss, formatted_course_log_url(@course, :rss)
|
||||
|
||||
.box
|
||||
%table
|
||||
%tr
|
||||
%th Data
|
||||
%th Usuário
|
||||
- unless @course
|
||||
%th Disciplina
|
||||
%th Descrição
|
||||
- @log_entries.each do |entry|
|
||||
%tr
|
||||
%td= entry.created_at.strftime("%d/%m/%y %H:%M:%S")
|
||||
%td= link_to truncate(h(entry.user.display_name), 20), user_path(entry.user)
|
||||
- unless @course
|
||||
%td= link_to h(entry.course.short_name), course_url(entry.course)
|
||||
%td= render(:partial => 'log/log_entry', :locals => { :entry => entry })
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
%ul
|
||||
%li= link_to "Courses"[].titleize, courses_url
|
||||
%li= link_to "Users"[].titleize, users_url
|
||||
%li= link_to "Mudanças recentes", log_url
|
||||
|
||||
@@ -78,6 +78,10 @@ ActionController::Routing::Routes.draw do |map|
|
||||
map.connect 'stylesheets/cache/:action.:format', :controller => 'stylesheets'
|
||||
map.connect 'stylesheets/cache/:action.:color.:format', :controller => 'stylesheets'
|
||||
|
||||
# Mudancas recentes global
|
||||
map.log 'log', :controller => 'log', :action => 'index', :format => 'html'
|
||||
map.formatted_log 'log.:format', :controller => 'log', :action => 'index'
|
||||
|
||||
# Front page
|
||||
map.index '', :controller => 'courses', :action => 'index'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user