#1563 file icons
@ -53,19 +53,6 @@ module DmsfHelper
|
||||
just_filename
|
||||
end
|
||||
|
||||
def self.filetype_css(filename)
|
||||
extension = File.extname(filename)
|
||||
extension = extension[1, extension.length - 1]
|
||||
path = File.join(Redmine::Plugin.public_directory, ['redmine_dmsf', 'images', 'filetypes', "#{extension}.png"])
|
||||
cls = if File.exist?(path)
|
||||
"filetype-#{extension}"
|
||||
else
|
||||
Redmine::MimeType.css_class_of filename
|
||||
end
|
||||
cls << ' dmsf-icon-file' if cls
|
||||
cls
|
||||
end
|
||||
|
||||
def plugin_asset_path(plugin, asset_type, source)
|
||||
File.join('/plugin_assets', plugin.to_s, asset_type, source)
|
||||
end
|
||||
|
||||
@ -32,24 +32,21 @@ module DmsfQueriesHelper
|
||||
when 'file'
|
||||
file = DmsfFile.find_by(id: item.id)
|
||||
if file&.locked?
|
||||
return content_tag(:span, val) +
|
||||
content_tag(:span,
|
||||
'',
|
||||
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')
|
||||
end
|
||||
when 'folder'
|
||||
folder = DmsfFolder.find_by(id: item.id)
|
||||
if folder&.locked?
|
||||
return content_tag(:span, val) +
|
||||
content_tag(:span,
|
||||
'',
|
||||
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')
|
||||
end
|
||||
end
|
||||
content_tag(:span, val) +
|
||||
content_tag(:span, '', class: 'icon icon-none')
|
||||
content_tag(:span, val) + content_tag(:span, '', class: 'icon icon-none')
|
||||
when :id
|
||||
case item.type
|
||||
when 'file'
|
||||
@ -109,9 +106,9 @@ module DmsfQueriesHelper
|
||||
when 'project'
|
||||
tag = h("[#{value}]")
|
||||
tag = if item.project.module_enabled?(:dmsf)
|
||||
link_to tag, dmsf_folder_path(id: item.project), class: 'icon icon-folder'
|
||||
link_to sprite_icon('folder', tag), dmsf_folder_path(id: item.project)
|
||||
else
|
||||
content_tag 'span', tag, class: 'icon icon-folder'
|
||||
sprite_icon 'folder', tag
|
||||
end
|
||||
unless filter_any?
|
||||
path = expand_folder_dmsf_path
|
||||
@ -130,7 +127,7 @@ 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('',
|
||||
tag += link_to(sprite_icon('unlock', ''),
|
||||
watch_path(object_type: 'project', object_id: item.project.id),
|
||||
title: l(:button_unwatch),
|
||||
method: 'delete',
|
||||
@ -139,9 +136,10 @@ module DmsfQueriesHelper
|
||||
tag
|
||||
when 'folder'
|
||||
if item&.deleted?
|
||||
tag = content_tag('span', value, class: 'icon icon-folder')
|
||||
tag = sprite_icon('folder', h(value))
|
||||
else
|
||||
tag = link_to(h(value), dmsf_folder_path(id: item.project, folder_id: item.id), class: 'icon icon-folder')
|
||||
tag = link_to(sprite_icon('folder', h(value)),
|
||||
dmsf_folder_path(id: item.project, folder_id: item.id))
|
||||
unless filter_any?
|
||||
path = expand_folder_dmsf_path
|
||||
columns = params['c']
|
||||
@ -160,7 +158,7 @@ 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('',
|
||||
tag += link_to(sprite_icon('fav', ''),
|
||||
watch_path(object_type: 'dmsf_folder', object_id: item.id),
|
||||
title: l(:button_unwatch),
|
||||
method: 'delete',
|
||||
@ -169,32 +167,32 @@ module DmsfQueriesHelper
|
||||
tag
|
||||
when 'folder-link'
|
||||
if item&.deleted?
|
||||
tag = content_tag('span', value, class: 'icon icon-folder')
|
||||
tag = sprite_icon('folder', h(value))
|
||||
else
|
||||
# For links we use revision_id containing dmsf_folder.id in fact
|
||||
tag = link_to(h(value),
|
||||
dmsf_folder_path(id: item.project, folder_id: item.revision_id),
|
||||
class: 'icon icon-folder')
|
||||
# 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 = 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 = content_tag('span', value, class: "icon icon-file #{DmsfHelper.filetype_css(item.filename)}")
|
||||
tag = sprite_icon(icon_name, h(value), css_class: 'icon icon-file')
|
||||
else
|
||||
# For links we use revision_id containing dmsf_file.id in fact
|
||||
# For links, we use revision_id containing dmsf_file.id in fact
|
||||
file_view_url = url_for(
|
||||
{ controller: :dmsf_files, action: 'view', id: item.type == 'file' ? item.id : item.revision_id }
|
||||
)
|
||||
content_type = Redmine::MimeType.of(item.filename)
|
||||
content_type = 'application/octet-stream' if content_type.blank?
|
||||
options = { class: "icon icon-file #{DmsfHelper.filetype_css(item.filename)}",
|
||||
'data-downloadurl': "#{content_type}:#{h(value)}:#{file_view_url}" }
|
||||
options = { class: 'icon icon-file', '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 h(value), file_view_url, options
|
||||
tag = link_to(sprite_icon(icon_name, 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)
|
||||
@ -202,7 +200,7 @@ 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('',
|
||||
tag += link_to(sprite_icon('fav', ''),
|
||||
watch_path(object_type: 'dmsf_file', object_id: item.id),
|
||||
title: l(:button_unwatch),
|
||||
method: 'delete',
|
||||
@ -211,9 +209,13 @@ module DmsfQueriesHelper
|
||||
tag
|
||||
when 'url-link'
|
||||
if item&.deleted?
|
||||
tag = content_tag('span', value, class: 'icon dmsf-icon-link')
|
||||
tag = sprite_icon('link', h(value))
|
||||
else
|
||||
tag = link_to(h(value), item.filename, target: '_blank', rel: 'noopener', class: 'icon dmsf-icon-link')
|
||||
tag = link_to(sprite_icon('link', h(value)),
|
||||
item.filename,
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
class: 'icon dmsf-icon-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))
|
||||
|
||||
@ -92,8 +92,8 @@
|
||||
<% end %>
|
||||
<% url << dmsf_file.name %>
|
||||
<% end %>
|
||||
<%= context_menu_link sprite_icon('edit', l(:button_edit_content)), url,
|
||||
class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
|
||||
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(dmsf_file.name)) %>
|
||||
<%= context_menu_link sprite_icon(icon_name, l(:button_edit_content)), url, class: 'icon icon-file',
|
||||
disabled: url.blank? || (locked && !unlockable) ||
|
||||
(Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
|
||||
</li>
|
||||
|
||||
@ -22,11 +22,12 @@
|
||||
|
||||
<td class="<%= cls %>">
|
||||
<% file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file }) %>
|
||||
<%= link_to h(link ? link.name : dmsf_file.title),
|
||||
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(dmsf_file.name)) %>
|
||||
<%= link_to sprite_icon(icon_name, h(link ? link.name : dmsf_file.title)),
|
||||
file_view_url,
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
|
||||
class: 'icon icon-file',
|
||||
title: h(dmsf_file.last_revision.try(:tooltip)),
|
||||
'data-downloadurl' => "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}" %>
|
||||
</td>
|
||||
@ -47,38 +48,37 @@
|
||||
<span class="dmsf_upload_select">
|
||||
<% # Details %>
|
||||
<% if User.current.allowed_to? :file_manipulation, dmsf_file.project %>
|
||||
<%= link_to '', dmsf_file_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
<%= link_to sprite_icon('edit', ''), dmsf_file_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: l(:link_details, title: h(dmsf_file.last_revision.title)),
|
||||
class: 'icon-only icon-edit' %>
|
||||
<% else %>
|
||||
<span class="icon-only"></span>
|
||||
<% end %>
|
||||
<% # Email %>
|
||||
<%= link_to '', entries_operations_dmsf_path(id: dmsf_file.project_id, email_entries: 'email',
|
||||
ids: ["file-#{dmsf_file.id}"], back_url: issue_path(@issue)), method: :post, title: l(:heading_send_documents_by_email),
|
||||
class: 'icon-only icon-email-disabled' %>
|
||||
<%= link_to sprite_icon('email', ''), entries_operations_dmsf_path(id: dmsf_file.project_id, email_entries: 'email',
|
||||
ids: ["file-#{dmsf_file.id}"],
|
||||
back_url: issue_path(@issue)),
|
||||
method: :post, title: l(:heading_send_documents_by_email), class: 'icon-only icon-email-disabled' %>
|
||||
<% # Lock %>
|
||||
<% if !dmsf_file.locked? %>
|
||||
<%= link_to '', lock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: l(:title_lock_file),
|
||||
class: 'icon-only icon-lock' %>
|
||||
<%= link_to sprite_icon('lock', ''), lock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: l(:title_lock_file), class: 'icon-only icon-lock' %>
|
||||
<% elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, dmsf_file.project)) %>
|
||||
<%= link_to '', unlock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: dmsf_file.locked_title,
|
||||
class: 'icon-only icon-unlock' %>
|
||||
<%= link_to sprite_icon('unlock', ''), unlock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: dmsf_file.locked_title, class: 'icon-only icon-unlock' %>
|
||||
<% else %>
|
||||
<span class="icon-only icon-unlock" title="<%= dmsf_file.locked_title %>"></span>
|
||||
<%= content_tag('span', sprite_icon('unlock', ''), title: dmsf_file.locked_title) %>
|
||||
<% end %>
|
||||
<% if !dmsf_file.locked? %>
|
||||
<% # Notifications %>
|
||||
<% if dmsf_file.notification %>
|
||||
<%= link_to '', notify_deactivate_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: l(:title_notifications_active_deactivate),
|
||||
class: 'icon-only icon-email' %>
|
||||
<%= link_to sprite_icon('email', ''), notify_deactivate_dmsf_files_path(id: dmsf_file,
|
||||
back_url: issue_path(@issue)),
|
||||
title: l(:title_notifications_active_deactivate), class: 'icon-only icon-email' %>
|
||||
<% else %>
|
||||
<%= link_to '', notify_activate_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||
title: l(:title_notifications_not_active_activate),
|
||||
class: 'icon-only icon-email-add' %>
|
||||
<%= link_to sprite_icon('email-disabled', ''), notify_activate_dmsf_files_path(id: dmsf_file,
|
||||
back_url: issue_path(@issue)),
|
||||
title: l(:title_notifications_not_active_activate), class: 'icon-only icon-email-add' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="icon-only"></span>
|
||||
@ -88,12 +88,12 @@
|
||||
<% if @issue.attributes_editable? &&
|
||||
((link && User.current.allowed_to?(:file_manipulation, dmsf_file.project)) ||
|
||||
(!link && User.current.allowed_to?(:file_delete, dmsf_file.project))) %>
|
||||
<%= link_to '',
|
||||
link ? dmsf_link_path(link, commit: 'yes', back_url: issue_path(@issue)) : dmsf_file_path(id: dmsf_file, commit: 'yes', back_url: issue_path(@issue)),
|
||||
data: { confirm: l(:text_are_you_sure) },
|
||||
method: :delete,
|
||||
title: l(:button_delete),
|
||||
class: 'icon-only icon-del' %>
|
||||
<% url = if link
|
||||
dmsf_link_path(link, commit: 'yes', back_url: issue_path(@issue))
|
||||
else
|
||||
dmsf_file_path(id: dmsf_file, commit: 'yes', back_url: issue_path(@issue))
|
||||
end %>
|
||||
<%= delete_link url %>
|
||||
<% end %>
|
||||
<% # Approval workflow %>
|
||||
<% wf = DmsfWorkflow.find_by(id: dmsf_file.last_revision.dmsf_workflow_id) if dmsf_file.last_revision.dmsf_workflow_id %>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<% assignments = wf.next_assignments(file.last_revision.id) %>
|
||||
<% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %>
|
||||
<% if assignments && index %>
|
||||
<%= link_to '',
|
||||
<%= link_to sprite_icon('checked', ''),
|
||||
action_dmsf_workflow_path(project_id: project.id, id: wf.id,
|
||||
dmsf_workflow_step_assignment_id: assignments[index].id,
|
||||
dmsf_file_revision_id: file.last_revision.id,
|
||||
@ -42,7 +42,7 @@
|
||||
<% end %>
|
||||
<% when DmsfWorkflow::STATE_ASSIGNED %>
|
||||
<% if User.current && (file.last_revision.dmsf_workflow_assigned_by_user == User.current) && wf %>
|
||||
<%= link_to '',
|
||||
<%= link_to sprite_icon('checked', ''),
|
||||
start_dmsf_workflow_path(id: file.last_revision.dmsf_workflow_id,
|
||||
dmsf_file_revision_id: file.last_revision.id,
|
||||
back_url: back_url),
|
||||
@ -55,7 +55,7 @@
|
||||
<span class="icon-only"></span>
|
||||
<% else %>
|
||||
<% if workflows_available %>
|
||||
<%= link_to '',
|
||||
<%= link_to sprite_icon('checked', ''),
|
||||
dmsf_link_id ?
|
||||
assign_dmsf_workflow_path(id: project.id, project_id: project.id, dmsf_link_id: dmsf_link_id,
|
||||
back_url: back_url) :
|
||||
|
||||
@ -95,8 +95,8 @@
|
||||
<%= link_to_project file.project %>
|
||||
</td>
|
||||
<td class="title">
|
||||
<%= link_to h(file.title), dmsf_file_path(id: file),
|
||||
class: "icon icon-file #{DmsfHelper.filetype_css(file.name)}" %>
|
||||
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(file.name)) %>
|
||||
<%= link_to sprite_icon(icon_name, h(file.title)), dmsf_file_path(id: file), class: 'icon icon-file' %>
|
||||
</td>
|
||||
<td class="title">
|
||||
<% if file.dmsf_folder %>
|
||||
|
||||
@ -108,8 +108,8 @@
|
||||
<%= link_to_project(file.project) if file.project %>
|
||||
</td>
|
||||
<td class="title">
|
||||
<%= link_to h(file.title), dmsf_file_path(id: file),
|
||||
class: "icon icon-file #{DmsfHelper.filetype_css(file.name)}" %>
|
||||
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(file.name)) %>
|
||||
<%= link_to sprite_icon(icon_name, h(file.title)), dmsf_file_path(id: file), class: 'icon icon-file' %>
|
||||
</td>
|
||||
<td class="title">
|
||||
<% if file.dmsf_folder %>
|
||||
|
||||
|
Before Width: | Height: | Size: 437 B |
|
Before Width: | Height: | Size: 471 B |
|
Before Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 671 B |
|
Before Width: | Height: | Size: 401 B |
|
Before Width: | Height: | Size: 671 B |
|
Before Width: | Height: | Size: 473 B |
|
Before Width: | Height: | Size: 416 B |
|
Before Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 434 B |
|
Before Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 566 B |
|
Before Width: | Height: | Size: 385 B |
|
Before Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 427 B |
|
Before Width: | Height: | Size: 348 B |
|
Before Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 431 B |
|
Before Width: | Height: | Size: 775 B |
|
Before Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 775 B |
|
Before Width: | Height: | Size: 446 B |
|
Before Width: | Height: | Size: 698 B |
|
Before Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 698 B |
|
Before Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 469 B |
|
Before Width: | Height: | Size: 312 B |
|
Before Width: | Height: | Size: 412 B |
@ -84,12 +84,13 @@ module RedmineDmsf
|
||||
member = Member.find_by(user_id: User.current.id, project_id: revision.dmsf_file.project.id)
|
||||
filename = revision.formatted_name(member)
|
||||
file_view_url = view.static_dmsf_file_path(revision.dmsf_file, download: revision, filename: filename)
|
||||
icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(revision.dmsf_file.name))
|
||||
view.link_to(
|
||||
h(filename),
|
||||
sprite_icon(icon_name, h(filename)),
|
||||
file_view_url,
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
class: "icon icon-file #{DmsfHelper.filetype_css(revision.dmsf_file.name)}",
|
||||
class: 'icon icon-file',
|
||||
title: h(revision.try(:tooltip)),
|
||||
'data-downloadurl' => "#{revision.detect_content_type}:#{h(revision.dmsf_file.name)}:#{file_view_url}"
|
||||
)
|
||||
|
||||
@ -211,16 +211,17 @@ module RedmineDmsf
|
||||
def attachment_row(dmsf_file, link, issue, controller)
|
||||
html = link ? +'<tr class="dmsf-gray">' : +'<tr>'
|
||||
# Checkbox
|
||||
show_checkboxes = true # options[:show_checkboxes].nil? ? true : options[:show_checkboxes]
|
||||
html << '<td></td>' if show_checkboxes
|
||||
html << '<td></td>'
|
||||
file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file })
|
||||
# Title, size
|
||||
html << '<td>'
|
||||
data = "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}"
|
||||
html << link_to(h(dmsf_file.title), file_view_url,
|
||||
icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(item.filename))
|
||||
html << link_to(sprite_icon(icon_name, h(dmsf_file.title)),
|
||||
file_view_url,
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
|
||||
class: 'icon icon-file',
|
||||
title: h(dmsf_file.last_revision.try(:tooltip)),
|
||||
'data-downloadurl' => data)
|
||||
html << "<span class=\"size\">(#{number_to_human_size(dmsf_file.last_revision.size)})</span>"
|
||||
@ -235,39 +236,41 @@ module RedmineDmsf
|
||||
html << '<td class="fast-icons easy-query-additional-ending-buttons hide-when-print">'
|
||||
# Details
|
||||
html << if User.current.allowed_to? :file_manipulation, dmsf_file.project
|
||||
link_to '', dmsf_file_path(id: dmsf_file),
|
||||
link_to sprite_icon('edit', ''), dmsf_file_path(id: dmsf_file),
|
||||
title: l(:link_details, title: h(dmsf_file.last_revision.title)),
|
||||
class: 'icon icon-edit'
|
||||
else
|
||||
'<span class="icon"></span>'
|
||||
end
|
||||
# Email
|
||||
html << link_to('', entries_operations_dmsf_path(id: dmsf_file.project,
|
||||
email_entries: 'email',
|
||||
html << link_to(sprite_icon('email', ''),
|
||||
entries_operations_dmsf_path(id: dmsf_file.project, email_entries: 'email',
|
||||
files: [dmsf_file.id]),
|
||||
method: :post,
|
||||
title: l(:heading_send_documents_by_email), class: 'icon icon-email-disabled')
|
||||
method: :post, title: l(:heading_send_documents_by_email), class: 'icon icon-email-disabled')
|
||||
# Lock
|
||||
html << if !dmsf_file.locked?
|
||||
link_to '', lock_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_lock_file),
|
||||
class: 'icon icon-lock'
|
||||
link_to sprite_icon('lock', ''), lock_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_lock_file), class: 'icon icon-lock'
|
||||
elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? ||
|
||||
User.current.allowed_to?(:force_file_unlock, dmsf_file.project))
|
||||
link_to '', unlock_dmsf_files_path(id: dmsf_file),
|
||||
link_to sprite_icon('unlock', ''), unlock_dmsf_files_path(id: dmsf_file),
|
||||
title: dmsf_file.locked_title, class: 'icon icon-unlock'
|
||||
else
|
||||
"<span class=\"icon icon-unlock\" title=\"#{dmsf_file.locked_title}\"></span>"
|
||||
content_tag 'span',
|
||||
sprite_icon('unlock', ''),
|
||||
title: dmsf_file.locked_title,
|
||||
class: 'icon icon-unlock'
|
||||
end
|
||||
if dmsf_file.locked?
|
||||
html << ('<span class="icon"></span>' * 2)
|
||||
else
|
||||
# Notifications
|
||||
html << if dmsf_file.notification
|
||||
link_to '', notify_deactivate_dmsf_files_path(id: dmsf_file),
|
||||
link_to sprite_icon('email', ''), notify_deactivate_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_notifications_active_deactivate), class: 'icon icon-email'
|
||||
else
|
||||
link_to '', notify_activate_dmsf_files_path(id: dmsf_file),
|
||||
link_to sprite_icon('email-disabled', ''),
|
||||
notify_activate_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_notifications_not_active_activate), class: 'icon icon-email-add'
|
||||
end
|
||||
# Delete
|
||||
@ -279,12 +282,7 @@ module RedmineDmsf
|
||||
else
|
||||
dmsf_file_path id: dmsf_file, commit: 'yes', back_url: issue_path(issue)
|
||||
end
|
||||
html << link_to('',
|
||||
url,
|
||||
data: { confirm: l(:text_are_you_sure) },
|
||||
method: :delete,
|
||||
title: l(:button_delete),
|
||||
class: 'icon icon-del')
|
||||
html << delete_link(url)
|
||||
end
|
||||
end
|
||||
# Approval workflow
|
||||
|
||||
@ -168,7 +168,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
||||
with_settings plugin_redmine_dmsf: { 'dmsf_webdav' => '1', 'dmsf_webdav_strategy' => 'WEBDAV_READ_WRITE' } do
|
||||
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||
assert_response :success
|
||||
assert_select 'a.dmsf-icon-file', text: l(:button_edit_content)
|
||||
assert_select 'a.icon-file', text: l(:button_edit_content)
|
||||
end
|
||||
end
|
||||
|
||||
@ -177,7 +177,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
||||
with_settings plugin_redmine_dmsf: { 'dmsf_webdav' => nil } do
|
||||
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||
assert_response :success
|
||||
assert_select 'a:not(dmsf-icon-file)'
|
||||
assert_select 'a:not(icon-file)'
|
||||
end
|
||||
end
|
||||
|
||||
@ -186,7 +186,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
||||
with_settings plugin_redmine_dmsf: { 'dmsf_webdav' => '1', 'dmsf_webdav_strategy' => 'WEBDAV_READ_ONLY' } do
|
||||
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||
assert_response :success
|
||||
assert_select 'a.dmsf-icon-file.disabled', text: l(:button_edit_content)
|
||||
assert_select 'a.icon-file.disabled', text: l(:button_edit_content)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||