From cf9f86b5d2353fd24c7615fedb80ce97f8adc4c6 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Thu, 4 May 2023 15:52:46 +0200 Subject: [PATCH] Fix project actions, fix edit icons [SCI-8391] --- app/services/toolbars/experiments_service.rb | 2 +- app/services/toolbars/my_modules_service.rb | 2 +- app/services/toolbars/projects_service.rb | 39 +++++++++++++------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/services/toolbars/experiments_service.rb b/app/services/toolbars/experiments_service.rb index 259e19fbb..bf820c8a9 100644 --- a/app/services/toolbars/experiments_service.rb +++ b/app/services/toolbars/experiments_service.rb @@ -56,7 +56,7 @@ module Toolbars { name: 'edit', label: I18n.t('experiments.index.edit_option'), - icon: 'fa fa-pen', + icon: 'fa fa-pencil-alt', button_class: 'edit-btn', path: edit_experiment_path(experiment), type: 'remote-modal' diff --git a/app/services/toolbars/my_modules_service.rb b/app/services/toolbars/my_modules_service.rb index 70de06baf..60fb7fee7 100644 --- a/app/services/toolbars/my_modules_service.rb +++ b/app/services/toolbars/my_modules_service.rb @@ -58,7 +58,7 @@ module Toolbars { name: 'edit', label: I18n.t('experiments.table.toolbar.edit'), - icon: 'fa fa-pen', + icon: 'fa fa-pencil-alt', button_id: 'editTask', type: :legacy } diff --git a/app/services/toolbars/projects_service.rb b/app/services/toolbars/projects_service.rb index a8e3d77b7..975da0148 100644 --- a/app/services/toolbars/projects_service.rb +++ b/app/services/toolbars/projects_service.rb @@ -31,12 +31,12 @@ module Toolbars return [] if @item_type == :none [ + restore_action, edit_action, access_action, move_action, export_action, archive_action, - restore_action, comments_action, activities_action, delete_folder_action @@ -48,20 +48,33 @@ module Toolbars def edit_action return unless @single - return unless @item_type == :project + if @items.first.is_a?(Project) + project = @items.first - project = @items.first + return unless can_manage_project?(project) - return unless can_manage_project?(project) + { + name: 'edit', + label: I18n.t('projects.index.edit_option'), + icon: 'fas fa-pencil-alt', + button_class: 'edit-btn', + path: edit_project_path(project), + type: :legacy + } + else + project_folder = @items.first - { - name: 'edit', - label: I18n.t('projects.index.edit_option'), - icon: 'fa fa-pen', - button_class: 'edit-btn', - path: edit_project_path(project), - type: :legacy - } + return unless can_create_project_folders?(project_folder.team) + + { + name: 'edit', + label: I18n.t('projects.index.edit_option'), + icon: 'fas fa-pencil-alt', + button_class: 'edit-btn', + path: edit_project_folder_path(project_folder), + type: :legacy + } + end end def access_action @@ -82,7 +95,7 @@ module Toolbars { name: 'access', label: I18n.t('general.access'), - icon: 'fa fa-door-open', + icon: 'fas fa-door-open', button_class: 'access-btn', path: path, type: 'remote-modal'