diff --git a/app/assets/stylesheets/wiki.scss.erb b/app/assets/stylesheets/wiki.scss.erb index c5547ac..8f89ae1 100644 --- a/app/assets/stylesheets/wiki.scss.erb +++ b/app/assets/stylesheets/wiki.scss.erb @@ -107,8 +107,10 @@ body { } #wrapper { - background-color: #f4f4f4; box-shadow: 2px 2px 2px rgba(0,0,0,0.1); + // background: linear-gradient(#e4e4e4, #f4f4f4 30%); + background-color: #f4f4f4; + border-top: 2px solid #ccc; } .wrapper2 { // background-image: url(<%= App.base_path %>/assets/bg_body.png); @@ -647,8 +649,14 @@ background-position: 0px 12px; } .pagination { margin: 18px 0px; - text-align: right; + text-align: center; } +.pagination a, .pagination em, .pagination span { + border: 1px solid #eee; + padding: 2px 9px; + border-radius: 3px; +} + .fieldWithErrors input, .fieldWithErrors textarea { border: 2px solid #c00; } diff --git a/app/controllers/log_controller.rb b/app/controllers/log_controller.rb index 593a853..5c1f376 100644 --- a/app/controllers/log_controller.rb +++ b/app/controllers/log_controller.rb @@ -20,44 +20,46 @@ # along with this program. If not, see . class LogController < ApplicationController + before_filter :require_login, only: [:undo] + before_filter :find_course, only: [:index] - before_filter :require_login, :only => [ :undo ] + def index + if @course + @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, + conditions: ["course_id not in (select id from courses where hidden = ?)", true], + order: "created_at desc") + end - def index - if @course - @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, - :conditions => [ "course_id not in (select id from courses where hidden = ?)", true], - :order => "created_at desc") - end + respond_to do |format| + format.html + format.rss { response.content_type = Mime::RSS } + format.xml { render xml: @log_entries } + end + end - respond_to do |format| - format.html - format.rss { response.content_type = Mime::RSS } - format.xml { render :xml => @log_entries } - end - end + def undo + @log_entry = LogEntry.find(params[:id]) + @log_entry.undo!(@current_user) - def undo - @log_entry = LogEntry.find(params[:id]) - @log_entry.undo!(@current_user) + respond_to do |format| + format.html do + redirect_to course_event_url(@log_entry.course, @log_entry.target_id) if @log_entry.is_a?(EventDeleteLogEntry) + redirect_to course_attachment_url(@log_entry.course, @log_entry.target_id) if @log_entry.is_a?(AttachmentDeleteLogEntry) + redirect_to course_news_instance_url(@log_entry.course, @log_entry.target_id) if @log_entry.is_a?(NewsDeleteLogEntry) + redirect_to course_wiki_instance_url(@log_entry.course, @log_entry.target_id) if @log_entry.is_a?(WikiDeleteLogEntry) + end + end + end - respond_to do |format| - format.html do - redirect_to course_event_url(@log_entry.course, @log_entry.target_id) if @log_entry.kind_of?(EventDeleteLogEntry) - redirect_to course_attachment_url(@log_entry.course, @log_entry.target_id) if @log_entry.kind_of?(AttachmentDeleteLogEntry) - redirect_to course_news_instance_url(@log_entry.course, @log_entry.target_id) if @log_entry.kind_of?(NewsDeleteLogEntry) - redirect_to course_wiki_instance_url(@log_entry.course, @log_entry.target_id) if @log_entry.kind_of?(WikiDeleteLogEntry) - end - end - end + protected - protected - def find_course - unless params[:course_id].nil? - params[:course_id] = Course.find(:first, :conditions => ['short_name = ?', params[:course_id]], :order => 'period desc').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 + def find_course + if params[:course_id] + @course = Course.from_param(params[:course_id]) + end + end end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 51aa26f..3766088 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -46,7 +46,6 @@ class WikiPage < ActiveRecord::Base validates_format_of :title, with: /^[^0-9]/ validate :check_wiki_syntax - before_validation :set_canonical_title before_save :set_position diff --git a/app/views/courses/index.html.haml b/app/views/courses/index.html.haml index fdcc70d..0b8b879 100644 --- a/app/views/courses/index.html.haml +++ b/app/views/courses/index.html.haml @@ -17,8 +17,8 @@ .right = action_icon('subtract', 'Desmatricular-se', unenroll_course_url(course)) = link_to h(course.full_name), course_url(course) - - else - - @courses = Course.visible.where(period: @period) + - else + - @courses = Course.visible.where(period: @period) -# cache(courses_path) do - old_grade = 0 diff --git a/app/views/stylesheets/color.css.erb b/app/views/stylesheets/color.css.erb index ce04eea..8b85d00 100644 --- a/app/views/stylesheets/color.css.erb +++ b/app/views/stylesheets/color.css.erb @@ -34,3 +34,7 @@ h1, h2, h3, h4, h5, th { .specialDay { color: <%= color[1] %>; } + +.pagination a:hover { + border: 1px solid <%= color[1] %> !important; +} diff --git a/app/views/wiki/versions.html.haml b/app/views/wiki/versions.html.haml index 13d4fef..6efb8c1 100644 --- a/app/views/wiki/versions.html.haml +++ b/app/views/wiki/versions.html.haml @@ -18,7 +18,7 @@ %th Data %th Usuário %th Descrição - - @wiki_page.versions.reverse.each do |entry| + - @wiki_page.versions.order("version desc").each do |entry| %tr %td.narrow %input{:type => "radio", :name => "to", :value => entry.version, :onclick => "history_to(#{entry.version})"} diff --git a/config/routes.rb b/config/routes.rb index 0414935..9456bf5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -64,7 +64,9 @@ WikiUFC::Application.routes.draw do # Log with_options controller: 'log' do |log| - log.match 'courses/:course_id/log', action: 'index', format: 'html', as: 'course_log' + log.match 'courses/:course_id/log', action: 'index', + format: 'html', + as: 'course_log' log.match 'courses/:course_id/log/:id/undo', action: 'undo', format: 'html', as: 'undo_course_log' log.match 'courses/:course_id/log.:format', action: 'index', as: 'formatted_course_log' end