|
|
|
@ -29,7 +29,13 @@ class DocumentsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
|
|
|
|
|
documents = @project.documents.includes(:attachments, :category).all
|
|
|
|
|
temp = @project.documents.includes(:attachments, :category).all
|
|
|
|
|
documents = []
|
|
|
|
|
temp.each do |doc|
|
|
|
|
|
if doc.has_right?(@project)
|
|
|
|
|
documents << doc
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
case @sort_by
|
|
|
|
|
when 'date'
|
|
|
|
|
@grouped = documents.group_by {|d| d.updated_on.to_date }
|
|
|
|
|