Skip to content

Commit

Permalink
Merge branch 'develop' into feature/search-by-content-query
Browse files Browse the repository at this point in the history
  • Loading branch information
VargaJoe authored Oct 30, 2023
2 parents cf251da + 30960bd commit 1913c70
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 33 deletions.
22 changes: 22 additions & 0 deletions apps/sensenet/cypress/e2e/content/action_bar.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { PATHS, resolvePathParams } from '../../../src/application-paths'
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

describe('Action bar testing', () => {
beforeEach(() => {
cy.login()
cy.visit(
pathWithQueryParams({
path: resolvePathParams({ path: PATHS.content.appPath, params: { browseType: 'explorer' } }),
newParams: { repoUrl: Cypress.env('repoUrl'), path: '/SampleWorkspace/Document_Library' },
}),
)
})

it('should edit button show in action bar', () => {
cy.get('[data-test="menu-item-document-library"]').rightclick({ force: true })
cy.get('[data-test="content-context-menu-browse"]').click()
cy.get('[data-test="viewtitle-edit"]').should('be.visible').click()
cy.get('[data-test="viewtitle-details"]').should('be.visible').click()
cy.get('[data-test="viewtitle-edit"]').should('be.visible')
})
})
5 changes: 5 additions & 0 deletions apps/sensenet/src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DeleteOutlined,
DescriptionOutlined,
DomainOutlined,
Edit,
ErrorOutlined,
EventOutlined,
FiberNew,
Expand Down Expand Up @@ -173,6 +174,10 @@ const getIconByName = (name: string | undefined, options: IconOptions) => {
return <InlineIcon icon={vercelIcon} width="24" />
case 'Heroku':
return <InlineIcon icon={herokuIcon} height="24" />
case 'Edit':
return <Edit style={options.style} />
case 'Details':
return <Info style={options.style} />
default:
return null
}
Expand Down
2 changes: 1 addition & 1 deletion apps/sensenet/src/components/view-controls/browse-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const BrowseView: React.FC<BrowseViewProps> = (props) => {
...classes,
cancel: globalClasses.cancelButton,
}}
renderTitle={() => <ViewTitle title={'Info about'} titleBold={content?.DisplayName} content={content} />}
renderTitle={() => <ViewTitle actionName="browse" titleBold={content?.DisplayName} content={content} />}
/>
)
}
129 changes: 98 additions & 31 deletions apps/sensenet/src/components/view-controls/common/view-title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { useHistory } from 'react-router'
import { ResponsivePersonalSettings } from '../../../context'
import { useGlobalStyles } from '../../../globalStyles'
import { useSnRoute } from '../../../hooks'
import { getPrimaryActionUrl } from '../../../services'
import { getPrimaryActionUrl, getUrlForContent } from '../../../services'
import { Icon } from '../../Icon'

interface ViewTitleProps {
title: string
title?: string
titleBold?: string
content?: GenericContent
actionName?: string
}

const useStyles = makeStyles(() => {
Expand All @@ -22,10 +23,15 @@ const useStyles = makeStyles(() => {
height: '68px',
fontSize: '20px',
flexShrink: 0,
flexDirection: 'column',
flexWrap: 'nowrap',
},
textBolder: {
fontWeight: 500,
},
actionBar: {
display: 'flex',
},
})
})

Expand Down Expand Up @@ -57,37 +63,98 @@ export const ViewTitle: React.FunctionComponent<ViewTitleProps> = (props) => {

return (
<div className={clsx(classes.title, globalClasses.centered)}>
<span data-test="viewtitle">
<div data-test="viewtitle">
{props.title} <span className={classes.textBolder}>{props.titleBold}</span>
</span>
{props.content && (
<span
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,
}),
)
}}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '9px',
height: '24px',
width: '24px',
cursor: 'pointer',
</div>
<div className={classes.actionBar}>
{props.actionName === 'browse' && (
<span
data-test="viewtitle-edit"
title={`Open ${contentDisplayName} Edit Page`}
onClick={async () => {
history.push(
getUrlForContent({
content: props.content!,
uiSettings,
location: history.location,
action: 'edit',
snRoute,
removePath: true,
}),
)
}}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '4px',
marginRight: '4px',
height: '24px',
width: '24px',
cursor: 'pointer',
}}
item={{ Icon: 'Edit' }}
/>
</span>
)}
{props.actionName === 'edit' && (
<span
data-test="viewtitle-details"
title={`Open ${contentDisplayName} Details Page`}
onClick={async () => {
history.push(
getUrlForContent({
content: props.content!,
uiSettings,
location: history.location,
action: 'browse',
snRoute,
removePath: true,
}),
)
}}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '4px',
marginRight: '4px',
height: '24px',
width: '24px',
cursor: 'pointer',
}}
item={{ Icon: 'Details' }}
/>
</span>
)}
{props.content && (
<span
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,
}),
)
}}
item={{ ContentTypeName: 'ContentType' }}
/>
</span>
)}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '4px',
marginRight: '4px',
height: '24px',
width: '24px',
cursor: 'pointer',
}}
item={{ ContentTypeName: 'ContentType' }}
/>
</span>
)}
</div>
</div>
)
}
3 changes: 2 additions & 1 deletion apps/sensenet/src/components/view-controls/edit-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ export const EditView: React.FC<EditViewProps> = (props) => {
}}
renderTitle={() => (
<ViewTitle
title={props.actionName === 'browse' ? 'Info about' : 'Edit'}
title={props.actionName === 'browse' ? '' : 'Edit'}
titleBold={content?.DisplayName}
content={content}
actionName={props.actionName}
/>
)}
/>
Expand Down

0 comments on commit 1913c70

Please sign in to comment.