diff --git a/app/controllers/log_controller.rb b/app/controllers/log_controller.rb index b6dfd68..6c1700c 100644 --- a/app/controllers/log_controller.rb +++ b/app/controllers/log_controller.rb @@ -20,9 +20,9 @@ class LogController < ApplicationController def index if @course - @log_entries = @course.log_entries.find(:all, :limit => 50) #.paginate(:page => params[:page], :per_page => 30) + @log_entries = @course.log_entries.paginate(:page => params[:page], :per_page => 30) else - @log_entries = LogEntry.find(:all, :limit => 50, :order => 'created_at desc') + @log_entries = LogEntry.paginate(:page => params[:page], :per_page => 30) end respond_to do |format| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 28f483f..247d68c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -21,11 +21,11 @@ class UsersController < ApplicationController before_filter :require_admin, :only => [ :edit, :update, :destroy ] def index - @users = User.find(:all, :order => 'name') + @users = User.paginate(:page => params[:page], :per_page => 20, :order => 'last_seen') respond_to do |format| format.html - format.xml { render :xml => @users } + format.xml { render :xml => User.find(:all) } end end @@ -101,7 +101,7 @@ class UsersController < ApplicationController flash[:message] = 'Welcome back, {u}'[:login_success, @user.login] redirect_to_stored else - flash[:warning] = 'Login failed' + flash[:warning] = 'Login failed'[] end end end @@ -116,11 +116,11 @@ class UsersController < ApplicationController @news = [] @events = [] - if params[:format] == 'html' + if params[:secret] + @user = User.find_by_secret(params[:secret]) + else return require_login unless logged_in? @user = @current_user - else - @user = User.find_by_secret(params[:secret]) end unless @user.courses.empty? @@ -163,19 +163,6 @@ class UsersController < ApplicationController end end -# def forgot_password -# if request.post? -# u = User.find_by_email(params[:user][:email]) -# if u and u.send_new_password -# flash[:message] = "Uma nova senha foi enviada para o seu email." -# redirect_to :action=>'login' -# else -# flash[:warning] = "Não foi possível gerar uma nova senha." -# end -# end -# end - - #Funções do Fórum protected def find_user params[:id] = User.find_by_login(params[:id]).id if params[:id] and !params[:id].is_numeric? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ab2325b..f6d3324 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -76,7 +76,7 @@ module ApplicationHelper end def gravatar_url_for(email, size=80) - "http://www.gravatar.com/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&size=#{size}&default=#{App.default_avatar}" + "http://www.gravatar.com/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&size=#{size}&default=#{App.default_avatar}_#{size}.png" end def action_icon(action_name, description, options = {}, html_options = {}) diff --git a/app/models/log_entry.rb b/app/models/log_entry.rb index f2fa95b..3baac3c 100644 --- a/app/models/log_entry.rb +++ b/app/models/log_entry.rb @@ -41,7 +41,7 @@ class LogEntry < ActiveRecord::Base end end -require 'log_entry/attachment_log_entry.rb' -require 'log_entry/event_log_entry.rb' -require 'log_entry/news_log_entry.rb' -require 'log_entry/wiki_log_entry.rb' +load 'log_entry/attachment_log_entry.rb' +load 'log_entry/event_log_entry.rb' +load 'log_entry/news_log_entry.rb' +load 'log_entry/wiki_log_entry.rb' diff --git a/app/views/courses/_right_panel.html.haml b/app/views/courses/_right_panel.html.haml index f768643..83f356d 100644 --- a/app/views/courses/_right_panel.html.haml +++ b/app/views/courses/_right_panel.html.haml @@ -1,3 +1,3 @@ -# cache(course_path(@course.id, :part => :right)) do = render :file => 'widgets/calendario' -= render :file => 'widgets/news' += render :file => 'widgets/users' diff --git a/app/views/log/_attachment_log_entry.html.haml b/app/views/log/_attachment_log_entry.html.haml index ce04bdb..8b9e3b1 100644 --- a/app/views/log/_attachment_log_entry.html.haml +++ b/app/views/log/_attachment_log_entry.html.haml @@ -1,6 +1,6 @@ -= "Anexo " + link_to(h(entry.attachment.file_name), course_attachment_url(entry.course, entry.attachment)) += "criou " if entry.kind_of?(AttachmentCreateLogEntry) += "editou " if entry.kind_of?(AttachmentEditLogEntry) += "excluiu " if entry.kind_of?(AttachmentDeleteLogEntry) += "restaurou " if entry.kind_of?(AttachmentRestoreLogEntry) -= "criado " if entry.kind_of?(AttachmentCreateLogEntry) -= "editado " if entry.kind_of?(AttachmentEditLogEntry) -= "excluído " if entry.kind_of?(AttachmentDeleteLogEntry) -= "restaurado " if entry.kind_of?(AttachmentRestoreLogEntry) += "o anexo " + link_to(h(entry.attachment.file_name), course_attachment_url(entry.course, entry.attachment)) diff --git a/app/views/log/_event_log_entry.html.haml b/app/views/log/_event_log_entry.html.haml index 9b5934b..3a99317 100644 --- a/app/views/log/_event_log_entry.html.haml +++ b/app/views/log/_event_log_entry.html.haml @@ -1,6 +1,6 @@ -= "Evento " + link_to(h(entry.event.title), course_event_url(entry.course, entry.event, :version => entry.version)) += "criou " if entry.kind_of?(EventCreateLogEntry) += "editou " if entry.kind_of?(EventEditLogEntry) += "excluiu " if entry.kind_of?(EventDeleteLogEntry) += "restaurou " if entry.kind_of?(EventRestoreLogEntry) -= "criado " if entry.kind_of?(EventCreateLogEntry) -= "editado " if entry.kind_of?(EventEditLogEntry) -= "excluído " if entry.kind_of?(EventDeleteLogEntry) -= "restaurado " if entry.kind_of?(EventRestoreLogEntry) += "o evento " + link_to(h(entry.event.title), course_event_url(entry.course, entry.event, :version => entry.version)) diff --git a/app/views/log/_news_log_entry.html.haml b/app/views/log/_news_log_entry.html.haml index fa50ade..28f4020 100644 --- a/app/views/log/_news_log_entry.html.haml +++ b/app/views/log/_news_log_entry.html.haml @@ -1,6 +1,6 @@ -= "Notícia " + link_to(h(entry.news.title), course_news_instance_url(entry.course, entry.news, :version => entry.version)) += "criou " if entry.kind_of?(NewsCreateLogEntry) += "editou " if entry.kind_of?(NewsEditLogEntry) += "excluiu " if entry.kind_of?(NewsDeleteLogEntry) += "restaurou " if entry.kind_of?(NewsRestoreLogEntry) -= "criada " if entry.kind_of?(NewsCreateLogEntry) -= "editada " if entry.kind_of?(NewsEditLogEntry) -= "excluída " if entry.kind_of?(NewsDeleteLogEntry) -= "restaurada " if entry.kind_of?(NewsRestoreLogEntry) += "a notícia " + link_to(h(entry.news.title), course_news_instance_url(entry.course, entry.news, :version => entry.version)) diff --git a/app/views/log/_wiki_log_entry.html.haml b/app/views/log/_wiki_log_entry.html.haml index 322c759..9728976 100644 --- a/app/views/log/_wiki_log_entry.html.haml +++ b/app/views/log/_wiki_log_entry.html.haml @@ -1,19 +1,21 @@ += "criou " if entry.kind_of?(WikiCreateLogEntry) += "editou " if entry.kind_of?(WikiEditLogEntry) += "excluiu " if entry.kind_of?(WikiDeleteLogEntry) += "restaurou " if entry.kind_of?(WikiRestoreLogEntry) + - if entry.version - = "Página " + link_to(h(entry.wiki_page.title), course_wiki_instance_url(entry.course, entry.wiki_page.id, :version => entry.version)) + = "a página " + link_to(h(entry.wiki_page.title), course_wiki_instance_url(entry.course, entry.wiki_page.id, :version => entry.version)) - else - = "Página " + link_to(h(entry.wiki_page.title), course_wiki_instance_url(entry.course, entry.wiki_page.id)) + = "a página " + link_to(h(entry.wiki_page.title), course_wiki_instance_url(entry.course, entry.wiki_page.id)) -= "criada " if entry.kind_of?(WikiCreateLogEntry) -= "editada " if entry.kind_of?(WikiEditLogEntry) -= "excluída " if entry.kind_of?(WikiDeleteLogEntry) -= "restaurada " if entry.kind_of?(WikiRestoreLogEntry) - current_version = entry.wiki_page.versions.find_by_version(entry.version) -- previous_version = current_version.previous +- previous_version = current_version.previous if current_version - if entry.kind_of?(WikiEditLogEntry) - - if current_version.description and !current_version.description.empty? - = "(#{h(current_version.description)})" + - unless current_version.nil? + - if current_version.description and !current_version.description.empty? + = "(#{h(current_version.description)})" - unless previous_version.nil? = "(" + link_to("diff", diff_course_wiki_instance_url(entry.course, entry.wiki_page.id, :from => previous_version.version, :to => entry.version)) + ")" diff --git a/app/views/log/index.html.haml b/app/views/log/index.html.haml index c5b522b..94e4063 100644 --- a/app/views/log/index.html.haml +++ b/app/views/log/index.html.haml @@ -4,18 +4,20 @@ -# if @course =# auto_discovery_link_tag :rss, course_log_url(@course.id, :format => :rss) +- @log_entries_by_day = @log_entries.group_by { |l| l.created_at.beginning_of_day } .box - %table - %tr - %th Data - %th Usuário - - unless @course - %th Disciplina - %th Descrição - - @log_entries.each do |entry| - %tr - %td= tz(entry.created_at).strftime("%d/%m/%y %H:%M:%S") - %td= link_to truncate(h(entry.user.display_name), :length => 20), user_url(entry.user.id) - - unless @course - %td= link_to h(entry.course.short_name), course_url(entry.course) - %td= render(:partial => 'log/log_entry', :locals => { :entry => entry }) + %ul.log_entries + - @log_entries_by_day.each do |day, entries| + %h3 + =tz(day).strftime("%d de %B de %Y") + - entries.each do |entry| + %li + .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 }) + += will_paginate @log_entries diff --git a/app/views/stylesheets/wiki.css.erb b/app/views/stylesheets/wiki.css.erb index 0d1a11f..50aceff 100644 --- a/app/views/stylesheets/wiki.css.erb +++ b/app/views/stylesheets/wiki.css.erb @@ -295,7 +295,7 @@ body { border-bottom: 0px solid #ccc; } -.widget_news li, .widget_events li, #shoutbox li, #shoutbox { +.widget_users li, .widget_news li, .widget_events li { font-size: 11px; } @@ -666,6 +666,14 @@ form dl { margin: 5px 18px 0px 0px; } +.user_list { + list-style: none; +} + +.user_list li { + background-image: none; +} + .card h1 { margin-bottom: 0px; } .card p { margin-top: 0px; } @@ -827,7 +835,26 @@ form dt p { margin: 9px 0px; } +.log_entries .date { + float: left; + width: 50px; + margin: 0px 15px 0px -90px; +} + +.log_entries .avatar { + float: left; + margin: 0px 0px 0px -40px; +} + +.log_entries * { + vertical-align: top; + background-image: none !important; +} + +.log_entries li { + padding-left: 110px !important; +} -xbody { background-image: url(<%= App.base_path %>/prototype/line.png); background-repeat: repeat; } -xhtml * { background-color: transparent !important; } +/*body { background-image: url(<%= App.base_path %>/prototype/line.png); background-repeat: repeat; } +html * { background-color: transparent !important; }*/ diff --git a/app/views/users/_user.html.haml b/app/views/users/_user.html.haml index 887021a..b568ec7 100644 --- a/app/views/users/_user.html.haml +++ b/app/views/users/_user.html.haml @@ -1 +1,3 @@ -%li= link_to h(user.name), user_path(user) +%li + %img.avatar{:src => gravatar_url_for(user.email, 27)} + = link_to h(user.display_name), user_url(user) diff --git a/app/views/users/dashboard.html.haml b/app/views/users/dashboard.html.haml index 95bb84f..9a653ea 100644 --- a/app/views/users/dashboard.html.haml +++ b/app/views/users/dashboard.html.haml @@ -6,7 +6,7 @@ .dashboard .box .cmd - =link_to "rss", dashboard_url(:secret => @current_user.secret, :format => 'rss') + =link_to "rss", formatted_dashboard_url(:secret => @current_user.secret, :format => 'rss') - last_time = nil %h3 Notícias Recentes @@ -26,7 +26,7 @@ .box .cmd - =link_to "ical", dashboard_url(:secret => @current_user.secret, :format => 'ics') + =link_to "ical", formatted_dashboard_url(:secret => @current_user.secret, :format => 'ics') - last_time = nil %h3 Próximos Eventos diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index baafdfa..7a68aa7 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -3,5 +3,6 @@ %h1.title Usuários .box - %ul + %ul.user_list = render :partial => @users + = will_paginate @users diff --git a/app/views/widgets/_menu_disciplina.html.erb b/app/views/widgets/_menu_disciplina.html.erb index 27f0fdc..e03a698 100644 --- a/app/views/widgets/_menu_disciplina.html.erb +++ b/app/views/widgets/_menu_disciplina.html.erb @@ -3,7 +3,8 @@