Skip to content

Commit

Permalink
Show Content Type in Title and Open CTD Editor on New Tab (#1599)
Browse files Browse the repository at this point in the history
* show type in title

* type beside the title

* open ctd editor on new tab

* fix: styling fix

---------

Co-authored-by: Ádám Hassan <hassana@sensenet.com>
  • Loading branch information
VargaJoe and hassanad94 committed Mar 13, 2024
1 parent c91948e commit ca7e501
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions apps/sensenet/src/components/view-controls/common/view-title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ const useStyles = makeStyles(() => {
actionBar: {
display: 'flex',
},
typeinfo: {
fontSize: '12px',
color: 'grey',
marginLeft: '5px',
},

viewTitle: {
'& span': {
display: 'inline-block',
verticalAlign: 'middle',
},
},
})
})

Expand Down Expand Up @@ -63,8 +75,9 @@ export const ViewTitle: React.FunctionComponent<ViewTitleProps> = (props) => {

return (
<div className={clsx(classes.title, globalClasses.centered)}>
<div data-test="viewtitle">
<div data-test="viewtitle" className={classes.viewTitle}>
{props.title} <span className={classes.textBolder}>{props.titleBold}</span>
<span className={classes.typeinfo}>({props.content!.Type})</span>
</div>
<div className={classes.actionBar}>
{props.actionName === 'browse' && (
Expand Down Expand Up @@ -130,16 +143,15 @@ export const ViewTitle: React.FunctionComponent<ViewTitleProps> = (props) => {
title={`Open ${contentDisplayName} CTD`}
onClick={async () => {
const content = await getContentTypeId(props.content!.Type)
history.push(
getPrimaryActionUrl({
content,
repository,
location: history.location,
uiSettings,
snRoute,
removePath: true,
}),
)
const url = getPrimaryActionUrl({
content,
repository,
location: history.location,
uiSettings,
snRoute,
removePath: true,
})
window.open(url, '_blank')
}}
className={globalClasses.centered}>
<Icon
Expand Down

0 comments on commit ca7e501

Please sign in to comment.