#183 Full path to the target file by file links in the main view
This commit is contained in:
parent
820a4920b9
commit
7817ee5f19
@ -172,10 +172,6 @@ class DmsfFile < ActiveRecord::Base
|
||||
self.save!
|
||||
end
|
||||
|
||||
def display_name
|
||||
return self.name
|
||||
end
|
||||
|
||||
# Returns an array of projects that current user can copy file to
|
||||
def self.allowed_target_projects_on_copy
|
||||
projects = []
|
||||
|
||||
@ -70,4 +70,9 @@ class DmsfLink < ActiveRecord::Base
|
||||
nil
|
||||
end
|
||||
|
||||
def path
|
||||
file = self.target_file
|
||||
file.dmsf_path.map { |element| element.is_a?(DmsfFile) ? element.name : element.title }.join('/') if file
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}",
|
||||
:title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version),
|
||||
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_download_url}") %>
|
||||
<div class="filename" title="<%= l(:title_filename_for_download)%>"><%= h(file.display_name) %></div>
|
||||
<div class="filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.name) %></div>
|
||||
</td>
|
||||
<td class="size"><%= number_to_human_size(file.last_revision.size) %></td>
|
||||
<td class="modified">
|
||||
|
||||
@ -137,6 +137,11 @@ class DmsfLinksTest < RedmineDmsf::Test::UnitTest
|
||||
DmsfLink.find_link_by_file_name(@file_link.project, @file_link.folder, @file_link.target_file.name)
|
||||
end
|
||||
|
||||
def test_path
|
||||
assert_equal @file_link.path,
|
||||
@file_link.target_file.dmsf_path_str
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
@folder_link.destroy
|
||||
assert_nil DmsfLink.find_by_id 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user