#1563 file icons
@ -53,19 +53,6 @@ module DmsfHelper
|
|||||||
just_filename
|
just_filename
|
||||||
end
|
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)
|
def plugin_asset_path(plugin, asset_type, source)
|
||||||
File.join('/plugin_assets', plugin.to_s, asset_type, source)
|
File.join('/plugin_assets', plugin.to_s, asset_type, source)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -32,24 +32,21 @@ module DmsfQueriesHelper
|
|||||||
when 'file'
|
when 'file'
|
||||||
file = DmsfFile.find_by(id: item.id)
|
file = DmsfFile.find_by(id: item.id)
|
||||||
if file&.locked?
|
if file&.locked?
|
||||||
return content_tag(:span, val) +
|
return content_tag(:span, val) + content_tag('span',
|
||||||
content_tag(:span,
|
sprite_icon('unlock', ''),
|
||||||
'',
|
title: l(:title_locked_by_user, user: file.locked_by),
|
||||||
title: l(:title_locked_by_user, user: file.locked_by),
|
class: 'icon icon-unlock dmsf-icon-unlock')
|
||||||
class: 'icon icon-unlock dmsf-icon-unlock')
|
|
||||||
end
|
end
|
||||||
when 'folder'
|
when 'folder'
|
||||||
folder = DmsfFolder.find_by(id: item.id)
|
folder = DmsfFolder.find_by(id: item.id)
|
||||||
if folder&.locked?
|
if folder&.locked?
|
||||||
return content_tag(:span, val) +
|
return content_tag(:span, val) + content_tag('span',
|
||||||
content_tag(:span,
|
sprite_icon('unlock', ''),
|
||||||
'',
|
title: l(:title_locked_by_user, user: folder.locked_by),
|
||||||
title: l(:title_locked_by_user, user: folder.locked_by),
|
class: 'icon icon-unlock dmsf-icon-unlock')
|
||||||
class: 'icon icon-unlock dmsf-icon-unlock')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
content_tag(:span, val) +
|
content_tag(:span, val) + content_tag(:span, '', class: 'icon icon-none')
|
||||||
content_tag(:span, '', class: 'icon icon-none')
|
|
||||||
when :id
|
when :id
|
||||||
case item.type
|
case item.type
|
||||||
when 'file'
|
when 'file'
|
||||||
@ -109,9 +106,9 @@ module DmsfQueriesHelper
|
|||||||
when 'project'
|
when 'project'
|
||||||
tag = h("[#{value}]")
|
tag = h("[#{value}]")
|
||||||
tag = if item.project.module_enabled?(:dmsf)
|
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
|
else
|
||||||
content_tag 'span', tag, class: 'icon icon-folder'
|
sprite_icon 'folder', tag
|
||||||
end
|
end
|
||||||
unless filter_any?
|
unless filter_any?
|
||||||
path = expand_folder_dmsf_path
|
path = expand_folder_dmsf_path
|
||||||
@ -130,7 +127,7 @@ module DmsfQueriesHelper
|
|||||||
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.project.watched_by?(User.current)
|
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),
|
watch_path(object_type: 'project', object_id: item.project.id),
|
||||||
title: l(:button_unwatch),
|
title: l(:button_unwatch),
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
@ -139,9 +136,10 @@ module DmsfQueriesHelper
|
|||||||
tag
|
tag
|
||||||
when 'folder'
|
when 'folder'
|
||||||
if item&.deleted?
|
if item&.deleted?
|
||||||
tag = content_tag('span', value, class: 'icon icon-folder')
|
tag = sprite_icon('folder', h(value))
|
||||||
else
|
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?
|
unless filter_any?
|
||||||
path = expand_folder_dmsf_path
|
path = expand_folder_dmsf_path
|
||||||
columns = params['c']
|
columns = params['c']
|
||||||
@ -160,7 +158,7 @@ module DmsfQueriesHelper
|
|||||||
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)
|
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),
|
watch_path(object_type: 'dmsf_folder', object_id: item.id),
|
||||||
title: l(:button_unwatch),
|
title: l(:button_unwatch),
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
@ -169,32 +167,32 @@ module DmsfQueriesHelper
|
|||||||
tag
|
tag
|
||||||
when 'folder-link'
|
when 'folder-link'
|
||||||
if item&.deleted?
|
if item&.deleted?
|
||||||
tag = content_tag('span', value, class: 'icon icon-folder')
|
tag = sprite_icon('folder', h(value))
|
||||||
else
|
else
|
||||||
# For links we use revision_id containing dmsf_folder.id in fact
|
# For links, we use revision_id containing dmsf_folder.id in fact
|
||||||
tag = link_to(h(value),
|
tag = link_to(sprite_icon('folder', h(value)), dmsf_folder_path(id: item.project,
|
||||||
dmsf_folder_path(id: item.project, folder_id: item.revision_id),
|
folder_id: item.revision_id))
|
||||||
class: 'icon icon-folder')
|
|
||||||
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
||||||
end
|
end
|
||||||
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:label_target_folder))
|
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:label_target_folder))
|
||||||
when 'file', 'file-link'
|
when 'file', 'file-link'
|
||||||
|
icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(item.filename))
|
||||||
if item&.deleted?
|
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
|
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(
|
file_view_url = url_for(
|
||||||
{ controller: :dmsf_files, action: 'view', id: item.type == 'file' ? item.id : item.revision_id }
|
{ controller: :dmsf_files, action: 'view', id: item.type == 'file' ? item.id : item.revision_id }
|
||||||
)
|
)
|
||||||
content_type = Redmine::MimeType.of(item.filename)
|
content_type = Redmine::MimeType.of(item.filename)
|
||||||
content_type = 'application/octet-stream' if content_type.blank?
|
content_type = 'application/octet-stream' if content_type.blank?
|
||||||
options = { class: "icon icon-file #{DmsfHelper.filetype_css(item.filename)}",
|
options = { class: 'icon icon-file', 'data-downloadurl': "#{content_type}:#{h(value)}:#{file_view_url}" }
|
||||||
'data-downloadurl': "#{content_type}:#{h(value)}:#{file_view_url}" }
|
|
||||||
unless previewable?(item.filename, content_type)
|
unless previewable?(item.filename, content_type)
|
||||||
options[:target] = '_blank'
|
options[:target] = '_blank'
|
||||||
options[:rel] = 'noopener'
|
options[:rel] = 'noopener'
|
||||||
end
|
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?
|
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
||||||
end
|
end
|
||||||
member = Member.find_by(user_id: User.current.id, project_id: item.project_id)
|
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
|
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)
|
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),
|
watch_path(object_type: 'dmsf_file', object_id: item.id),
|
||||||
title: l(:button_unwatch),
|
title: l(:button_unwatch),
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
@ -211,9 +209,13 @@ module DmsfQueriesHelper
|
|||||||
tag
|
tag
|
||||||
when 'url-link'
|
when 'url-link'
|
||||||
if item&.deleted?
|
if item&.deleted?
|
||||||
tag = content_tag('span', value, class: 'icon dmsf-icon-link')
|
tag = sprite_icon('link', h(value))
|
||||||
else
|
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?
|
tag = content_tag('span', '', class: 'dmsf-expander') + tag unless filter_any?
|
||||||
end
|
end
|
||||||
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:field_url))
|
tag + content_tag('div', item.filename, class: 'dmsf-filename', title: l(:field_url))
|
||||||
|
|||||||
@ -92,8 +92,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% url << dmsf_file.name %>
|
<% url << dmsf_file.name %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= context_menu_link sprite_icon('edit', l(:button_edit_content)), url,
|
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(dmsf_file.name)) %>
|
||||||
class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
|
<%= context_menu_link sprite_icon(icon_name, l(:button_edit_content)), url, class: 'icon icon-file',
|
||||||
disabled: url.blank? || (locked && !unlockable) ||
|
disabled: url.blank? || (locked && !unlockable) ||
|
||||||
(Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
|
(Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -22,11 +22,12 @@
|
|||||||
|
|
||||||
<td class="<%= cls %>">
|
<td class="<%= cls %>">
|
||||||
<% file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file }) %>
|
<% 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,
|
file_view_url,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
rel: 'noopener',
|
rel: 'noopener',
|
||||||
class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
|
class: 'icon icon-file',
|
||||||
title: h(dmsf_file.last_revision.try(:tooltip)),
|
title: h(dmsf_file.last_revision.try(:tooltip)),
|
||||||
'data-downloadurl' => "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}" %>
|
'data-downloadurl' => "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}" %>
|
||||||
</td>
|
</td>
|
||||||
@ -47,38 +48,37 @@
|
|||||||
<span class="dmsf_upload_select">
|
<span class="dmsf_upload_select">
|
||||||
<% # Details %>
|
<% # Details %>
|
||||||
<% if User.current.allowed_to? :file_manipulation, dmsf_file.project %>
|
<% 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)),
|
title: l(:link_details, title: h(dmsf_file.last_revision.title)),
|
||||||
class: 'icon-only icon-edit' %>
|
class: 'icon-only icon-edit' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="icon-only"></span>
|
<span class="icon-only"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% # Email %>
|
<% # Email %>
|
||||||
<%= link_to '', entries_operations_dmsf_path(id: dmsf_file.project_id, email_entries: 'email',
|
<%= 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),
|
ids: ["file-#{dmsf_file.id}"],
|
||||||
class: 'icon-only icon-email-disabled' %>
|
back_url: issue_path(@issue)),
|
||||||
|
method: :post, title: l(:heading_send_documents_by_email), class: 'icon-only icon-email-disabled' %>
|
||||||
<% # Lock %>
|
<% # Lock %>
|
||||||
<% if !dmsf_file.locked? %>
|
<% if !dmsf_file.locked? %>
|
||||||
<%= link_to '', lock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
<%= link_to sprite_icon('lock', ''), lock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||||
title: l(:title_lock_file),
|
title: l(:title_lock_file), class: 'icon-only icon-lock' %>
|
||||||
class: 'icon-only icon-lock' %>
|
|
||||||
<% elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, dmsf_file.project)) %>
|
<% 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)),
|
<%= link_to sprite_icon('unlock', ''), unlock_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
||||||
title: dmsf_file.locked_title,
|
title: dmsf_file.locked_title, class: 'icon-only icon-unlock' %>
|
||||||
class: 'icon-only icon-unlock' %>
|
|
||||||
<% else %>
|
<% 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 %>
|
<% end %>
|
||||||
<% if !dmsf_file.locked? %>
|
<% if !dmsf_file.locked? %>
|
||||||
<% # Notifications %>
|
<% # Notifications %>
|
||||||
<% if dmsf_file.notification %>
|
<% if dmsf_file.notification %>
|
||||||
<%= link_to '', notify_deactivate_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
<%= link_to sprite_icon('email', ''), notify_deactivate_dmsf_files_path(id: dmsf_file,
|
||||||
title: l(:title_notifications_active_deactivate),
|
back_url: issue_path(@issue)),
|
||||||
class: 'icon-only icon-email' %>
|
title: l(:title_notifications_active_deactivate), class: 'icon-only icon-email' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to '', notify_activate_dmsf_files_path(id: dmsf_file, back_url: issue_path(@issue)),
|
<%= link_to sprite_icon('email-disabled', ''), notify_activate_dmsf_files_path(id: dmsf_file,
|
||||||
title: l(:title_notifications_not_active_activate),
|
back_url: issue_path(@issue)),
|
||||||
class: 'icon-only icon-email-add' %>
|
title: l(:title_notifications_not_active_activate), class: 'icon-only icon-email-add' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="icon-only"></span>
|
<span class="icon-only"></span>
|
||||||
@ -88,12 +88,12 @@
|
|||||||
<% if @issue.attributes_editable? &&
|
<% if @issue.attributes_editable? &&
|
||||||
((link && User.current.allowed_to?(:file_manipulation, dmsf_file.project)) ||
|
((link && User.current.allowed_to?(:file_manipulation, dmsf_file.project)) ||
|
||||||
(!link && User.current.allowed_to?(:file_delete, dmsf_file.project))) %>
|
(!link && User.current.allowed_to?(:file_delete, dmsf_file.project))) %>
|
||||||
<%= link_to '',
|
<% url = if link
|
||||||
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)),
|
dmsf_link_path(link, commit: 'yes', back_url: issue_path(@issue))
|
||||||
data: { confirm: l(:text_are_you_sure) },
|
else
|
||||||
method: :delete,
|
dmsf_file_path(id: dmsf_file, commit: 'yes', back_url: issue_path(@issue))
|
||||||
title: l(:button_delete),
|
end %>
|
||||||
class: 'icon-only icon-del' %>
|
<%= delete_link url %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% # Approval workflow %>
|
<% # Approval workflow %>
|
||||||
<% wf = DmsfWorkflow.find_by(id: dmsf_file.last_revision.dmsf_workflow_id) if dmsf_file.last_revision.dmsf_workflow_id %>
|
<% 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) %>
|
<% assignments = wf.next_assignments(file.last_revision.id) %>
|
||||||
<% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %>
|
<% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %>
|
||||||
<% if assignments && index %>
|
<% if assignments && index %>
|
||||||
<%= link_to '',
|
<%= link_to sprite_icon('checked', ''),
|
||||||
action_dmsf_workflow_path(project_id: project.id, id: wf.id,
|
action_dmsf_workflow_path(project_id: project.id, id: wf.id,
|
||||||
dmsf_workflow_step_assignment_id: assignments[index].id,
|
dmsf_workflow_step_assignment_id: assignments[index].id,
|
||||||
dmsf_file_revision_id: file.last_revision.id,
|
dmsf_file_revision_id: file.last_revision.id,
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% when DmsfWorkflow::STATE_ASSIGNED %>
|
<% when DmsfWorkflow::STATE_ASSIGNED %>
|
||||||
<% if User.current && (file.last_revision.dmsf_workflow_assigned_by_user == User.current) && wf %>
|
<% 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,
|
start_dmsf_workflow_path(id: file.last_revision.dmsf_workflow_id,
|
||||||
dmsf_file_revision_id: file.last_revision.id,
|
dmsf_file_revision_id: file.last_revision.id,
|
||||||
back_url: back_url),
|
back_url: back_url),
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<span class="icon-only"></span>
|
<span class="icon-only"></span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if workflows_available %>
|
<% if workflows_available %>
|
||||||
<%= link_to '',
|
<%= link_to sprite_icon('checked', ''),
|
||||||
dmsf_link_id ?
|
dmsf_link_id ?
|
||||||
assign_dmsf_workflow_path(id: project.id, project_id: project.id, dmsf_link_id: dmsf_link_id,
|
assign_dmsf_workflow_path(id: project.id, project_id: project.id, dmsf_link_id: dmsf_link_id,
|
||||||
back_url: back_url) :
|
back_url: back_url) :
|
||||||
|
|||||||
@ -95,8 +95,8 @@
|
|||||||
<%= link_to_project file.project %>
|
<%= link_to_project file.project %>
|
||||||
</td>
|
</td>
|
||||||
<td class="title">
|
<td class="title">
|
||||||
<%= link_to h(file.title), dmsf_file_path(id: file),
|
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(file.name)) %>
|
||||||
class: "icon icon-file #{DmsfHelper.filetype_css(file.name)}" %>
|
<%= link_to sprite_icon(icon_name, h(file.title)), dmsf_file_path(id: file), class: 'icon icon-file' %>
|
||||||
</td>
|
</td>
|
||||||
<td class="title">
|
<td class="title">
|
||||||
<% if file.dmsf_folder %>
|
<% if file.dmsf_folder %>
|
||||||
|
|||||||
@ -108,8 +108,8 @@
|
|||||||
<%= link_to_project(file.project) if file.project %>
|
<%= link_to_project(file.project) if file.project %>
|
||||||
</td>
|
</td>
|
||||||
<td class="title">
|
<td class="title">
|
||||||
<%= link_to h(file.title), dmsf_file_path(id: file),
|
<% icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(file.name)) %>
|
||||||
class: "icon icon-file #{DmsfHelper.filetype_css(file.name)}" %>
|
<%= link_to sprite_icon(icon_name, h(file.title)), dmsf_file_path(id: file), class: 'icon icon-file' %>
|
||||||
</td>
|
</td>
|
||||||
<td class="title">
|
<td class="title">
|
||||||
<% if file.dmsf_folder %>
|
<% 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)
|
member = Member.find_by(user_id: User.current.id, project_id: revision.dmsf_file.project.id)
|
||||||
filename = revision.formatted_name(member)
|
filename = revision.formatted_name(member)
|
||||||
file_view_url = view.static_dmsf_file_path(revision.dmsf_file, download: revision, filename: filename)
|
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(
|
view.link_to(
|
||||||
h(filename),
|
sprite_icon(icon_name, h(filename)),
|
||||||
file_view_url,
|
file_view_url,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
rel: 'noopener',
|
rel: 'noopener',
|
||||||
class: "icon icon-file #{DmsfHelper.filetype_css(revision.dmsf_file.name)}",
|
class: 'icon icon-file',
|
||||||
title: h(revision.try(:tooltip)),
|
title: h(revision.try(:tooltip)),
|
||||||
'data-downloadurl' => "#{revision.detect_content_type}:#{h(revision.dmsf_file.name)}:#{file_view_url}"
|
'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)
|
def attachment_row(dmsf_file, link, issue, controller)
|
||||||
html = link ? +'<tr class="dmsf-gray">' : +'<tr>'
|
html = link ? +'<tr class="dmsf-gray">' : +'<tr>'
|
||||||
# Checkbox
|
# Checkbox
|
||||||
show_checkboxes = true # options[:show_checkboxes].nil? ? true : options[:show_checkboxes]
|
html << '<td></td>'
|
||||||
html << '<td></td>' if show_checkboxes
|
|
||||||
file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file })
|
file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file })
|
||||||
# Title, size
|
# Title, size
|
||||||
html << '<td>'
|
html << '<td>'
|
||||||
data = "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}"
|
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',
|
target: '_blank',
|
||||||
rel: 'noopener',
|
rel: 'noopener',
|
||||||
class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
|
class: 'icon icon-file',
|
||||||
title: h(dmsf_file.last_revision.try(:tooltip)),
|
title: h(dmsf_file.last_revision.try(:tooltip)),
|
||||||
'data-downloadurl' => data)
|
'data-downloadurl' => data)
|
||||||
html << "<span class=\"size\">(#{number_to_human_size(dmsf_file.last_revision.size)})</span>"
|
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">'
|
html << '<td class="fast-icons easy-query-additional-ending-buttons hide-when-print">'
|
||||||
# Details
|
# Details
|
||||||
html << if User.current.allowed_to? :file_manipulation, dmsf_file.project
|
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)),
|
title: l(:link_details, title: h(dmsf_file.last_revision.title)),
|
||||||
class: 'icon icon-edit'
|
class: 'icon icon-edit'
|
||||||
else
|
else
|
||||||
'<span class="icon"></span>'
|
'<span class="icon"></span>'
|
||||||
end
|
end
|
||||||
# Email
|
# Email
|
||||||
html << link_to('', entries_operations_dmsf_path(id: dmsf_file.project,
|
html << link_to(sprite_icon('email', ''),
|
||||||
email_entries: 'email',
|
entries_operations_dmsf_path(id: dmsf_file.project, email_entries: 'email',
|
||||||
files: [dmsf_file.id]),
|
files: [dmsf_file.id]),
|
||||||
method: :post,
|
method: :post, title: l(:heading_send_documents_by_email), class: 'icon icon-email-disabled')
|
||||||
title: l(:heading_send_documents_by_email), class: 'icon icon-email-disabled')
|
|
||||||
# Lock
|
# Lock
|
||||||
html << if !dmsf_file.locked?
|
html << if !dmsf_file.locked?
|
||||||
link_to '', lock_dmsf_files_path(id: dmsf_file),
|
link_to sprite_icon('lock', ''), lock_dmsf_files_path(id: dmsf_file),
|
||||||
title: l(:title_lock_file),
|
title: l(:title_lock_file), class: 'icon icon-lock'
|
||||||
class: 'icon icon-lock'
|
|
||||||
elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? ||
|
elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? ||
|
||||||
User.current.allowed_to?(:force_file_unlock, dmsf_file.project))
|
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'
|
title: dmsf_file.locked_title, class: 'icon icon-unlock'
|
||||||
else
|
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
|
end
|
||||||
if dmsf_file.locked?
|
if dmsf_file.locked?
|
||||||
html << ('<span class="icon"></span>' * 2)
|
html << ('<span class="icon"></span>' * 2)
|
||||||
else
|
else
|
||||||
# Notifications
|
# Notifications
|
||||||
html << if dmsf_file.notification
|
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'
|
title: l(:title_notifications_active_deactivate), class: 'icon icon-email'
|
||||||
else
|
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'
|
title: l(:title_notifications_not_active_activate), class: 'icon icon-email-add'
|
||||||
end
|
end
|
||||||
# Delete
|
# Delete
|
||||||
@ -279,12 +282,7 @@ module RedmineDmsf
|
|||||||
else
|
else
|
||||||
dmsf_file_path id: dmsf_file, commit: 'yes', back_url: issue_path(issue)
|
dmsf_file_path id: dmsf_file, commit: 'yes', back_url: issue_path(issue)
|
||||||
end
|
end
|
||||||
html << link_to('',
|
html << delete_link(url)
|
||||||
url,
|
|
||||||
data: { confirm: l(:text_are_you_sure) },
|
|
||||||
method: :delete,
|
|
||||||
title: l(:button_delete),
|
|
||||||
class: 'icon icon-del')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Approval workflow
|
# 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
|
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}"] }
|
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||||
assert_response :success
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
with_settings plugin_redmine_dmsf: { 'dmsf_webdav' => nil } do
|
with_settings plugin_redmine_dmsf: { 'dmsf_webdav' => nil } do
|
||||||
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'a:not(dmsf-icon-file)'
|
assert_select 'a:not(icon-file)'
|
||||||
end
|
end
|
||||||
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
|
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}"] }
|
get '/projects/dmsf/context_menu', params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||||
assert_response :success
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||