访问资源库问题

This commit is contained in:
z9hang 2014-08-05 11:10:41 +08:00
parent 426ea23d6e
commit 2c77d1b4cf
4 changed files with 20 additions and 3 deletions

View File

@ -40,7 +40,19 @@ class FilesController < ApplicationController
render :layout => !request.xhr?
elsif params[:course_id]
@isproject = false
if params[:sort]
@oder = params[:sort].split(",")[0]
@order_by = @oder.split(":")[0]
@order_tyoe = @oder.split(":")[1]
if @order_by == "size"
@order_by = "filesize"
end
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@order_by} #{@order_tyoe}").find(@course.id)]
else
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
end
render :layout => 'base_courses'
end
end

View File

@ -2,7 +2,12 @@
class ProjectScoreHelper
#缺陷数量
def issue_num project
project.issues.count
end
#缺陷留言数量
def issue_journal_num project
project
end
end

View File

@ -193,7 +193,7 @@ class Attachment < ActiveRecord::Base
def show_suffix_type
suffix = 'other'
temp = self.suffix_type.downcase
if self.attachmentstype.suffixArr.include?(temp)
if self.attachmentstype && self.attachmentstype.suffixArr.include?(temp)
suffix = temp
end
suffix

View File

@ -43,7 +43,7 @@
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type">
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName unless file.attachmentstype.nil? %></span>
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %>
</span>