Easy tests

This commit is contained in:
Karel Pičman 2023-04-12 10:34:50 +02:00
parent b42bc6a037
commit 6397c092a6
5 changed files with 40 additions and 18 deletions

View File

@ -21,7 +21,7 @@
class DmsfFolderPermissionsController < ApplicationController
before_action :find_folder, only: [:destroy, :new, :autocomplete_for_user], if: -> { params[:dmsf_folder_id].present?}
before_action :find_folder, only: [:destroy, :new, :autocomplete_for_user], if: -> { params[:dmsf_folder_id].present? }
before_action :find_project
before_action :authorize
before_action :permissions

View File

@ -25,13 +25,17 @@
<% html_title l(:dmsf) %>
<% if @project %>
<div class="contextual">
<% unless @locked_for_user || @system_folder %>
<% unless @locked_for_user || @system_folder %>
<% if @file_manipulation_allowed %>
<%= link_to l(:label_document_new), multi_dmsf_upload_path(id: @project, folder_id: @folder),
class: 'icon icon-add' %>
class: 'icon icon-add',
data: { cy: 'button__new-file--dmsf' } %>
<% end %>
<% if @folder_manipulation_allowed %>
<%= link_to l(:link_create_folder), new_dmsf_path(id: @project, parent_id: @folder), class: 'icon icon-add' %>
<%= link_to l(:link_create_folder),
new_dmsf_path(id: @project, parent_id: @folder),
class: 'icon icon-add',
data: { cy: 'button__create-folder--dmsf' } %>
<% end %>
<% end %>
<% if defined?(EasyExtensions) %>

View File

@ -22,24 +22,31 @@
<% if folder_manipulation_allowed && !system_folder %>
<% if folder.nil? %>
<%= link_to l(:button_edit), edit_root_dmsf_path(id: project),
<%= link_to l(:button_edit),
edit_root_dmsf_path(id: project),
title: l(:link_edit, title: l(:link_documents)),
class: 'icon icon-edit' %>
class: 'icon icon-edit',
data: { cy: 'button__edit--dmsf' } %>
<% elsif !locked_for_user %>
<%= link_to 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' %>
class: 'icon icon-edit',
data: { cy: 'button__edit--dmsf' } %>
<% end %>
<% if folder && (!locked_for_user || User.current.allowed_to?(:force_file_unlock, project)) %>
<% if folder.locked? %>
<%= link_to_if folder.unlockable?, l(:button_unlock),
<%= link_to_if folder.unlockable?,
l(:button_unlock),
unlock_dmsf_path(id: project, folder_id: folder, current: request.url),
title: l(:title_unlock_folder), class: 'icon icon-unlock' %>
title: l(:title_unlock_folder),
class: 'icon icon-unlock',
data: { cy: 'button__unlock--dmsf' } %>
<% else %>
<%= link_to(l(:button_lock),
<%= link_to l(:button_lock),
lock_dmsf_path(id: project, folder_id: folder, current: request.url),
title: l(:title_lock_folder), class: 'icon icon-lock') %>
title: l(:title_lock_folder), class: 'icon icon-lock',
data: { cy: 'button__lock--dmsf' } %>
<% end %>
<% end %>
<% if notifications %>
@ -47,24 +54,32 @@
<%= link_to l(:label_notifications_off),
notify_deactivate_dmsf_path(id: project, folder_id: folder),
title: l(:title_notifications_active_deactivate),
class: 'icon icon-email' %>
class: 'icon icon-email',
data: { cy: 'button__notifications-off--dmsf' } %>
<% else %>
<%= link_to 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' %>
class: 'icon icon-email-add',
data: { cy: 'button__notifications-on--dmsf' } %>
<% end %>
<% end %>
<% if file_manipulation_allowed && !locked_for_user %>
<%= link_to 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),
class: 'icon dmsf-icon-link' %>
type: 'link_from'),
title: l(:title_create_link),
class: 'icon dmsf-icon-link',
data: { cy: 'button__create-link--dmsf' } %>
<% end %>
<% end %>
<%= render partial: 'dmsf_context_menus/watch', locals: { object: folder ? folder : project } %>
<% if trash_enabled %>
<%= link_to l(:link_trash_bin), trash_dmsf_path(project), title: l(:link_trash_bin), class: 'icon icon-del' %>
<%= link_to l(:link_trash_bin),
trash_dmsf_path(project),
title: l(:link_trash_bin),
class: 'icon icon-del',
data: { cy: 'button__trash--dmsf' } %>
<% else %>
<span class="icon icon-del">
<%= l(:link_trash_bin) %>

View File

@ -34,6 +34,6 @@
</span>
</div>
<div class="form-actions">
<%= submit_tag l(:label_upload), class: 'button-positive' %>
<%= submit_tag l(:label_upload), data: { cy: 'button__submit__dmsf-upload--project' }, class: 'button-positive' %>
</div>
<% end %>

View File

@ -45,7 +45,10 @@
<% end %>
<% end %>
<div class="form-actions">
<%= submit_tag l(:label_upload), class: 'button-positive', onclick: "$('#ajax-indicator').show();" %>
<%= submit_tag l(:label_upload),
data: { cy: 'button__submit__upload-file--project' },
class: 'button-positive',
onclick: "$('#ajax-indicator').show();" %>
</div>
<% end %>
<% end %>