mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Add text shortening to the project name in the project list page.
This commit is contained in:
committed by
Tobias Dillmann
parent
82bdaa67ae
commit
90671ad3ee
@@ -154,19 +154,45 @@ module Projects
|
||||
end
|
||||
|
||||
def name
|
||||
content = [content_tag(:i, "", class: "projects-table--hierarchy-icon")]
|
||||
content = [
|
||||
hierarchy_icon,
|
||||
name_link_section,
|
||||
archived_label,
|
||||
workspace_type_badge
|
||||
].compact_blank
|
||||
|
||||
content << helpers.link_to_project(project, {}, { data: { turbo: false } }, false)
|
||||
safe_join(content)
|
||||
end
|
||||
|
||||
if project.archived?
|
||||
content << content_tag(:span, "(#{I18n.t('project.archive.archived')})", class: "archived-label")
|
||||
def hierarchy_icon
|
||||
content_tag(:i, "", class: "projects-table--hierarchy-icon")
|
||||
end
|
||||
|
||||
def name_link_section
|
||||
content_tag(:span, class: "projects-table--name-text") do
|
||||
helpers.link_to_project(project, {}, { data: { turbo: false } }, false)
|
||||
end
|
||||
end
|
||||
|
||||
if workspace_type_badge && OpenProject::FeatureDecisions.portfolio_models_active?
|
||||
content << workspace_type_badge
|
||||
def workspace_type_badge
|
||||
return unless OpenProject::FeatureDecisions.portfolio_models_active?
|
||||
# Only show icon and type for non-project workspaces
|
||||
return unless project.workspace_type.in?(["portfolio", "program"])
|
||||
|
||||
render(Primer::Beta::Text.new(classes: "projects-table--name-description")) do
|
||||
icon = render(Primer::Beta::Octicon.new(
|
||||
icon: helpers.workspace_icon(project.workspace_type),
|
||||
size: :xsmall
|
||||
))
|
||||
|
||||
safe_join([icon, " ", I18n.t(:"label_#{project.workspace_type}")])
|
||||
end
|
||||
end
|
||||
|
||||
safe_join(content, " ")
|
||||
def archived_label
|
||||
return unless project.archived?
|
||||
|
||||
content_tag(:span, "(#{I18n.t('project.archive.archived')})", class: "archived-label")
|
||||
end
|
||||
|
||||
def project_status
|
||||
@@ -429,18 +455,5 @@ module Projects
|
||||
def current_page
|
||||
table.model.current_page.to_s
|
||||
end
|
||||
|
||||
def workspace_type_badge
|
||||
# Only show icon and type for non-project workspaces
|
||||
return unless project.workspace_type.in?(["portfolio", "program"])
|
||||
|
||||
render(Primer::Beta::Text.new(classes: "description")) do
|
||||
icon = render(Primer::Beta::Octicon.new(
|
||||
icon: helpers.workspace_icon(project.workspace_type),
|
||||
size: :xsmall
|
||||
))
|
||||
safe_join([icon, " ", I18n.t(:"label_#{project.workspace_type}")])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,11 +75,11 @@ $content-padding: 10px
|
||||
color: var(--fgColor-muted)
|
||||
|
||||
td.name
|
||||
@include text-shortener
|
||||
a
|
||||
.projects-table--name-text
|
||||
@include text-shortener
|
||||
white-space: nowrap
|
||||
|
||||
.description
|
||||
.projects-table--name-description
|
||||
@extend %autocomplete-description
|
||||
|
||||
td.project--hierarchy
|
||||
|
||||
Reference in New Issue
Block a user