diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb
index 5df30041..509aba33 100644
--- a/app/controllers/dmsf_controller.rb
+++ b/app/controllers/dmsf_controller.rb
@@ -57,12 +57,14 @@ class DmsfController < ApplicationController
end
@query.dmsf_folder_id = @folder&.id
@query.deleted = false
+ @query.sub_projects = true
respond_to do |format|
format.js { render action: 'query_rows' }
end
end
def index
+ @query.sub_projects = true
show
end
@@ -74,6 +76,7 @@ class DmsfController < ApplicationController
@trash_enabled = @folder_manipulation_allowed && @file_manipulation_allowed
@query.dmsf_folder_id = @folder ? @folder.id : nil
@query.deleted = false
+ @query.sub_projects |= (Setting.plugin_redmine_dmsf['dmsf_projects_as_subfolders'] == '1')
if (@folder && @folder.deleted?) || (params[:folder_title].present? && !@folder)
render_404
return
diff --git a/app/helpers/dmsf_queries_helper.rb b/app/helpers/dmsf_queries_helper.rb
index 08faa0d3..54602ef9 100644
--- a/app/helpers/dmsf_queries_helper.rb
+++ b/app/helpers/dmsf_queries_helper.rb
@@ -86,9 +86,14 @@ module DmsfQueriesHelper
when :title
case item.type
when 'project'
- tag = link_to(h("[#{value}]"), dmsf_folder_path(id: item.project), class: 'icon icon-folder')
+ tag = h("[#{value}]")
+ if item.project.module_enabled?(:dmsf)
+ tag = link_to(tag, dmsf_folder_path(id: item.project), class: 'icon icon-folder')
+ else
+ tag = content_tag('span', tag, class: 'icon icon-folder')
+ end
unless filter_any?
- tag = "".html_safe + tag
+ tag = "".html_safe + tag
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
when 'folder'
@@ -97,7 +102,7 @@ module DmsfQueriesHelper
else
tag = link_to(h(value), dmsf_folder_path(id: item.project, folder_id: item.id), class: 'icon icon-folder')
unless filter_any?
- tag = "".html_safe + tag
+ tag = "".html_safe + tag
end
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
@@ -108,7 +113,7 @@ module DmsfQueriesHelper
# For links we use revision_id containing dmsf_folder.id in fact
tag = link_to(h(value), dmsf_folder_path(id: item.project, folder_id: item.revision_id), class: 'icon icon-folder')
unless filter_any?
- tag = "".html_safe + tag
+ tag = "".html_safe + tag
end
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:label_target_folder))
@@ -124,7 +129,7 @@ module DmsfQueriesHelper
class: "icon icon-file #{DmsfHelper.filetype_css(item.filename)}",
'data-downloadurl': "#{content_type}:#{h(value)}:#{file_view_url}")
unless filter_any?
- tag = "".html_safe + tag
+ tag = "".html_safe + tag
end
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
@@ -134,7 +139,7 @@ module DmsfQueriesHelper
else
tag = link_to(h(value), item.filename, target: '_blank', class: 'icon icon-link')
unless filter_any?
- tag = "".html_safe + tag
+ tag = "".html_safe + tag
end
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:field_url))
diff --git a/app/models/dmsf_query.rb b/app/models/dmsf_query.rb
index 52a9fc23..336c27bc 100644
--- a/app/models/dmsf_query.rb
+++ b/app/models/dmsf_query.rb
@@ -22,7 +22,7 @@
class DmsfQuery < Query
- attr_accessor :dmsf_folder_id, :deleted
+ attr_accessor :dmsf_folder_id, :deleted, :sub_projects
self.queried_class = DmsfFolder
self.view_permission = :view_dmsf_files
@@ -190,7 +190,7 @@ class DmsfQuery < Query
private
def dmsf_projects_scope
- return nil if(project && !Setting.plugin_redmine_dmsf['dmsf_projects_as_subfolders'])
+ return nil unless sub_projects
cf_columns = +''
if statement.present?
DmsfFileRevisionCustomField.visible.order(:position).pluck(:id).each do |id|
diff --git a/assets/stylesheets/redmine_dmsf.css b/assets/stylesheets/redmine_dmsf.css
index 3a1f3a0f..7058bb39 100644
--- a/assets/stylesheets/redmine_dmsf.css
+++ b/assets/stylesheets/redmine_dmsf.css
@@ -201,7 +201,6 @@ div[id*="revision_access_"] {
.dmsf-gray a, .dmsf-gray a:link, .dmsf-gray a:visited {
color: #484848;
- text-decoration: none;
}
/* System folders */
@@ -209,23 +208,18 @@ div[id*="revision_access_"] {
color: #5C82AD
}
-.dmsf-system a, .dmsf-gray a:link, .dmsf-gray a:visited {
- color: #484848;
- text-decoration: none;
-}
-
/* Search results */
.icon-dmsf-file { background-image: url(../../../images/document.png); }
/* DMSF tree view */
.dmsf-hidden { display:none; }
-.dmsf-tree:not(.dmsf-child) span.dmsf_expander { cursor: pointer; }
-.dmsf-tree.dmsf-expanded td.dmsf-title span {
+.dmsf-tree:not(.dmsf-child) span.dmsf-expander { cursor: pointer; }
+.dmsf-tree.dmsf-expanded span.dmsf-expander {
background: url(../../../images/arrow_down.png) no-repeat 0 50%;
padding-left: 16px;
}
-.dmsf-tree.dmsf-child .dmsf-title span { padding-left: 16px; }
-.dmsf-tree.dmsf-collapsed .dmsf-title span {
+.dmsf-tree.dmsf-child span.dmsf-expander { padding-left: 16px; }
+.dmsf-tree.dmsf-collapsed span.dmsf-expander {
background: url(../../../images/arrow_right.png) no-repeat 0 50%;
padding-left: 16px;
}
diff --git a/test/functional/dmsf_controller_test.rb b/test/functional/dmsf_controller_test.rb
index 63811714..6b259064 100644
--- a/test/functional/dmsf_controller_test.rb
+++ b/test/functional/dmsf_controller_test.rb
@@ -206,7 +206,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase
assert_select 'a.csv'
# 'Zero Size File' document and an expander is present
assert_select 'a', text: @file10.title
- assert_select 'span.dmsf_expander'
+ assert_select 'span.dmsf-expander'
end
def test_show_filters_found
@@ -215,7 +215,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase
# 'Zero Size File' document
assert_select 'a', text: @file10.title
# No expander if a filter is set
- assert_select 'span.dmsf_expander', count: 0
+ assert_select 'span.dmsf-expander', count: 0
end
def test_show_filters_not_found