Update description cell renderer [SCI-11823]

This commit is contained in:
Anton 2025-04-17 15:13:46 +02:00
parent 3e2a71b00e
commit 968fad5ca8
4 changed files with 38 additions and 23 deletions

View file

@ -1,32 +1,39 @@
<template>
<template v-if="params.dtComponent.currentViewRender === 'table'">
<div class="group relative flex items-center group-hover:marker text-xs h-full w-full leading-[unset]">
<div ref="descripitonBox" class="flex gap-2 w-full items-center text-sm leading-[unset]">
<span class="cursor-pointer line-clamp-1 leading-[unset]"
@click.stop="showDescriptionModal">
{{ params.data.description }}
</span>
<span @click.stop="showDescriptionModal" class="text-sn-blue cursor-pointer shrink-0 inline-block text-sm leading-[unset]">
{{ i18n.t('experiments.card.more') }}
</span>
</div>
</div>
</template>
<template v-else>
<div class="group relative flex items-center group-hover:marker text-xs h-full w-full">
<div ref="descripitonBox" class="flex gap-2 w-full items-end text-xs">
<span v-if="shouldTruncateText"
class="cursor-pointer grow line-clamp-2"
<div v-if="!params.data.folder">
<template v-if="params.dtComponent.currentViewRender === 'table'">
<div class="group relative flex items-center group-hover:marker text-xs h-full w-full leading-[unset]">
<div ref="descripitonBox" class="flex gap-2 w-full items-center text-sm leading-[unset]">
<span class="cursor-pointer line-clamp-1 leading-[unset]"
@click.stop="showDescriptionModal">
{{ params.data.description }}
</span>
<span v-else class="grow">{{ params.data.description }}</span>
<span v-if="shouldTruncateText" @click.stop="showDescriptionModal" class="text-sn-blue cursor-pointer shrink-0 inline-block text-xs">
<span v-if="!params.data.permissions.manage || (params.data.description && params.data.description.length > 0)"
@click.stop="showDescriptionModal"
class="text-sn-blue cursor-pointer shrink-0 inline-block text-sm leading-[unset]">
{{ i18n.t('experiments.card.more') }}
</span>
<span v-else @click.stop="showDescriptionModal" class="text-sn-blue cursor-pointer shrink-0 inline-block text-sm leading-[unset]">
{{ i18n.t('experiments.card.add_description') }}
</span>
</div>
</div>
</template>
</template>
<template v-else>
<div class="group relative flex items-center group-hover:marker text-xs h-full w-full">
<div ref="descripitonBox" class="flex gap-2 w-full items-end text-xs">
<span v-if="shouldTruncateText"
class="cursor-pointer grow line-clamp-2"
@click.stop="showDescriptionModal">
{{ params.data.description }}
</span>
<span v-else class="grow">{{ params.data.description }}</span>
<span v-if="shouldTruncateText" @click.stop="showDescriptionModal" class="text-sn-blue cursor-pointer shrink-0 inline-block text-xs">
{{ i18n.t('experiments.card.more') }}
</span>
</div>
</div>
</template>
</div>
</template>
<script>

View file

@ -8,7 +8,7 @@ module Lists
include ActionView::Helpers::TextHelper
attributes :name, :code, :created_at, :updated_at, :workflow_img, :description, :completed_tasks,
:total_tasks, :archived_on, :urls, :sa_description, :default_public_user_role_id, :team,
:total_tasks, :archived_on, :urls, :sa_description, :default_public_user_role_id, :team, :permissions,
:top_level_assignable, :hidden, :archived, :project_id, :due_date_cell, :start_date_cell, :status_cell
def created_at
@ -109,6 +109,12 @@ module Lists
}
end
def permissions
{
manage: can_manage_experiment?(object)
}
end
private
def due_date

View file

@ -142,7 +142,8 @@ module Lists
def permissions
{
create_comments: project? ? can_create_project_comments?(object) : false,
manage_users_assignments: project? ? can_manage_project_users?(object) : false
manage_users_assignments: project? ? can_manage_project_users?(object) : false,
manage: (project? ? can_manage_project?(object) : can_manage_team?(object.team))
}
end

View file

@ -1726,6 +1726,7 @@ en:
completed_value: "%{completed}/%{all} tasks"
description: "Description"
more: "more"
add_description: "Add description"
index:
edit_option: "Edit"
clone_option: "Duplicate"