Related Content: Ability to relate any content object to one or more content objects

Description

Related Content: Ability to relate any content object to one or more content objects. In the page or entry managers have the ability to select other entries or pages.

ORM Model

Add to base content the ability to have a relatedContent one-to-many relationship which should point to itself.

UI

On the page, blog and content store UI, add a section or tab where you can relate content to the one you are editing or creating.

It would be nice to say relate and get a nice modal dialog of all Content Objects that are filterable with their types in a column. Then they can search for them, much how we do the linking already via the editors. Then once they select one, we just add a nice row in the UI saying this content is now related to the other content.

CBHelper

Add a new quick method to the the CB Helper to create a list of links to the related content: quickRelatedContent( content )

This should build a list much how we do the categories or archives widget, with those options as well.

Testing!

Related Content Section

On pages and entries add/edit page, a new section should appear in the right sidebar labeled Related Content. It should only be visible if the logged in user has the EDITORS_RELATED_CONTENT permission. If they do not, the a hidden field should still be submitted containing any related content IDs assigned to the content.

When adding related content, the "add" button should open a modal window which displays a searchable, paged list of

  • all published pages and entries for the site

  • excluding any related content already selected for the content

  • excluding the content item itself (if content is not new)

Clicking the select icon should close the modal and insert a new row into the main content page's related content section (hiding the "empty" message if it was there before).

Clicking the red - icon next to the attached related content should remove it from the list.

Finally, if one of the related content items becomes unpublished, it should be shaded pink in the list, denoting that it is unpublished.

Cloning

Cloning should work as expected. If Cloned Target A has 3 related content items, those same 3 related content items should appear on the cloned result.

Deleting

Deleting a content with related content is bi-directional since the content item you're deleting might be a related content item of another piece of content. To test that this works:

  • Create New Page A

    • Add related content items

  • Create New Page B

    • Add Page A as related content item to Page B

  • Delete Page A

  • Open Page B - Related content should not contain Page A

Export

Exporting gets a bit involved since it's possible to have two pieces of content that are mutually related. Originally this caused some deadly recursions, but I think that's squashed. To test exports:

  • Create Page A

  • Create Page B

  • Create Entry C

  • On Page A, relate Page B

  • On Page B, relate Entry C

  • On Page C, relate Page B

Export Page A, and feel free to analyze the results in your favorite json parser (like so: http://json.parser.online.fr/beta/)
It's difficult to fully test that it's successful without importing, so on to the next step!

Import

Presumably, the export, which includes the relatedContent, should be able to restore the full pages/entries, even if we only exported Page A.

So before importing, delete Page A, Page B, and Entry C.

Now try importing your Page A export. If everything works correctly, Page A, Page B, and Entry C should be restored and the relatedContent relationships between them should be what they were before deletion.

Export/Import Scenarios

Obviously, there could be much more exotic interconnectedness--the one above is just one example. Please try out some other non-scripted exports and see if everything appears to work as expected.

Attachments

1

Gliffy Diagrams

Activity

Show:

Luis MajanoMarch 31, 2014 at 5:41 PM

Joel, this is finalized right, can I close this ticket?

Luis MajanoFebruary 4, 2014 at 7:37 PM

Ahh I get it, I guess I just need a code review once I get back

Joel WatsonFebruary 4, 2014 at 7:23 PM

Linked Content idea

Joel WatsonFebruary 4, 2014 at 7:22 PM

Sorry, I wasn't clear on the linkedContent. I added the linkedContent property in order to be able to do what you're saying; before I had linkedContent, there would be foreign key constraint errors when deleting Page A if Page B had linked to Page A via relatedContent. So I added it to be able to do the bi-directional link breakages.

Re: the idea on the linkedContent, see the attached screen shot. Basically it would show you a summary of all the content across your site that current links to your content and allow you to remove that link. For example, let's say that Page B has the following related content:

  • Page A

  • Entry C

  • Entry D

When editing Page A, the Linked Content section will show every content item in the site that has Page A as related content. In this example, Page B would show up in the list. By clicking the link-break button, you could remove Page A from being related content on Page B any longer. Ultimately, it's equivalent to opening up Page B and removing Page A from the related content. But this allows you to do it much more efficiently if you know the content item that needs to be de-associated.

Luis MajanoFebruary 4, 2014 at 6:50 PM

On filtering, yes, I think it would be great to have the three content types filtered by tab.

As for the linkedContent property, did you try cleaning it? Meaning, before I sent a content object to be deleted, I manually clear the linked content array. Much like this:

As for the linkedContent, not sure where that plays into this? I only see it in the remove?

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Original estimate

Time tracking

No time logged3h remaining

Components

Priority

Sentry

Created February 12, 2013 at 6:57 AM
Updated April 4, 2014 at 12:19 AM
Resolved April 4, 2014 at 12:18 AM