Needless sorting removed

This commit is contained in:
Karel Picman 2014-03-19 12:48:48 +01:00
parent cd94b958c1
commit bbbc21bf14
3 changed files with 3 additions and 16 deletions

View File

@ -106,14 +106,6 @@ class DmsfController < ApplicationController
@locked_for_user = @folder.locked_for_user?
end
@files.sort! do |a,b|
if a.last_revision && b.last_revision
a.last_revision.title <=> b.last_revision.title
else
0
end
end
@ajax_upload_size = Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'].present? ? Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'] : 100
end

View File

@ -44,11 +44,6 @@ class DmsfFile < ActiveRecord::Base
:conditions => {:target_type => DmsfFile.model_name}, :dependent => :destroy
scope :visible, lambda {|*args| where(DmsfFile.visible_condition(args.shift || User.current, *args)).readonly(false)}
scope :by_tag,
lambda { |id, value| {
:joins => 'JOIN custom_values ON dmsf_folders.id = custom_values.customized_id',
:conditions => ["custom_values.custom_field_id = ? AND custom_values.value = ?", id, value]
}}
validates :name, :presence => true
validates_format_of :name, :with => DmsfFolder.invalid_characters,

View File

@ -28,9 +28,9 @@ class DmsfFolder < ActiveRecord::Base
belongs_to :project
belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id'
has_many :subfolders, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id',
:order => "#{DmsfFolder.table_name}.title ASC", :dependent => :destroy
has_many :files, :class_name => 'DmsfFile', :foreign_key => 'dmsf_folder_id',
:dependent => :destroy
:dependent => :destroy
has_many :files, :class_name => 'DmsfFile', :foreign_key => 'dmsf_folder_id',
:dependent => :destroy
belongs_to :user
has_many :folder_links, :class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id',
:conditions => {:target_type => DmsfFolder.model_name}, :dependent => :destroy