REFACTOR O' DOOM ++ fix issues with de-duplication in Dynamic Fast & Dynamic Slow

GOODBYE `TemplateDeduping`, BANE OF MY LIFE

Also reduces number of parameters we have to pass between templates.

Also reduces duplication between templates.

Also moves the resolver into pure Scala instead of that weird template.

Also gets rid of a lot of the crap we had to do to produce the index for the AJAX updates to fronts.

Also fixes the issue where items that appear in Dynamic/Fast and Dynamic/Slow containers are not de-duplicated from fixed containers further down the page.

There's a bunch of things it doesn't fix that I want to go back to:

* Still some duplication between top level templates for containers. We need to consolidate them (see TODOs)
* Still nasty we have to pass the CollectionConfig all the way down to the item. The reason is it's used in the Kicker stuff. We should probably generate the Kicker pre-emptively in the Scala so that we could get rid of that. That can be a different refactor, though.

CC @phamann 
I went through this with Theresa. She says remove dupes completely. Even if
that means there are no longer "enough" items in the container; it's the
editors responsibility to keep enough in there.

On 30 October 2014 09:10, Rob Berry <notifications@github.com> wrote:

> In common/app/layout/Front.scala:
>
> > +          * Containers will not be duplicated further down on the page, they themselves retain all their trails, no
> > +          * matter what occurred further up the page.
> > +          */
> > +        dynamicContainer.containerDefinitionFor(
> > +          trails.collect({ case content: Content => content }).map(Story.fromContent)
> > +        ) map { containerDefinition =>
> > +          (seen ++ trails.map(_.url).take(itemsVisible(containerDefinition)), trails)
> > +        } getOrElse {
> > +          (seen, trails)
> > +        }
> > +
> > +      case Fixed(containerDefinition) =>
> > +        /** Fixed Containers participate in de-duplication.
> > +          *
> > +          * If any items in the container have appeared previously, they're shoved to the end of the container (the idea
> > +          * being that they disappear beyond the fold, i.e., after the 'show more' button).
>
> I think this is what was happening based on the code that was there
> before, but it doesn't sound like that's what anyone's expecting. I'll
> change this to delete the trails.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/guardian/frontend/pull/6848/files#r19603099>.
>

-- 

------------------------------
Visit theguardian.com. On your mobile and tablet, download the Guardian 
iPhone and Android apps theguardian.com/guardianapp and our tablet editions 
theguardian.com/editions.  Save up to 57% by subscribing to the Guardian 
and Observer - choose the papers you want and get full digital access. 
 Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also be 
privileged. If you are not the named recipient, please notify the sender 
and delete the e-mail and all attachments immediately. Do not disclose the 
contents to another person. You may not use the information for any 
purpose, or store, or copy, it in any way.  Guardian News & Media Limited 
is not liable for any computer viruses or other material transmitted with 
or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered 
Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered 
in England Number 908396