Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set edit mode and save content to selected persona #16767

Closed
fmontes opened this issue Jun 20, 2019 · 2 comments
Closed

Set edit mode and save content to selected persona #16767

fmontes opened this issue Jun 20, 2019 · 2 comments

Comments

@fmontes
Copy link
Member

fmontes commented Jun 20, 2019

As a page editor, I want to create a version of the page for a specific persona to target my site better.

Describe the solution you'd like

As right now, we can preview the page as a persona by selecting it in the dropdown but when we do changes to the pages those changes are saved for the default persona.

By using the new persona selector we can select a persona and when click EDIT we start editing the page for the selected persona.

The flow

  1. We open the page as default persona
  2. If we're in PREVIEW and we select a persona: we stay in preview and refresh the page (this is already happening)
  3. If we're in EDIT and select a persona:
    a. If the persona selected have a personalized: true, we refresh the page and leave the mode in EDIT and we start saving content for this persona.
    b. If the persona selected have a personalized: false, we refresh the page and set the mode to PREVIEW for the selected persona. At this point, user could click EDIT to trigger the personalization.

Task Flow-Personalization

Create a personalized version of the page

The trigger is when a persona with personalized: false is selected and the user click on EDIT, we show a dialog that reads more or less: "Are you sure you want to create a custom version of the page for Selected Persona?"

  1. Accept: We need to hit an endpoint to copy the page for this persona and from now on we have to submit the personaTag to the save content endpoint.
  2. Cancel: We select default persona, refresh the page and set the mode to EDIT.

Technical Approach

There is an endpoint for "personalize a page for a persona", you need to do a POST like:

url: `/api/v1/personalization/pagepersonas`,
body: {
    pageId,
    personaTag
}

Now to save content to the selected persona we use the same endpoint we're using but passing the selected personaTag:

url: `/api/v1/page/pageId/content`,
body: [
    { 
        personaTag: "FirstTimeInvestor",
        identifier: 'containerIdentifier2', 
        uuid: '1',
        contentletsId: [
            'contentletId2'
        ]
    },
    {
        personaTag: "FirstTimeInvestor",
        identifier: 'containerIdentifier2',
        uuid: '1',
        contentletsId: [
            'contentletId1',
            'contentletId2',
            'contentletIdN'
        ]
    }
];

To save content to Default Persona we just don't pass the personaTag

Additional context

Add any other context or screenshots about the feature request here.

Acceptance Criteria

  1. Allow user to create and edit personalized version of a page for a selected persona
  2. Work in all the supported browsers (don't forget IE11 and iPad)
  3. Multilanguage
  4. Unit test
@fmontes fmontes added this to the Fox Current milestone Jun 20, 2019
@fmontes fmontes changed the title Set edit mode to selected persona Set edit mode and save content to selected persona Jun 24, 2019
jdotcms added a commit that referenced this issue Jul 15, 2019
jdotcms added a commit that referenced this issue Jul 16, 2019
jdotcms added a commit that referenced this issue Jul 19, 2019
jdotcms added a commit that referenced this issue Jul 22, 2019
jgambarios pushed a commit that referenced this issue Jul 22, 2019
* #16252 format source. Introduce format checker on build. Alter style … (#16288)

* #16252 format source. Introduce format checker on build. Alter style files

* #16252 remove unwanted file

* #16252 remove unwanted file

* Updating commit reference for src/main/enterprise

* try different location for checkstyle.xml

* Revert "#16252 format source. Introduce format checker on build. Alter style … (#16288)" (#16291)

This reverts commit 05f9082.

* Updating commit reference for src/main/enterprise

* #16767 changes requested from fox

* #16767 Formatting the page persona

* #16767 implementing the filter on the pagination for personas per page

* #16767 now the persona contentlet is being retrive as hydrated

* language key

* #16767 fixing the persona output on the page render

* #16767 removing merge stuff
@jgambarios
Copy link
Contributor

PR: #16854

@freddyucv freddyucv assigned freddyucv and unassigned freddyucv Jul 25, 2019
@fmontes fmontes assigned fmontes and unassigned freddyucv Jul 26, 2019
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 7, 2019
…1106)

* Update searchable styles
* Fix search placeholder in site selector
* Hack dot-persona-selector to make it show value
* First step... it works
* Make edit page listen to one observable
* Update reload and clean up model for personalized content
* Rename dot-page-render service and remove extra unused methods
* Set persona on the state form the toolbar, getting rid of all the extra events
* Set lang
* Set device and remove changeviewas event
* Update view as component name
* Fix saving messages
* Create page state controller and remove all the extra events
* Rename page layout service
* Rename page layout service instance
* Fix state and lock when page locked
* Catch errors
* Update page state set method
* Clean up page state service
* Create method to update local state
* Add back global messages to layout
* Clean up page render server params
* Clean up dot-page-render
* Default view as param
* Rename DotPageMode
* Fix persona selector
* Prevent have to do 2 clicks outside to close the persona selector overlay
* Clean up
* Fix persona selector option delete label
* Code review feedback 1
* Add messages keys
* Fix lock state when try to personalize and cancel
fmontes added a commit that referenced this issue Aug 12, 2019
fmontes added a commit that referenced this issue Aug 12, 2019
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 12, 2019
* Remove dot-edit-page-data.service in favor of dot-page-state.service
* Refresh persona listing when page change
* Add docs
* Add message keys to despersonalize dialog
* Fix pagination in persona selector
* Prevent emit of persona selected
* Refresh persona listing when despersonalize persona with Default persona selected
* Prevent extra request to the list personas when a personas get despersonalized
* Code review feedback 
* Fix message keys in view as controller
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 12, 2019
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 12, 2019
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 13, 2019
* Make tests run and update DotPageRenderService tests
* Update tests for DotEditPageToolbarComponent
* Clean up DotEditPageInfoComponent
* Clean up DotEditPageLockInfoComponent
* Create tests fro DotEditPageStateControllerComponent round 1
* Remove cache data service tests
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 14, 2019
* Update the persona selector label / fix message service error
* Fix bad merge
* Remove css important
* Pass full page state to persona selector
* Fix show lang selector when no license
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 14, 2019
* Reload in current mode
* Style toolbar
fmontes added a commit to dotCMS/core-web that referenced this issue Aug 14, 2019
jgambarios pushed a commit that referenced this issue Aug 22, 2019
* disabled persona-selector when the page does not have content

* testing

* Change hasContent for numberContents

* message

* refactoring

* fix

* fix

* fix
@jgambarios
Copy link
Contributor

PR: #17036

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants