Missing default browser context menu #1574
This commit is contained in:
parent
00a8817472
commit
77de4519f0
@ -32,18 +32,16 @@ module DmsfQueriesHelper
|
||||
when 'file'
|
||||
file = DmsfFile.find_by(id: item.id)
|
||||
if file&.locked?
|
||||
return content_tag(:span, val) + content_tag('span',
|
||||
sprite_icon('unlock', ''),
|
||||
title: l(:title_locked_by_user, user: file.locked_by),
|
||||
class: 'icon icon-unlock dmsf-icon-unlock')
|
||||
return content_tag(:span, val) +
|
||||
content_tag('span', sprite_icon('unlock', nil, icon_only: true, size: '12'),
|
||||
title: l(:title_locked_by_user, user: file.locked_by))
|
||||
end
|
||||
when 'folder'
|
||||
folder = DmsfFolder.find_by(id: item.id)
|
||||
if folder&.locked?
|
||||
return content_tag(:span, val) + content_tag('span',
|
||||
sprite_icon('unlock', ''),
|
||||
title: l(:title_locked_by_user, user: folder.locked_by),
|
||||
class: 'icon icon-unlock dmsf-icon-unlock')
|
||||
return content_tag(:span, val) +
|
||||
content_tag('span', sprite_icon('unlock', nil, icon_only: true, size: '12'),
|
||||
title: l(:title_locked_by_user, user: folder.locked_by))
|
||||
end
|
||||
end
|
||||
content_tag(:span, val) + content_tag(:span, '', class: 'icon icon-none')
|
||||
@ -127,19 +125,19 @@ module DmsfQueriesHelper
|
||||
end
|
||||
tag += content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
|
||||
if item.project.watched_by?(User.current)
|
||||
tag += link_to(sprite_icon('unlock', ''),
|
||||
tag += link_to(sprite_icon('fav', nil, icon_only: true, size: '12'),
|
||||
watch_path(object_type: 'project', object_id: item.project.id),
|
||||
title: l(:button_unwatch),
|
||||
method: 'delete',
|
||||
class: 'icon icon-fav')
|
||||
method: 'delete')
|
||||
end
|
||||
tag
|
||||
when 'folder'
|
||||
if item&.deleted?
|
||||
tag = sprite_icon('folder', h(value))
|
||||
else
|
||||
tag = link_to(sprite_icon('folder', h(value)),
|
||||
tag = link_to(sprite_icon('folder', nil, icon_only: true),
|
||||
dmsf_folder_path(id: item.project, folder_id: item.id))
|
||||
tag += link_to(h(value), dmsf_folder_path(id: item.project, folder_id: item.id), class: 'dmsf-label')
|
||||
unless filter_any?
|
||||
path = expand_folder_dmsf_path
|
||||
columns = params['c']
|
||||
@ -158,11 +156,10 @@ module DmsfQueriesHelper
|
||||
end
|
||||
tag += content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
|
||||
if !item&.deleted? && item.watched_by?(User.current)
|
||||
tag += link_to(sprite_icon('fav', ''),
|
||||
tag += link_to(sprite_icon('fav', nil, icon_only: true, size: '12'),
|
||||
watch_path(object_type: 'dmsf_folder', object_id: item.id),
|
||||
title: l(:button_unwatch),
|
||||
method: 'delete',
|
||||
class: 'icon icon-fav')
|
||||
method: 'delete')
|
||||
end
|
||||
tag
|
||||
when 'folder-link'
|
||||
@ -170,15 +167,16 @@ module DmsfQueriesHelper
|
||||
tag = sprite_icon('folder', h(value))
|
||||
else
|
||||
# For links, we use revision_id containing dmsf_folder.id in fact
|
||||
tag = link_to(sprite_icon('folder', h(value)), dmsf_folder_path(id: item.project,
|
||||
folder_id: item.revision_id))
|
||||
tag = link_to(sprite_icon('folder', nil, icon_only: true),
|
||||
dmsf_folder_path(id: item.project, folder_id: item.revision_id))
|
||||
tag += link_to(h(value), dmsf_folder_path(id: item.project, folder_id: item.revision_id), class: 'dmsf-label')
|
||||
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
||||
end
|
||||
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:label_target_folder))
|
||||
when 'file', 'file-link'
|
||||
icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(item.filename))
|
||||
if item&.deleted?
|
||||
tag = sprite_icon(icon_name, h(value), css_class: 'icon icon-file')
|
||||
tag = sprite_icon(icon_name, h(value))
|
||||
else
|
||||
# For links, we use revision_id containing dmsf_file.id in fact
|
||||
file_view_url = url_for(
|
||||
@ -186,13 +184,13 @@ module DmsfQueriesHelper
|
||||
)
|
||||
content_type = Redmine::MimeType.of(item.filename)
|
||||
content_type = 'application/octet-stream' if content_type.blank?
|
||||
options = { class: 'icon icon-file', 'data-downloadurl': "#{content_type}:#{h(value)}:#{file_view_url}" }
|
||||
options = { class: 'dmsf-label', 'data-downloadurl': "#{content_type}:#{h(value)}:#{file_view_url}" }
|
||||
unless previewable?(item.filename, content_type)
|
||||
options[:target] = '_blank'
|
||||
options[:rel] = 'noopener'
|
||||
end
|
||||
tag = link_to(sprite_icon(icon_name, h(value)), file_view_url, options)
|
||||
|
||||
tag = link_to(sprite_icon(icon_name, nil, icon_only: true), file_view_url, options)
|
||||
tag += link_to(h(value), file_view_url, options)
|
||||
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
||||
end
|
||||
member = Member.find_by(user_id: User.current.id, project_id: item.project_id)
|
||||
@ -200,22 +198,21 @@ module DmsfQueriesHelper
|
||||
filename = revision ? revision.formatted_name(member) : item.filename
|
||||
tag += content_tag('div', filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
|
||||
if (item.type == 'file') && !item&.deleted? && revision.dmsf_file&.watched_by?(User.current)
|
||||
tag += link_to(sprite_icon('fav', ''),
|
||||
tag += link_to(sprite_icon('fav', nil, icon_only: true, size: '12'),
|
||||
watch_path(object_type: 'dmsf_file', object_id: item.id),
|
||||
title: l(:button_unwatch),
|
||||
method: 'delete',
|
||||
class: 'icon icon-fav')
|
||||
method: 'delete')
|
||||
end
|
||||
tag
|
||||
when 'url-link'
|
||||
if item&.deleted?
|
||||
tag = sprite_icon('link', h(value))
|
||||
else
|
||||
tag = link_to(sprite_icon('link', h(value)),
|
||||
tag = link_to(sprite_icon('link', nil, icon_only: true),
|
||||
item.filename,
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
class: 'icon dmsf-icon-link')
|
||||
rel: 'noopener')
|
||||
tag += link_to(h(value), item.filename, target: '_blank', rel: 'noopener', class: 'dmsf-link')
|
||||
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
||||
end
|
||||
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:field_url))
|
||||
|
||||
@ -28,6 +28,10 @@
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
a.dmsf-label {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
/* Query form */
|
||||
.query-columns > span { /* EasyExtension */
|
||||
display: inline-block;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user