Merge branch 'devel'

This commit is contained in:
Karel Pičman 2025-07-22 09:13:27 +02:00
commit 7e5ffd92c7
6 changed files with 26 additions and 11 deletions

View File

@ -1,6 +1,13 @@
Changelog for Redmine DMSF Changelog for Redmine DMSF
========================== ==========================
4.2.2 *2025-07-23*
------------------
Missing lock icons
* Bug: #3 - Missing lock icons by locked objects
4.2.1 *2025-07-10* 4.2.1 *2025-07-10*
------------------ ------------------

View File

@ -1,4 +1,4 @@
# Redmine DMSF Plugin 4.2.1 # Redmine DMSF Plugin 4.2.2
[![GitHub CI](https://github.com/picman/redmine_dmsf/actions/workflows/rubyonrails.yml/badge.svg?branch=master)](https://github.com/picman/redmine_dmsf/actions/workflows/rubyonrails.yml) [![GitHub CI](https://github.com/picman/redmine_dmsf/actions/workflows/rubyonrails.yml/badge.svg?branch=master)](https://github.com/picman/redmine_dmsf/actions/workflows/rubyonrails.yml)
[![Support Ukraine Badge](https://bit.ly/support-ukraine-now)](https://github.com/support-ukraine/support-ukraine) [![Support Ukraine Badge](https://bit.ly/support-ukraine-now)](https://github.com/support-ukraine/support-ukraine)

View File

@ -30,7 +30,7 @@ module DmsfQueriesHelper
case item.type case item.type
when 'file' when 'file'
file = DmsfFile.find_by(id: item.id) file = DmsfFile.find_by(id: item.id)
if !item.deleted && file&.locked? if !item.deleted? && file&.locked?
return content_tag(:span, val) + return content_tag(:span, val) +
link_to(sprite_icon('unlock', nil, icon_only: true, size: '12'), link_to(sprite_icon('unlock', nil, icon_only: true, size: '12'),
unlock_dmsf_files_path(id: file, unlock_dmsf_files_path(id: file,
@ -40,7 +40,7 @@ module DmsfQueriesHelper
end end
when 'folder' when 'folder'
folder = DmsfFolder.find_by(id: item.id) folder = DmsfFolder.find_by(id: item.id)
if !item.deleted && folder&.locked? if !item.deleted? && folder&.locked?
return content_tag(:span, val) + return content_tag(:span, val) +
link_to(sprite_icon('unlock', nil, icon_only: true, size: '12'), link_to(sprite_icon('unlock', nil, icon_only: true, size: '12'),
unlock_dmsf_path(id: folder.project, unlock_dmsf_path(id: folder.project,
@ -54,37 +54,37 @@ module DmsfQueriesHelper
when :id when :id
case item.type case item.type
when 'file' when 'file'
if item&.deleted&.positive? if item.deleted?
h(value) h(value)
else else
link_to h(value), dmsf_file_path(id: item.id) link_to h(value), dmsf_file_path(id: item.id)
end end
when 'file-link' when 'file-link'
if item&.deleted&.positive? if item.deleted?
h(item.revision_id) h(item.revision_id)
else else
link_to h(item.revision_id), dmsf_file_path(id: item.revision_id) link_to h(item.revision_id), dmsf_file_path(id: item.revision_id)
end end
when 'folder' when 'folder'
if item.id if item.id
if item&.deleted&.positive? if item.deleted?
h(value) h(value)
else else
link_to h(value), edit_dmsf_path(id: item.project_id, folder_id: item.id) link_to h(value), edit_dmsf_path(id: item.project_id, folder_id: item.id)
end end
elsif item&.deleted&.positive? elsif item.deleted?
h(item.project_id) h(item.project_id)
else else
link_to h(item.project_id), edit_root_dmsf_path(id: item.project_id) link_to h(item.project_id), edit_root_dmsf_path(id: item.project_id)
end end
when 'folder-link' when 'folder-link'
if item.id if item.id
if item&.deleted&.positive? if item.deleted?
h(item.revision_id) h(item.revision_id)
else else
link_to h(item.revision_id), edit_dmsf_path(id: item.project_id, folder_id: item.revision_id) link_to h(item.revision_id), edit_dmsf_path(id: item.project_id, folder_id: item.revision_id)
end end
elsif item&.deleted&.positive? elsif item.deleted?
h(item.project_id) h(item.project_id)
else else
link_to h(item.project_id), edit_root_dmsf_path(id: item.project_id) link_to h(item.project_id), edit_root_dmsf_path(id: item.project_id)

View File

@ -26,7 +26,7 @@ class DmsfQuery < Query
# Standard columns # Standard columns
self.available_columns = [ self.available_columns = [
QueryColumn.new(:id, sortable: 'id', caption: +'#'), QueryColumn.new(:id, sortable: 'id', caption: :label_column_id),
DmsfQueryTitleColumn.new(:title, sortable: 'title', frozen: true, caption: :label_column_title), DmsfQueryTitleColumn.new(:title, sortable: 'title', frozen: true, caption: :label_column_title),
QueryColumn.new(:size, sortable: 'size', caption: :label_column_size), QueryColumn.new(:size, sortable: 'size', caption: :label_column_size),
DmsfQueryModifiedColumn.new(:modified, sortable: 'updated', caption: :label_column_modified), DmsfQueryModifiedColumn.new(:modified, sortable: 'updated', caption: :label_column_modified),

View File

@ -27,7 +27,7 @@ Redmine::Plugin.register :redmine_dmsf do
author_url 'https://github.com/picman/redmine_dmsf/graphs/contributors' author_url 'https://github.com/picman/redmine_dmsf/graphs/contributors'
author 'Vít Jonáš / Daniel Munn / Karel Pičman' author 'Vít Jonáš / Daniel Munn / Karel Pičman'
description 'Document Management System Features' description 'Document Management System Features'
version '4.2.1' version '4.2.2'
requires_redmine version_or_higher: '6.0.0' requires_redmine version_or_higher: '6.0.0'

View File

@ -290,6 +290,14 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase
assert @response.media_type.include?('text/csv') assert @response.media_type.include?('text/csv')
end end
def test_show_locked
post '/login', params: { username: 'jsmith', password: 'jsmith' }
get "/projects/#{@project2.id}/dmsf"
assert_response :success
# An unlock icon next to a locked file
assert_select 'a.icon-unlock', count: 1
end
def test_show_folder_doesnt_correspond_the_project def test_show_folder_doesnt_correspond_the_project
post '/login', params: { username: 'jsmith', password: 'jsmith' } post '/login', params: { username: 'jsmith', password: 'jsmith' }
assert @project1 != @folder3.project assert @project1 != @folder3.project