Missing lock icon by locked objects #5
This commit is contained in:
parent
602775382f
commit
6df0f3740a
@ -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)
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user