diff --git a/app/views/dmsf/_query_rows.erb b/app/views/dmsf/_query_rows.erb index 8398ce98..f1ce70b9 100644 --- a/app/views/dmsf/_query_rows.erb +++ b/app/views/dmsf/_query_rows.erb @@ -27,8 +27,9 @@ <% end %> <% query.dmsf_nodes(options).each do |node| %> <% system = node.title =~ /^\./ %> + <% id = (node.type == 'folder') ? "#{node.id}span" : "#{node.id}item" %> <% @idnt ||= 0 %> - "> + "> <%= check_box_tag('ids[]', "#{node.type}-#{node.id}", false, id: nil) unless system %> diff --git a/assets/javascripts/redmine_dmsf.js b/assets/javascripts/redmine_dmsf.js index 062f3961..a0839d33 100644 --- a/assets/javascripts/redmine_dmsf.js +++ b/assets/javascripts/redmine_dmsf.js @@ -129,9 +129,14 @@ function dmsfExpandRows(id, parentRow, url) { } }).done(function(data) { // Hide the expanding icon if there are no children - if(data.indexOf(' ' + m[1] + ' ') < 0){ + if( m && (data.indexOf(' ' + m[1] + ' ') < 0)) { + $(parentRow).removeClass('dmsf-expanded'); - $(parentRow).addClass('dmsf-child'); + + if(!$(parentRow).hasClass('dmsf-child')) { + + $(parentRow).addClass('dmsf-child'); + } } else { // Add child rows