From 6397c092a629285657a953840dba6c9a5fdc1a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 12 Apr 2023 10:34:50 +0200 Subject: [PATCH] Easy tests --- .../dmsf_folder_permissions_controller.rb | 2 +- app/views/dmsf/_main.html.erb | 10 +++-- app/views/dmsf_context_menus/_main.html.erb | 39 +++++++++++++------ app/views/dmsf_upload/multi_upload.html.erb | 2 +- app/views/dmsf_upload/upload_files.html.erb | 5 ++- 5 files changed, 40 insertions(+), 18 deletions(-) diff --git a/app/controllers/dmsf_folder_permissions_controller.rb b/app/controllers/dmsf_folder_permissions_controller.rb index b815cb4d..72c0556a 100644 --- a/app/controllers/dmsf_folder_permissions_controller.rb +++ b/app/controllers/dmsf_folder_permissions_controller.rb @@ -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 diff --git a/app/views/dmsf/_main.html.erb b/app/views/dmsf/_main.html.erb index 97ee2199..65f55054 100644 --- a/app/views/dmsf/_main.html.erb +++ b/app/views/dmsf/_main.html.erb @@ -25,13 +25,17 @@ <% html_title l(:dmsf) %> <% if @project %>
- <% 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) %> diff --git a/app/views/dmsf_context_menus/_main.html.erb b/app/views/dmsf_context_menus/_main.html.erb index a9a842a4..76b7734c 100644 --- a/app/views/dmsf_context_menus/_main.html.erb +++ b/app/views/dmsf_context_menus/_main.html.erb @@ -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 %> <%= l(:link_trash_bin) %> diff --git a/app/views/dmsf_upload/multi_upload.html.erb b/app/views/dmsf_upload/multi_upload.html.erb index 1c8ea77a..3bf38d0d 100644 --- a/app/views/dmsf_upload/multi_upload.html.erb +++ b/app/views/dmsf_upload/multi_upload.html.erb @@ -34,6 +34,6 @@
- <%= submit_tag l(:label_upload), class: 'button-positive' %> + <%= submit_tag l(:label_upload), data: { cy: 'button__submit__dmsf-upload--project' }, class: 'button-positive' %>
<% end %> diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb index 5a228e88..7a5a7621 100644 --- a/app/views/dmsf_upload/upload_files.html.erb +++ b/app/views/dmsf_upload/upload_files.html.erb @@ -45,7 +45,10 @@ <% end %> <% end %>
- <%= 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();" %>
<% end %> <% end %>