This commit is contained in:
Karel.Picman 2022-02-11 10:54:19 +01:00
parent e680bb8aa0
commit 7246c089be
2 changed files with 18 additions and 4 deletions

View File

@ -122,7 +122,11 @@ module DmsfQueriesHelper
tag = "<span class=\"dmsf-expander\" onclick=\"dmsfToggle(this, '#{item.id}', null,'#{escape_javascript(path)}')\"></span>".html_safe + tag
tag = content_tag('div', tag, class: 'row-control dmsf-row-control')
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
tag += content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
if item.watched_by?(User.current)
tag += content_tag(:span, '', title: 'Watched', class: "icon icon-fav")
end
tag
when 'folder'
if item&.deleted?
tag = content_tag('span', value, class: 'icon icon-folder')
@ -139,7 +143,12 @@ module DmsfQueriesHelper
tag = content_tag('div', tag, class: 'row-control dmsf-row-control')
end
end
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
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('', watch_path(object_type: 'dmsf_folder', object_id: item.id), title: l(:button_unwatch),
method: 'delete', class: 'icon icon-fav')
end
tag
when 'folder-link'
if item&.deleted?
tag = content_tag('span', value, class: 'icon icon-folder')
@ -169,7 +178,12 @@ module DmsfQueriesHelper
member = Member.find_by(user_id: User.current.id, project_id: item.project_id)
revision = DmsfFileRevision.find_by(id: item.customized_id)
filename = revision ? revision.formatted_name(member) : item.filename
tag + content_tag('div', filename, class: 'dmsf-filename', title: l(:title_filename_for_download))
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('', watch_path(object_type: 'dmsf_file', object_id: item.id), title: l(:button_unwatch),
method: 'delete', class: 'icon icon-fav')
end
tag
when 'url-link'
if item&.deleted?
tag = content_tag('span', value, class: 'icon dmsf-icon-link')

View File

@ -22,7 +22,7 @@
# Watch/unwatch menu's item
%>
<% watched = Watcher.any_watched?([object], User.current) %>
<% watched = object.watched_by?(User.current) %>
<% css = [watcher_css([object]), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') %>
<% text = watched ? l(:button_unwatch) : l(:button_watch) %>
<% url = watch_path(object_type: object.class.to_s.underscore, object_id: object.id) %>