Paginas wiki, arquivos e disciplinas ocultas

This commit is contained in:
2009-09-08 18:38:47 -03:00
parent 0d00ee07db
commit a10b4fda9b
22 changed files with 144 additions and 35 deletions

View File

@@ -35,6 +35,7 @@ class AttachmentsController < ApplicationController
def create
@attachment.course_id = @course.id
@attachment.path = params[:attachment][:path]
@attachment.front_page = params[:attachment][:front_page]
@attachment.description = params[:attachment][:description]
@attachment.file_name = "blank"
unless params[:attachment][:file].nil?
@@ -58,6 +59,7 @@ class AttachmentsController < ApplicationController
def update
@attachment.path = params[:attachment][:path]
@attachment.front_page = params[:attachment][:front_page]
@attachment.description = params[:attachment][:description]
unless params[:attachment][:file].nil?
@attachment.file = params[:attachment][:file]
@@ -93,10 +95,11 @@ class AttachmentsController < ApplicationController
end
def download
send_file("#{RAILS_ROOT}/public/upload/#{@course.id}/#{@attachment.id}",
:filename => @attachment.file_name,
:type => @attachment.content_type,
:disposition => 'attachment',
:disposition => 'inline',
:streaming => 'true')
end

View File

@@ -26,9 +26,9 @@ class CoursesController < ApplicationController
@period = params[:period] || App.current_period
if logged_in? and !@current_user.courses.empty?
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and id not in (?)', @period, @current_user.courses])
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and hidden = ? and id not in (?)', @period, false, @current_user.courses])
else
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ?', @period])
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and hidden = ?', @period, false])
end
respond_to do |format|

View File

@@ -22,7 +22,9 @@ class LogController < ApplicationController
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, :order => "created_at desc")
@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|

View File

@@ -29,7 +29,7 @@ class WikiController < ApplicationController
def index
respond_to do |format|
format.html { redirect_to course_url(@course) }
format.html
format.xml { render :xml => @wiki_pages }
end
end