<% if !@folder.new_record? && User.current.allowed_to?(:folder_manipulation, @project) && !@folder.system %>
<% if @folder.locked? %>
- <%= link_to_if @folder.unlockable? && (!@folder.locked_for_user? || @force_file_unlock_allowed), l(:button_unlock),
- unlock_dmsf_path(id: @project, folder_id: @folder, back_url: edit_dmsf_url(id: @project, folder_id: @folder)),
+ <%= link_to_if @folder.unlockable? && (!@folder.locked_for_user? || @force_file_unlock_allowed),
+ sprite_icon('unlock', l(:button_unlock)),
+ unlock_dmsf_path(id: @project, folder_id: @folder,
+ back_url: edit_dmsf_url(id: @project, folder_id: @folder)),
title: l(:title_unlock_file), class: 'icon icon-unlock' %>
<% else %>
- <%= link_to l(:button_lock), lock_dmsf_path(id: @project, folder_id: @folder,
- back_url: edit_dmsf_url(id: @project, folder_id: @folder)),
+ <%= link_to sprite_icon('lock', l(:button_lock)),
+ lock_dmsf_path(id: @project, folder_id: @folder,
+ back_url: edit_dmsf_url(id: @project, folder_id: @folder)),
title: l(:title_lock_file), class: 'icon icon-lock' %>
<% end %>
<% if defined?(EasyExtensions) %>
diff --git a/app/views/dmsf/edit_root.html.erb b/app/views/dmsf/edit_root.html.erb
index 758edbe8..26069df6 100644
--- a/app/views/dmsf/edit_root.html.erb
+++ b/app/views/dmsf/edit_root.html.erb
@@ -23,12 +23,12 @@
<% if @notifications && User.current.allowed_to?(:folder_manipulation, @project) %>
<% if @project.dmsf_notification %>
- <%= link_to l(:label_notifications_off),
+ <%= link_to sprite_icon('email', l(:label_notifications_off)),
notify_deactivate_dmsf_path(id: @project, back_url: edit_root_dmsf_path(id: @project)),
title: l(:title_notifications_active_deactivate),
class: 'icon icon-email' %>
<% else %>
- <%= link_to l(:label_notifications_on),
+ <%= link_to sprite_icon('email-disabled', l(:label_notifications_on)),
notify_activate_dmsf_path(id: @project, back_url: edit_root_dmsf_path(id: @project)),
title: l(:title_notifications_active_deactivate),
class: 'icon icon-email-add' %>
diff --git a/app/views/dmsf/email_entries.html.erb b/app/views/dmsf/email_entries.html.erb
index 83ddf496..6adea8ea 100644
--- a/app/views/dmsf/email_entries.html.erb
+++ b/app/views/dmsf/email_entries.html.erb
@@ -38,7 +38,7 @@
<%= label_tag 'email[to]', l(:label_email_to) %>
<%= text_field_tag 'email[to]', @email_params[:to], class: 'dmsf-full-width', required: true %>
- <%= link_to l(:button_add), add_email_dmsf_path(id: @project),
+ <%= link_to sprite_icon('add', l(:button_add)), add_email_dmsf_path(id: @project),
title: l(:label_email_address_add), class: 'icon icon-add', remote: true %>
diff --git a/app/views/dmsf/trash.html.erb b/app/views/dmsf/trash.html.erb
index 31eb8524..d6efeb9b 100644
--- a/app/views/dmsf/trash.html.erb
+++ b/app/views/dmsf/trash.html.erb
@@ -22,7 +22,7 @@
<% if @file_delete_allowed %>
- <%= link_to l(:label_empty_trash_bin), empty_trash_path(id: @project), class: 'icon icon-del' %>
+ <%= link_to sprite_icon('del', l(:label_empty_trash_bin)), empty_trash_path(id: @project), class: 'icon icon-del' %>
<% end %>
diff --git a/app/views/dmsf_context_menus/_approval_workflow.html.erb b/app/views/dmsf_context_menus/_approval_workflow.html.erb
index 75793364..bb0015e2 100644
--- a/app/views/dmsf_context_menus/_approval_workflow.html.erb
+++ b/app/views/dmsf_context_menus/_approval_workflow.html.erb
@@ -32,44 +32,52 @@
<% index = assignments.find_index{ |assignment| assignment.user_id == User.current.id } if assignments %>
<% assignment_id = (index && assignments && assignments[index]) ? assignments[index].id : nil %>
<% if allowed_minor %>
- <%= context_menu_link l(:title_approval), action_dmsf_workflow_path(project_id: project.id, id: wf.id,
- dmsf_workflow_step_assignment_id: assignment_id,
- dmsf_file_revision_id: dmsf_file.last_revision.id,
- back_url: back_url),
- remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow',
- disabled: !assignments || !index %>
+ <%= context_menu_link sprite_icon('checked', l(:title_approval)),
+ action_dmsf_workflow_path(project_id: project.id, id: wf.id,
+ dmsf_workflow_step_assignment_id: assignment_id,
+ dmsf_file_revision_id: dmsf_file.last_revision.id,
+ back_url: back_url),
+ remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow',
+ disabled: !assignments || !index %>
<% else %>
- <%= context_menu_link l(:title_approval_minor), action_dmsf_workflow_path(project_id: project.id, id: wf.id,
- dmsf_workflow_step_assignment_id: assignment_id,
- dmsf_file_revision_id: dmsf_file.last_revision.id,
- back_url: back_url),
- remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow',
- disabled: true %>
+ <%= context_menu_link sprite_icon('checked', l(:title_approval_minor)),
+ action_dmsf_workflow_path(project_id: project.id, id: wf.id,
+ dmsf_workflow_step_assignment_id: assignment_id,
+ dmsf_file_revision_id: dmsf_file.last_revision.id,
+ back_url: back_url),
+ remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow', disabled: true %>
<% end %>
<% end %>
<% when DmsfWorkflow::STATE_ASSIGNED %>
<% if allowed_minor %>
- <%= context_menu_link l(:title_start), start_dmsf_workflow_path(id: dmsf_file.last_revision.dmsf_workflow_id,
- dmsf_file_revision_id: dmsf_file.last_revision.id, back_url: back_url),
- class: 'icon icon-ok', disabled: !allowed %>
+ <%= context_menu_link sprite_icon('checked', l(:title_start)),
+ start_dmsf_workflow_path(id: dmsf_file.last_revision.dmsf_workflow_id,
+ dmsf_file_revision_id: dmsf_file.last_revision.id,
+ back_url: back_url),
+ class: 'icon icon-ok', disabled: !allowed %>
<% else %>
- <%= context_menu_link l(:title_start_minor), start_dmsf_workflow_path(id: dmsf_file.last_revision.dmsf_workflow_id,
- dmsf_file_revision_id: dmsf_file.last_revision.id, back_url: back_url),
- class: 'icon icon-ok', disabled: true %>
+ <%= context_menu_link sprite_icon('checked', l(:title_start_minor)),
+ start_dmsf_workflow_path(id: dmsf_file.last_revision.dmsf_workflow_id,
+ dmsf_file_revision_id: dmsf_file.last_revision.id,
+ back_url: back_url),
+ class: 'icon icon-ok', disabled: true %>
<% end %>
<% when DmsfWorkflow::STATE_APPROVED, DmsfWorkflow::STATE_REJECTED, DmsfWorkflow::STATE_OBSOLETE %>
<%# %>
<% else %>
<% if allowed_minor %>
- <%= context_menu_link l(:title_assignment), assign_dmsf_workflow_path(id: project.id, project_id: project.id,
- dmsf_file_revision_id: dmsf_file.last_revision.id, back_url: back_url),
- remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow',
- disabled: locked || !workflows_available %>
+ <%= context_menu_link sprite_icon('checked', l(:title_assignment)),
+ assign_dmsf_workflow_path(id: project.id, project_id: project.id,
+ dmsf_file_revision_id: dmsf_file.last_revision.id,
+ back_url: back_url),
+ remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow',
+ disabled: locked || !workflows_available %>
<% else %>
- <%= context_menu_link l(:title_assignment_minor), assign_dmsf_workflow_path(id: project.id, project_id: project.id,
- dmsf_file_revision_id: dmsf_file.last_revision.id, back_url: back_url),
- remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow',
- disabled: true %>
+ <%= context_menu_link sprite_icon('checked', l(:title_assignment_minor)),
+ assign_dmsf_workflow_path(id: project.id, project_id: project.id,
+ dmsf_file_revision_id: dmsf_file.last_revision.id,
+ back_url: back_url),
+ remote: true, class: 'icon icon-ok', id: 'dmsf-cm-workflow', disabled: true %>
<% end %>
<% end %>
<% end %>
diff --git a/app/views/dmsf_context_menus/_file.html.erb b/app/views/dmsf_context_menus/_file.html.erb
index 510ceba4..978bfc7a 100644
--- a/app/views/dmsf_context_menus/_file.html.erb
+++ b/app/views/dmsf_context_menus/_file.html.erb
@@ -19,20 +19,19 @@
%>
- <%= context_menu_link l(:button_edit), dmsf_file_path(id: dmsf_file, back_url: back_url), class: 'icon icon-edit',
- data: { cy: "icon__edit--dmsf_file_#{dmsf_file.id}" },
+ <%= context_menu_link sprite_icon('edit', l(:button_edit)), dmsf_file_path(id: dmsf_file, back_url: back_url),
+ class: 'icon icon-edit', data: { cy: "icon__edit--dmsf_file_#{dmsf_file.id}" },
disabled: !allowed || (locked && !unlockable) %>
-
<% unless dmsf_link %>
- <%= context_menu_link "#{l(:button_copy)}/#{l(:button_move)}",
+ <%= context_menu_link sprite_icon('copy', "#{l(:button_copy)}/#{l(:button_move)}"),
copymove_entries_path(id: project, folder_id: folder, ids: ["file-#{dmsf_file.id}"],
back_url: back_url), title: l(:title_copy), class: 'icon icon-copy',
data: { cy: "icon__copy--dmsf_file_#{dmsf_file.id}" } %>
- <%= link_to l(:label_link_to),
+ <%= link_to sprite_icon('link', l(:label_link_to)),
new_dmsf_link_path(project_id: dmsf_file.project.id, dmsf_folder_id: dmsf_file.dmsf_folder,
dmsf_file_id: dmsf_file.id, type: 'link_to', back_url: back_url),
title: l(:title_create_link), class: 'icon dmsf-icon-link',
@@ -41,24 +40,27 @@
<% end %>
<% if locked %>
- <%= context_menu_link l(:button_unlock), unlock_dmsf_files_path(id: dmsf_file, back_url: back_url),
+ <%= context_menu_link sprite_icon('unlock', l(:button_unlock)), unlock_dmsf_files_path(id: dmsf_file, back_url: back_url),
class: 'icon icon-unlock', data: { cy: "icon__unlock--dmsf_file_#{dmsf_file.id}" },
title: l(:title_locked_by_user, user: dmsf_file.locked_by), disabled: !unlockable %>
<% else %>
- <%= context_menu_link l(:button_lock), lock_dmsf_files_path(id: dmsf_file, back_url: back_url),
+ <%= context_menu_link sprite_icon('lock', l(:button_lock)), lock_dmsf_files_path(id: dmsf_file, back_url: back_url),
class: 'icon icon-lock', data: { cy: "icon__lock--dmsf_file_#{dmsf_file.id}" }, disabled: !allowed %>
<% end %>
<% if notifications %>
<% if dmsf_file.notification %>
- <%= context_menu_link l(:label_notifications_off), notify_deactivate_dmsf_files_path(id: dmsf_file,
- back_url: back_url), class: 'icon icon-email', data: { cy: "icon__email--dmsf_file_#{dmsf_file.id}" },
- disabled: !allowed || locked %>
+ <%= context_menu_link sprite_icon('email', l(:label_notifications_off)),
+ notify_deactivate_dmsf_files_path(id: dmsf_file, back_url: back_url),
+ class: 'icon icon-email', data: { cy: "icon__email--dmsf_file_#{dmsf_file.id}" },
+ disabled: !allowed || locked %>
<% else %>
- <%= context_menu_link l(:label_notifications_on), notify_activate_dmsf_files_path(id: dmsf_file,
- back_url: back_url), class: 'icon icon-email-add',
- data: { cy: "icon__email_add--dmsf_file_#{dmsf_file.id}" }, disabled: !allowed || locked %>
+ <%= context_menu_link sprite_icon('email-disabled', l(:label_notifications_on)),
+ notify_activate_dmsf_files_path(id: dmsf_file, back_url: back_url),
+ class: 'icon icon-email-add',
+ data: { cy: "icon__email_add--dmsf_file_#{dmsf_file.id}" },
+ disabled: !allowed || locked %>
<% end %>
<% end %>
@@ -69,13 +71,16 @@
<% member = Member.find_by(user_id: User.current.id, project_id: dmsf_file.project.id) %>
<% filename = dmsf_file.last_revision&.formatted_name(member) %>
- <%= context_menu_link l(:button_download), static_dmsf_file_path(dmsf_file, filename: filename),
+ <%= context_menu_link sprite_icon('download', l(:button_download)),
+ static_dmsf_file_path(dmsf_file, filename: filename),
class: 'icon icon-download', data: { cy: "icon__download--dmsf_file_#{dmsf_file.id}" },
disabled: false %>
-<%= context_menu_link l(:field_mail), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], email_entries: true, back_url: back_url), method: :post, class: 'icon icon-email',
+<%= context_menu_link sprite_icon('email', l(:field_mail)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ email_entries: true, back_url: back_url),
+ method: :post, class: 'icon icon-email',
data: { cy: "icon__email--dmsf_file_#{dmsf_file.id}" }, disabled: !email_allowed %>
<% if Setting.plugin_redmine_dmsf['dmsf_webdav'].present? %>
@@ -87,9 +92,10 @@
<% end %>
<% url << dmsf_file.name %>
<% end %>
- <%= context_menu_link l(:button_edit_content), url, class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
- disabled: url.blank? || (locked && !unlockable) ||
- (Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
+ <%= context_menu_link sprite_icon('edit', l(:button_edit_content)), url,
+ class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}",
+ disabled: url.blank? || (locked && !unlockable) ||
+ (Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
<% end %>
@@ -97,12 +103,12 @@
<% if @preview %>
- <%= context_menu_link l(:label_preview), view_dmsf_file_path(dmsf_file, preview: true),
- class: 'icon icon-magnifier', disabled: false %>
+ <%= context_menu_link sprite_icon('zoom-in', l(:label_preview)), view_dmsf_file_path(dmsf_file, preview: true),
+ class: 'icon icon-zoom-in', disabled: false %>
<% end %>
- <%= context_menu_link l(:button_delete),
+ <%= context_menu_link sprite_icon('del', l(:button_delete)),
dmsf_link ? dmsf_link_path(id: dmsf_link, folder_id: folder, back_url: back_url) : dmsf_file_path(id: dmsf_file,
folder_id: folder, back_url: back_url),
method: :delete, class: 'icon icon-del', data: { confirm: l(:text_are_you_sure),
diff --git a/app/views/dmsf_context_menus/_file_trash.html.erb b/app/views/dmsf_context_menus/_file_trash.html.erb
index 69d7b939..338156fa 100644
--- a/app/views/dmsf_context_menus/_file_trash.html.erb
+++ b/app/views/dmsf_context_menus/_file_trash.html.erb
@@ -19,12 +19,12 @@
%>
- <%= context_menu_link l(:title_restore),
+ <%= context_menu_link sprite_icon('reload', l(:title_restore)),
dmsf_link ? restore_dmsf_link_path(id: dmsf_link) : restore_dmsf_file_path(id: dmsf_file),
class: 'icon icon-cancel', disabled: !allowed_restore %>
- <%= context_menu_link l(:button_delete),
+ <%= context_menu_link sprite_icon('del', l(:button_delete)),
dmsf_link ? dmsf_link_path(id: dmsf_link, commit: 'yes') : dmsf_file_path(id: dmsf_file, commit: 'yes'),
data: { confirm: l(:text_are_you_sure) }, method: :delete, class: 'icon icon-del',
id: 'dmsf-cm-delete', disabled: !allowed_delete %>
diff --git a/app/views/dmsf_context_menus/_folder.html.erb b/app/views/dmsf_context_menus/_folder.html.erb
index e8ebf160..b1e3ce77 100644
--- a/app/views/dmsf_context_menus/_folder.html.erb
+++ b/app/views/dmsf_context_menus/_folder.html.erb
@@ -20,34 +20,39 @@
<% unless edit %>
- <%= context_menu_link l(:button_edit), edit_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder,
- back_url: back_url), class: 'icon icon-edit', data: { cy: "icon__edit--dmsf_folder_#{dmsf_folder.id}" },
+ <%= context_menu_link sprite_icon('edit', l(:button_edit)),
+ edit_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder, back_url: back_url),
+ class: 'icon icon-edit', data: { cy: "icon__edit--dmsf_folder_#{dmsf_folder.id}" },
disabled: !allowed || locked %>
<% end %>
<% unless dmsf_link %>
- <%= context_menu_link "#{l(:button_copy)}/#{l(:button_move)}", copymove_entries_path(id: project, folder_id: folder,
- ids: ["folder-#{dmsf_folder.id}"], back_url: back_url), class: 'icon icon-copy',
- data: { cy: "icon__copy--dmsf_folder_#{dmsf_folder.id}" }, disabled: !allowed || locked %>
+ <%= context_menu_link sprite_icon('copy', "#{l(:button_copy)}/#{l(:button_move)}"),
+ copymove_entries_path(id: project, folder_id: folder, ids: ["folder-#{dmsf_folder.id}"],
+ back_url: back_url), class: 'icon icon-copy',
+ data: { cy: "icon__copy--dmsf_folder_#{dmsf_folder.id}" },
+ disabled: !allowed || locked %>
- <%= context_menu_link l(:label_link_to),
+ <%= context_menu_link sprite_icon('link', l(:label_link_to)),
new_dmsf_link_path(project_id: project.id, dmsf_folder_id: dmsf_folder.id, type: 'link_to',
back_url: back_url), class: 'icon dmsf-icon-link',
- data: { cy: "icon__link_to--dmsf_folder_#{dmsf_folder.id}" } %>
+ data: { cy: "icon__link_to--dmsf_folder_#{dmsf_folder.id}" } %>
<% end %>
<% unless edit %>
<% if locked %>
- <%= context_menu_link l(:button_unlock), unlock_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder,
- back_url: back_url), title: l(:title_locked_by_user, user: dmsf_folder.locked_by),
- class: 'icon icon-unlock', data: { cy: "icon__unlock--dmsf_folder_#{dmsf_folder.id}" },
+ <%= context_menu_link sprite_icon('unlock', l(:button_unlock)),
+ unlock_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder, back_url: back_url),
+ title: l(:title_locked_by_user, user: dmsf_folder.locked_by), class: 'icon icon-unlock',
+ data: { cy: "icon__unlock--dmsf_folder_#{dmsf_folder.id}" },
disabled: !allowed || !unlockable %>
<% else %>
- <%= context_menu_link l(:button_lock), lock_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder,
- back_url: back_url), class: 'icon icon-lock', data: { cy: "icon__lock--dmsf_folder_#{dmsf_folder.id}" },
+ <%= context_menu_link sprite_icon('lock', l(:button_lock)),
+ lock_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder, back_url: back_url),
+ class: 'icon icon-lock', data: { cy: "icon__lock--dmsf_folder_#{dmsf_folder.id}" },
disabled: !allowed %>
<% end %>
@@ -55,28 +60,34 @@
<% if notifications %>
<% if dmsf_folder.notification %>
- <%= context_menu_link l(:label_notifications_off), notify_deactivate_dmsf_path(id: dmsf_folder.project,
- folder_id: dmsf_folder, back_url: back_url), class: 'icon icon-email',
- data: { cy: "icon__email--dmsf_folder_#{dmsf_folder.id}" },
- disabled: !allowed || locked || !dmsf_folder.notification? %>
+ <%= context_menu_link sprite_icon('email', l(:label_notifications_off)),
+ notify_deactivate_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder,
+ back_url: back_url), class: 'icon icon-email',
+ data: { cy: "icon__email--dmsf_folder_#{dmsf_folder.id}" },
+ disabled: !allowed || locked || !dmsf_folder.notification? %>
<% else %>
- <%= context_menu_link l(:label_notifications_on), notify_activate_dmsf_path(id: dmsf_folder.project,
- folder_id: dmsf_folder, back_url: back_url), class: 'icon icon-email-add',
- data: { cy: "icon__email_add--dmsf_folder_#{dmsf_folder.id}" },
- disabled: !allowed || locked || dmsf_folder.notification? %>
+ <%= context_menu_link sprite_icon('email-disabled', l(:label_notifications_on)),
+ notify_activate_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder,
+ back_url: back_url), class: 'icon icon-email-add',
+ data: { cy: "icon__email_add--dmsf_folder_#{dmsf_folder.id}" },
+ disabled: !allowed || locked || dmsf_folder.notification? %>
<% end %>
<% end %>
<% unless edit %>
- <%= context_menu_link l(:button_download), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], download_entries: true, back_url: back_url), method: :post, class: 'icon icon-download',
+ <%= context_menu_link sprite_icon('download', l(:button_download)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ download_entries: true, back_url: back_url),
+ method: :post, class: 'icon icon-download',
data: { cy: "icon__download--dmsf_folder_#{dmsf_folder.id}" },
id: 'dmsf-cm-download', disabled: false %>
- <%= context_menu_link l(:field_mail), entries_operations_dmsf_path(id: dmsf_folder.project, folder_id: folder,
- ids: params[:ids], email_entries: true, back_url: back_url), method: :post, class: 'icon icon-email',
+ <%= context_menu_link sprite_icon('email', l(:field_mail)),
+ entries_operations_dmsf_path(id: dmsf_folder.project, folder_id: folder, ids: params[:ids],
+ email_entries: true, back_url: back_url),
+ method: :post, class: 'icon icon-email',
data: { cy: "icon__email--dmsf_folder_#{dmsf_folder.id}" },
disabled: !email_allowed %>
@@ -85,7 +96,7 @@
<%= render partial: 'dmsf_context_menus/watch', locals: { object: dmsf_folder } %>
- <%= context_menu_link l(:button_delete),
+ <%= context_menu_link sprite_icon('del', l(:button_delete)),
dmsf_link ? dmsf_link_path(id: dmsf_link, folder_id: folder, back_url: back_url) :
delete_dmsf_path(id: dmsf_folder.project, folder_id: dmsf_folder, parent_id: folder, back_url: back_url),
data: { confirm: "#{l(:text_are_you_sure)}\n#{l(:text_not_empty) unless dmsf_folder.empty?}",
diff --git a/app/views/dmsf_context_menus/_folder_trash.html.erb b/app/views/dmsf_context_menus/_folder_trash.html.erb
index 89448e64..a29c399f 100644
--- a/app/views/dmsf_context_menus/_folder_trash.html.erb
+++ b/app/views/dmsf_context_menus/_folder_trash.html.erb
@@ -19,12 +19,12 @@
%>
- <%= context_menu_link l(:title_restore),
+ <%= context_menu_link sprite_icon('reload', l(:title_restore)),
dmsf_link ? restore_dmsf_link_path(id: dmsf_link) : restore_dmsf_path(id: project, folder_id: dmsf_folder),
class: 'icon icon-cancel', disabled: !allowed_restore %>
- <%= context_menu_link l(:button_delete),
+ <%= context_menu_link sprite_icon('del', l(:button_delete)),
dmsf_link ? dmsf_link_path(id: dmsf_link, commit: 'yes') : delete_dmsf_path(id: project, folder_id: dmsf_folder, commit: 'yes'),
data: { confirm: l(:text_are_you_sure) }, method: :delete, class: 'icon icon-del',
id: 'dmsf-cm-delete', disabled: !allowed_delete %>
diff --git a/app/views/dmsf_context_menus/_main.html.erb b/app/views/dmsf_context_menus/_main.html.erb
index 1c413e20..888d5cb2 100644
--- a/app/views/dmsf_context_menus/_main.html.erb
+++ b/app/views/dmsf_context_menus/_main.html.erb
@@ -20,13 +20,13 @@
<% if folder_manipulation_allowed && !system_folder %>
<% if folder.nil? %>
- <%= link_to l(:button_edit),
+ <%= link_to sprite_icon('edit', l(:button_edit)),
edit_root_dmsf_path(id: project),
title: l(:link_edit, title: l(:link_documents)),
class: 'icon icon-edit',
data: { cy: 'button__edit--dmsf' } %>
<% elsif !locked_for_user %>
- <%= link_to l(:button_edit),
+ <%= link_to sprite_icon('edit', l(:button_edit)),
edit_dmsf_path(id: project, folder_id: folder, redirect_to_folder_id: folder.id),
title: l(:link_edit, title: h(folder.title)),
class: 'icon icon-edit',
@@ -35,13 +35,13 @@
<% if folder && (!locked_for_user || User.current.allowed_to?(:force_file_unlock, project)) %>
<% if folder.locked? %>
<%= link_to_if folder.unlockable?,
- l(:button_unlock),
+ sprite_icon('unlock', l(:button_unlock)),
unlock_dmsf_path(id: project, folder_id: folder, current: request.url),
title: l(:title_unlock_folder),
class: 'icon icon-unlock',
data: { cy: 'button__unlock--dmsf' } %>
<% else %>
- <%= link_to l(:button_lock),
+ <%= link_to sprite_icon('lock', l(:button_lock)),
lock_dmsf_path(id: project, folder_id: folder, current: request.url),
title: l(:title_lock_folder), class: 'icon icon-lock',
data: { cy: 'button__lock--dmsf' } %>
@@ -49,13 +49,13 @@
<% end %>
<% if notifications %>
<% if !locked_for_user && ((folder && folder.notification) || (!folder && project.dmsf_notification)) %>
- <%= link_to l(:label_notifications_off),
+ <%= link_to sprite_icon('email', l(:label_notifications_off)),
notify_deactivate_dmsf_path(id: project, folder_id: folder),
title: l(:title_notifications_active_deactivate),
class: 'icon icon-email',
data: { cy: 'button__notifications-off--dmsf' } %>
<% else %>
- <%= link_to l(:label_notifications_on),
+ <%= link_to sprite_icon('email-disabled', l(:label_notifications_on)),
notify_activate_dmsf_path(id: project, folder_id: folder),
title: l(:title_notifications_not_active_activate),
class: 'icon icon-email-add',
@@ -63,7 +63,7 @@
<% end %>
<% end %>
<% if file_manipulation_allowed && !locked_for_user %>
- <%= link_to l(:label_link_from),
+ <%= link_to sprite_icon('link', l(:label_link_from)),
new_dmsf_link_path(project_id: project.id, dmsf_folder_id: folder ? folder.id : folder,
type: 'link_from'),
title: l(:title_create_link),
@@ -73,19 +73,19 @@
<% end %>
<%= render partial: 'dmsf_context_menus/watch', locals: { object: folder ? folder : project } %>
<% if trash_enabled %>
- <%= link_to l(:link_trash_bin),
+ <%= link_to sprite_icon('del', l(:link_trash_bin)),
trash_dmsf_path(project),
title: l(:link_trash_bin),
class: 'icon icon-del',
data: { cy: 'button__trash--dmsf' } %>
<% else %>
- <%= l(:link_trash_bin) %>
+ <%= sprite_icon('del', l(:link_trash_bin)) %>
<% end %>
<% lang = current_language.to_s.downcase %>
<% path = File.join(File.dirname(__FILE__), '..', '..', '..', 'assets', 'help', lang, 'dmsf_help.html') %>
<% lang = 'en' unless File.exist?(path) %>
<% url = "/plugin_assets/redmine_dmsf/help/#{lang}/dmsf_help.html" %>
-<%= link_to l(:label_help), 'dmsf_help.html', class: 'icon icon-help',
- onclick: "window.open('#{url}','_blank', 'width=640,height=960'); return false;" %>
+<%= link_to sprite_icon('help', l(:label_help)), 'dmsf_help.html', class: 'icon icon-help',
+ onclick: "window.open('#{url}','_blank', 'width=640,height=960'); return false;" %>
diff --git a/app/views/dmsf_context_menus/_multiple.html.erb b/app/views/dmsf_context_menus/_multiple.html.erb
index 8ee81dbb..4a911721 100644
--- a/app/views/dmsf_context_menus/_multiple.html.erb
+++ b/app/views/dmsf_context_menus/_multiple.html.erb
@@ -19,20 +19,26 @@
%>
- <%= context_menu_link l(:button_download), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], download_entries: true), method: :post, class: 'icon icon-download', disabled: project.nil? %>
+ <%= context_menu_link sprite_icon('download', l(:button_download)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ download_entries: true),
+ method: :post, class: 'icon icon-download', disabled: project.nil? %>
- <%= context_menu_link l(:field_mail), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], email_entries: true), method: :post, class: 'icon icon-email',
- disabled: !email_allowed %>
+ <%= context_menu_link sprite_icon('email', l(:field_mail)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ email_entries: true),
+ method: :post, class: 'icon icon-email', disabled: !email_allowed %>
- <%= context_menu_link "#{l(:button_copy)}/#{l(:button_move)}", copymove_entries_path(id: project, folder_id: folder,
- ids: params[:ids], back_url: back_url), class: 'icon icon-copy', disabled: project.nil? %>
+ <%= context_menu_link sprite_icon('copy', "#{l(:button_copy)}/#{l(:button_move)}"),
+ copymove_entries_path(id: project, folder_id: folder, ids: params[:ids], back_url: back_url),
+ class: 'icon icon-copy', disabled: project.nil? %>
- <%= context_menu_link l(:button_delete), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], delete_entries: true), method: :post, class: 'icon icon-del',
- data: { confirm: l(:text_are_you_sure) }, id: 'dmsf-cm-delete', disabled: !allowed %>
+ <%= context_menu_link sprite_icon('del', l(:button_delete)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ delete_entries: true),
+ method: :post, class: 'icon icon-del', data: { confirm: l(:text_are_you_sure) },
+ id: 'dmsf-cm-delete', disabled: !allowed %>
diff --git a/app/views/dmsf_context_menus/_multiple_trash.html.erb b/app/views/dmsf_context_menus/_multiple_trash.html.erb
index 00bafd8b..e961b789 100644
--- a/app/views/dmsf_context_menus/_multiple_trash.html.erb
+++ b/app/views/dmsf_context_menus/_multiple_trash.html.erb
@@ -19,11 +19,15 @@
%>
- <%= context_menu_link l(:title_restore), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], restore_entries: true), method: :post, class: 'icon icon-cancel', disabled: !allowed_restore %>
+ <%= context_menu_link sprite_icon('reload', l(:title_restore)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ restore_entries: true),
+ method: :post, class: 'icon icon-cancel', disabled: !allowed_restore %>
- <%= context_menu_link l(:button_delete), entries_operations_dmsf_path(id: project, folder_id: folder,
- ids: params[:ids], destroy_entries: true), method: :post, class: 'icon icon-del',
- data: { confirm: l(:text_are_you_sure) }, id: 'dmsf-cm-delete', disabled: !allowed_delete %>
+ <%= context_menu_link sprite_icon('del', l(:button_delete)),
+ entries_operations_dmsf_path(id: project, folder_id: folder, ids: params[:ids],
+ destroy_entries: true),
+ method: :post, class: 'icon icon-del', data: { confirm: l(:text_are_you_sure) },
+ id: 'dmsf-cm-delete', disabled: !allowed_delete %>
diff --git a/app/views/dmsf_context_menus/_revision_actions.html.erb b/app/views/dmsf_context_menus/_revision_actions.html.erb
index 51569820..44de9aaf 100644
--- a/app/views/dmsf_context_menus/_revision_actions.html.erb
+++ b/app/views/dmsf_context_menus/_revision_actions.html.erb
@@ -18,18 +18,19 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
-<%= link_to_function l(:title_download_entries),
+<%= link_to_function sprite_icon('group', l(:title_download_entries)),
"$('#revision_access_#{revision.id}').toggle(); $('.drdn.expanded').removeClass('expanded');",
class: 'icon icon-group dmsf-revision-action-button' %>
<% member = Member.find_by(user_id: User.current.id, project_id: revision.dmsf_file.project.id) %>
<% filename = revision.formatted_name(member) %>
-<%= link_to l(:button_download), static_dmsf_file_path(file, download: revision, filename: filename),
+<%= link_to sprite_icon('download', l(:button_download)),
+ static_dmsf_file_path(file, download: revision, filename: filename),
class: 'icon icon-download', disabled: false %>
-<%= link_to l(:title_obsolete_revision),
+<%= link_to sprite_icon('close', l(:title_obsolete_revision)),
obsolete_revision_path(revision),
data: { confirm: l(:text_are_you_sure) },
class: 'icon icon-close dmsf-revision-action-button' if file_manipulation_allowed && (revision.workflow == DmsfWorkflow::STATE_APPROVED) %>
-<%= link_to l(:button_delete),
+<%= link_to sprite_icon('del', l(:button_delete)),
delete_revision_path(revision),
data: { confirm: l(:text_are_you_sure) },
title: l(:title_delete_revision),
diff --git a/app/views/dmsf_context_menus/_revisions.html.erb b/app/views/dmsf_context_menus/_revisions.html.erb
index 53920bfb..622fdff0 100644
--- a/app/views/dmsf_context_menus/_revisions.html.erb
+++ b/app/views/dmsf_context_menus/_revisions.html.erb
@@ -20,28 +20,28 @@
<% if notifications %>
<% if file.notification %>
- <%= link_to l(:label_notifications_off),
+ <%= link_to sprite_icon('email', l(:label_notifications_off)),
notify_deactivate_dmsf_files_path(id: file, back_url: back_url),
title: l(:title_notifications_active_deactivate),
class: 'icon icon-email' %>
<% else %>
- <%= link_to l(:label_notifications_on),
+ <%= link_to sprite_icon('email-disabled', l(:label_notifications_on)),
notify_activate_dmsf_files_path(id: file, back_url: back_url),
title: l(:title_notifications_not_active_activate),
class: 'icon icon-email-add' %>
<% end %>
<% end %>
-<%= link_to l(:label_link_to),
+<%= link_to sprite_icon('link', l(:label_link_to)),
new_dmsf_link_path(project_id: project.id, dmsf_folder_id: file.dmsf_folder ? file.dmsf_folder.id : nil,
dmsf_file_id: file.id, type: 'link_to', back_url: back_url),
- title: l(:title_create_link),
- class: 'icon dmsf-icon-link' %>
-<%= context_menu_link "#{l(:button_copy)}/#{l(:button_move)}", copymove_entries_path(id: project,
- folder_id: file.dmsf_folder, ids: ["file-#{file.id}"], back_url: back_url), class: 'icon icon-copy' %>
+ title: l(:title_create_link), class: 'icon dmsf-icon-link' %>
+<%= context_menu_link sprite_icon('copy', "#{l(:button_copy)}/#{l(:button_move)}"),
+ copymove_entries_path(id: project, folder_id: file.dmsf_folder, ids: ["file-#{file.id}"],
+ back_url: back_url), class: 'icon icon-copy' %>
<% member = Member.find_by(user_id: User.current.id, project_id: file.project.id) %>
<% filename = file.last_revision&.formatted_name(member) %>
-<%= link_to l(:button_download), static_dmsf_file_path(file, filename: filename), class: 'icon icon-download',
- disabled: false %>
+<%= link_to sprite_icon('download', l(:button_download)),
+ static_dmsf_file_path(file, filename: filename), class: 'icon icon-download', disabled: false %>
<%= render partial: 'dmsf_context_menus/watch', locals: { object: file } %>
<%= delete_link(dmsf_file_path(id: file, details: true),
back_url: dmsf_folder_path(id: file.project, folder_id: file.dmsf_folder)) if file_delete_allowed %>
diff --git a/app/views/dmsf_context_menus/_url.html.erb b/app/views/dmsf_context_menus/_url.html.erb
index a76dc4b8..68d3f85c 100644
--- a/app/views/dmsf_context_menus/_url.html.erb
+++ b/app/views/dmsf_context_menus/_url.html.erb
@@ -19,6 +19,7 @@
%>
- <%= context_menu_link l(:button_delete), dmsf_link_path(dmsf_link), method: :delete, class: 'icon icon-del',
- data: { confirm: l(:text_are_you_sure) }, id: 'dmsf-cm-delete', disabled: !allowed %>
+ <%= context_menu_link sprite_icon('del', l(:button_delete)), dmsf_link_path(dmsf_link), method: :delete,
+ class: 'icon icon-del', data: { confirm: l(:text_are_you_sure) }, id: 'dmsf-cm-delete',
+ disabled: !allowed %>
diff --git a/app/views/dmsf_context_menus/_watch.html.erb b/app/views/dmsf_context_menus/_watch.html.erb
index a610b715..2a53c967 100644
--- a/app/views/dmsf_context_menus/_watch.html.erb
+++ b/app/views/dmsf_context_menus/_watch.html.erb
@@ -22,7 +22,7 @@
<% 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) %>
+<% text = sprite_icon('fav', watched ? l(:button_unwatch) : l(:button_watch)) %>
<% url = watch_path(object_type: object.class.to_s.underscore, object_id: object.id) %>
<% method = watched ? 'delete' : 'post' %>
<%= context_menu_link text, url, method: method, class: css, disabled: !User.current.logged? %>
diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb
index 76bb9aef..4e56bdac 100644
--- a/app/views/dmsf_files/show.html.erb
+++ b/app/views/dmsf_files/show.html.erb
@@ -24,17 +24,18 @@
<% if @file_manipulation_allowed %>
<% if @file.locked_for_user? %>
<% if User.current.allowed_to?(:force_file_unlock, @project) %>
- <%= link_to_if @file.unlockable?, l(:button_unlock), unlock_dmsf_files_path(id: @file,
- back_url: dmsf_file_path(id: @file)),
+ <%= link_to_if @file.unlockable?, sprite_icon('unlock', l(:button_unlock)),
+ unlock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)),
title: l(:title_unlock_file), class: 'icon icon-unlock' %>
<% end %>
<% else %>
<% if @file.locked? %>
- <%= link_to_if @file.unlockable?, l(:button_unlock), unlock_dmsf_files_path(id: @file,
- back_url: dmsf_file_path(id: @file)),
+ <%= link_to_if @file.unlockable?, sprite_icon('unlock', l(:button_unlock)),
+ unlock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)),
title: l(:title_unlock_file), class: 'icon icon-unlock' %>
<% else %>
- <%= link_to l(:button_lock), lock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)),
+ <%= link_to sprite_icon('lock', l(:button_lock)),
+ lock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)),
title: l(:title_lock_file), class: 'icon icon-lock' %>
<% end %>
<% if defined?(EasyExtensions) %>
diff --git a/app/views/dmsf_upload/_form.html.erb b/app/views/dmsf_upload/_form.html.erb
index 26c47545..6d66f195 100644
--- a/app/views/dmsf_upload/_form.html.erb
+++ b/app/views/dmsf_upload/_form.html.erb
@@ -113,7 +113,7 @@
<% if defined?(container) && container %>
- <%= link_to l(:label_link_from),
+ <%= link_to sprite_icon('add', l(:label_link_from)),
new_dmsf_link_path(project_id: project.id, type: 'link_from', container: container.class.name),
title: l(:title_create_link), class: 'icon icon-add file_selector', remote: true %>
diff --git a/app/views/dmsf_workflows/_assign.html.erb b/app/views/dmsf_workflows/_assign.html.erb
index 86e0018d..83d8fd2f 100644
--- a/app/views/dmsf_workflows/_assign.html.erb
+++ b/app/views/dmsf_workflows/_assign.html.erb
@@ -32,7 +32,8 @@
<% if (!remote) && User.current.allowed_to?(:manage_workflows, @project) %>
- <%= link_to l(:label_dmsf_workflow_new), new_dmsf_workflow_path(project_id: @project.id), class: 'icon icon-add' %>
+ <%= link_to sprite_icon('add', l(:label_dmsf_workflow_new)), new_dmsf_workflow_path(project_id: @project.id),
+ class: 'icon icon-add' %>
<% end %>
diff --git a/app/views/dmsf_workflows/_main.html.erb b/app/views/dmsf_workflows/_main.html.erb
index 33f9a0e2..50eb8579 100644
--- a/app/views/dmsf_workflows/_main.html.erb
+++ b/app/views/dmsf_workflows/_main.html.erb
@@ -23,13 +23,13 @@
<% @workflows = DmsfWorkflow.status(@status).where(project_id: @project.id).sorted %>
<% @path = settings_project_path(@project, tab: 'dmsf_workflow') %>
- <%= link_to l(:label_dmsf_workflow_new), new_dmsf_workflow_path(project_id: @project&.id), class: 'icon icon-add',
- data: { cy: "button__new--dmsf-workflow" } %>
+ <%= link_to sprite_icon('add', l(:label_dmsf_workflow_new)), new_dmsf_workflow_path(project_id: @project&.id),
+ class: 'icon icon-add', data: { cy: "button__new--dmsf-workflow" } %>
<% else %>
- <%= link_to l(:label_dmsf_workflow_new), new_dmsf_workflow_path(project_id: @project&.id), class: 'icon icon-add',
- data: { cy: "button__new--dmsf-workflow" } %>
+ <%= link_to sprite_icon('add', l(:label_dmsf_workflow_new)), new_dmsf_workflow_path(project_id: @project&.id),
+ class: 'icon icon-add', data: { cy: "button__new--dmsf-workflow" } %>
<%= l(:label_dmsf_workflow_plural) %>
<% end %>
@@ -63,11 +63,13 @@
<% url = { controller: 'dmsf_workflows', action: 'update', id: workflow.id } %>
<% if workflow.locked? %>
- <%= link_to l(:button_unlock), url.merge(dmsf_workflow: { status: DmsfWorkflow::STATUS_ACTIVE }),
- method: :put, class: 'icon icon-unlock' %>
+ <%= link_to sprite_icon('unlock', l(:button_unlock)),
+ url.merge(dmsf_workflow: { status: DmsfWorkflow::STATUS_ACTIVE }), method: :put,
+ class: 'icon icon-unlock' %>
<% else %>
- <%= link_to l(:button_lock), url.merge(dmsf_workflow: { status: DmsfWorkflow::STATUS_LOCKED }),
- method: :put, class: 'icon icon-lock' %>
+ <%= link_to sprite_icon('lock', l(:button_lock)),
+ url.merge(dmsf_workflow: { status: DmsfWorkflow::STATUS_LOCKED }), method: :put,
+ class: 'icon icon-lock' %>
<% end %>
<%= delete_link dmsf_workflow_path(workflow, back_url: @path) %>
|
diff --git a/app/views/dmsf_workflows/_steps.html.erb b/app/views/dmsf_workflows/_steps.html.erb
index 49d36b11..e9236d53 100644
--- a/app/views/dmsf_workflows/_steps.html.erb
+++ b/app/views/dmsf_workflows/_steps.html.erb
@@ -34,8 +34,8 @@
- <%= link_to l(:dmsf_new_step_or_approver), new_step_dmsf_workflow_path(@dmsf_workflow), remote: true,
- class: 'icon icon-add' %>
+ <%= link_to sprite_icon('add', l(:dmsf_new_step_or_approver)), new_step_dmsf_workflow_path(@dmsf_workflow),
+ remote: true, class: 'icon icon-add' %>
<% steps = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq %>
<% if steps.any? %>
@@ -119,7 +119,7 @@
<%= reorder_handle(@dmsf_workflow, url: url_for(action: 'edit', id: @dmsf_workflow, step: i) ) %>
- <%= link_to_function l(:button_edit),
+ <%= link_to_function sprite_icon('edit', l(:button_edit)),
"$('#step-index-#{index}-name').hide(); $('#step-index-#{index}-approvers').hide(); $('#step-index-#{index}-name-form').show(); $('#step-index-#{index}-approvers-form').show();",
class: 'icon icon-edit' %>
<%= delete_link edit_dmsf_workflow_path(@dmsf_workflow, step: i,
diff --git a/assets/stylesheets/redmine_dmsf.css b/assets/stylesheets/redmine_dmsf.css
index 005da899..ee9a5ad2 100644
--- a/assets/stylesheets/redmine_dmsf.css
+++ b/assets/stylesheets/redmine_dmsf.css
@@ -150,8 +150,7 @@ div[id*="revision_access_"] {
}
/* Command icons */
-.dmsf-icon-link { background-image: url("../../../images/link.png"); }
-.icon-approvalworkflows { background-image: url("../../../images/ticket_go.png"); }
+.dmsf-icon-link:not(:has(svg)) { background-image: url("../../../images/link.png"); }
/* File types */
.dmsf-icon-file{
diff --git a/test/integration/webdav/dmsf_webdav_head_test.rb b/test/integration/webdav/dmsf_webdav_head_test.rb
index 70340ce6..c2e93422 100644
--- a/test/integration/webdav/dmsf_webdav_head_test.rb
+++ b/test/integration/webdav/dmsf_webdav_head_test.rb
@@ -30,83 +30,83 @@ class DmsfWebdavHeadTest < RedmineDmsf::Test::IntegrationTest
check_headers_dont_exist
end
- # def test_head_responds_with_authentication
- # head "/dmsf/webdav/#{@project1.identifier}", params: nil, headers: @admin
- # assert_response :success
- # check_headers_exist
- # with_settings plugin_redmine_dmsf: { 'dmsf_webdav_use_project_names' => '1', 'dmsf_webdav' => '1' } do
- # head "/dmsf/webdav/#{@project1.identifier}", params: nil, headers: @admin
- # assert_response :not_found
- # project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)
- # project1_uri = Addressable::URI.escape(project1_name)
- # head "/dmsf/webdav/#{project1_uri}", params: nil, headers: @admin
- # assert_response :success
- # end
- # end
- #
- # # NOTE: At present we use Rack to serve the file, this makes life easy however it removes the Etag
- # # header and invalidates the test - where as a folder listing will always not include a last-modified
- # # (but may include an etag, so there is an allowance for a 1 in 2 failure rate on (optionally) required
- # # headers)
- # def test_head_responds_to_file
- # head "/dmsf/webdav/#{@project1.identifier}/test.txt", params: nil, headers: @admin
- # assert_response :success
- # check_headers_exist
- # with_settings plugin_redmine_dmsf: { 'dmsf_webdav_use_project_names' => '1', 'dmsf_webdav' => '1' } do
- # head "/dmsf/webdav/#{@project1.identifier}/test.txt", params: nil, headers: @admin
- # assert_response :conflict
- # project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)
- # project1_uri = Addressable::URI.escape(project1_name)
- # head "/dmsf/webdav/#{project1_uri}/test.txt", params: nil, headers: @admin
- # assert_response :success
- # end
- # end
- #
- # def test_head_responds_to_file_anonymous_other_user_agent
- # head "/dmsf/webdav/#{@project1.identifier}/test.txt", params: nil, headers: { HTTP_USER_AGENT: 'Other' }
- # assert_response :unauthorized
- # check_headers_dont_exist
- # end
- #
- # def test_head_fails_when_file_not_found
- # head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", params: nil, headers: @admin
- # assert_response :not_found
- # check_headers_dont_exist
- # end
- #
- # def test_head_fails_when_file_not_found_anonymous_other_user_agent
- # head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", params: nil, headers: { HTTP_USER_AGENT: 'Other' }
- # assert_response :unauthorized
- # check_headers_dont_exist
- # end
- #
- # def test_head_fails_when_folder_not_found
- # head '/dmsf/webdav/folder_not_here', params: nil, headers: @admin
- # assert_response :not_found
- # check_headers_dont_exist
- # end
- #
- # def test_head_fails_when_folder_not_found_anonymous_other_user_agent
- # head '/dmsf/webdav/folder_not_here', params: nil, headers: { HTTP_USER_AGENT: 'Other' }
- # assert_response :unauthorized
- # check_headers_dont_exist
- # end
- #
- # def test_head_fails_when_project_is_not_enabled_for_dmsf
- # head "/dmsf/webdav/#{@project2.identifier}/test.txt", params: nil, headers: @jsmith
- # assert_response :not_found
- # check_headers_dont_exist
- # end
- #
- # def test_head_file_in_subproject
- # head "/dmsf/webdav/#{@project1.identifier}/#{@project5.identifier}/#{@file12.name}", params: nil, headers: @admin
- # assert_response :success
- # end
- #
- # def test_head_folder_in_subproject
- # head "/dmsf/webdav/#{@project1.identifier}/#{@project5.identifier}/#{@folder10.title}",
- # params: nil,
- # headers: @admin
- # assert_response :success
- # end
+ def test_head_responds_with_authentication
+ head "/dmsf/webdav/#{@project1.identifier}", params: nil, headers: @admin
+ assert_response :success
+ check_headers_exist
+ with_settings plugin_redmine_dmsf: { 'dmsf_webdav_use_project_names' => '1', 'dmsf_webdav' => '1' } do
+ head "/dmsf/webdav/#{@project1.identifier}", params: nil, headers: @admin
+ assert_response :not_found
+ project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)
+ project1_uri = Addressable::URI.escape(project1_name)
+ head "/dmsf/webdav/#{project1_uri}", params: nil, headers: @admin
+ assert_response :success
+ end
+ end
+
+ # NOTE: At present we use Rack to serve the file, this makes life easy however it removes the Etag
+ # header and invalidates the test - where as a folder listing will always not include a last-modified
+ # (but may include an etag, so there is an allowance for a 1 in 2 failure rate on (optionally) required
+ # headers)
+ def test_head_responds_to_file
+ head "/dmsf/webdav/#{@project1.identifier}/test.txt", params: nil, headers: @admin
+ assert_response :success
+ check_headers_exist
+ with_settings plugin_redmine_dmsf: { 'dmsf_webdav_use_project_names' => '1', 'dmsf_webdav' => '1' } do
+ head "/dmsf/webdav/#{@project1.identifier}/test.txt", params: nil, headers: @admin
+ assert_response :conflict
+ project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)
+ project1_uri = Addressable::URI.escape(project1_name)
+ head "/dmsf/webdav/#{project1_uri}/test.txt", params: nil, headers: @admin
+ assert_response :success
+ end
+ end
+
+ def test_head_responds_to_file_anonymous_other_user_agent
+ head "/dmsf/webdav/#{@project1.identifier}/test.txt", params: nil, headers: { HTTP_USER_AGENT: 'Other' }
+ assert_response :unauthorized
+ check_headers_dont_exist
+ end
+
+ def test_head_fails_when_file_not_found
+ head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", params: nil, headers: @admin
+ assert_response :not_found
+ check_headers_dont_exist
+ end
+
+ def test_head_fails_when_file_not_found_anonymous_other_user_agent
+ head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", params: nil, headers: { HTTP_USER_AGENT: 'Other' }
+ assert_response :unauthorized
+ check_headers_dont_exist
+ end
+
+ def test_head_fails_when_folder_not_found
+ head '/dmsf/webdav/folder_not_here', params: nil, headers: @admin
+ assert_response :not_found
+ check_headers_dont_exist
+ end
+
+ def test_head_fails_when_folder_not_found_anonymous_other_user_agent
+ head '/dmsf/webdav/folder_not_here', params: nil, headers: { HTTP_USER_AGENT: 'Other' }
+ assert_response :unauthorized
+ check_headers_dont_exist
+ end
+
+ def test_head_fails_when_project_is_not_enabled_for_dmsf
+ head "/dmsf/webdav/#{@project2.identifier}/test.txt", params: nil, headers: @jsmith
+ assert_response :not_found
+ check_headers_dont_exist
+ end
+
+ def test_head_file_in_subproject
+ head "/dmsf/webdav/#{@project1.identifier}/#{@project5.identifier}/#{@file12.name}", params: nil, headers: @admin
+ assert_response :success
+ end
+
+ def test_head_folder_in_subproject
+ head "/dmsf/webdav/#{@project1.identifier}/#{@project5.identifier}/#{@folder10.title}",
+ params: nil,
+ headers: @admin
+ assert_response :success
+ end
end
|