OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Placement bug display type bug #2411

Open orchardbot opened 12 years ago

orchardbot commented 12 years ago

Znowman created: https://orchard.codeplex.com/workitem/18584

I have a blog and a blogpost with the following placement:

<Match ContentType="BlogPost">
    <Match displayType="Detail">
      <Place Parts_Common_Body="Content:1"/>
    </Match>
    <Match displayType="SummarySmall">
      <Place Parts_Title="Content:1;Alternate=BlogPostSummarySmallTitle"/>
      <Place Parts_Common_Body="-"/>
      <Place Parts_Common_Body_Summary="Content:2;Alternate=Parts_Common_Body_Summary-BlogPost"/>
    </Match> 
  </Match>

The strange thing is that in DisplayType Detail the rules of SummarySmall are picked also. Is this a known bug of placement (using orchard 1.4) that it's mixing up the placement of different displaytypes?

orchardbot commented 12 years ago

@bleroy commented:

There is a workaround, which is to use two non-nested matches with both criteria on.

orchardbot commented 12 years ago

Znowman commented:

The following is indeed a workarround but it's still a bug. It quiet confusing and I think esspecially when you are new with Orchard.

<Match ContentType="BlogPost" displayType="SummarySmall">   
      <Place Parts_Title="Content:1;Alternate=BlogPostSummarySmallTitle"/>
      <Place Parts_Common_Body="-"/>
      <Place Parts_Common_Body_Summary="Content:2;Alternate=Parts_Common_Body_Summary-BlogPost"/>
  </Match>

  <Match ContentType="BlogPost" displayType="Detail"> 
      <Place Parts_Title="Content:1"/>
      <Place Parts_Common_Body="Content:2"/>
      <Place Parts_Common_Body_Summary="-" />   
  </Match>

  <Match ContentType="BlogPost" displayType="Summary">
      <Place Parts_Common_Body_Summary="Content:2;Alternate=Parts_Common_Body_Summary-BlogPost"/>
      <Place Parts_Common_Body="-"/>
      <Place Parts_Title="-"/>
  </Match>
orchardbot commented 12 years ago

Znowman commented:

well after some examination the workaround doesn't work for all cases. So I think this is quiet critical because it's such a basic feature of orchard.

orchardbot commented 12 years ago

AimOrchard commented:

So the bug is that you cannot nest multiple DisplayType matches inside a ContentType match in general or..?

orchardbot commented 12 years ago

Znowman commented:

Ok this is really strange. The next day if suddenly works without any changes to the code. Maybe some temp file has updated finally or something? How can i trigger this? Can I delete a file so that the placement info is updated?

orchardbot commented 12 years ago

Znowman commented:

Oops no I look a the wrong page. The problem is still there! I do nothing special. I have a recent blog post widget and a news page which show summary items of blogpost. The problem exists when you open a blog post in detail displaytype mode. Then there's no way i can show the title and the body is only in summary mode.

<Match ContentType="BlogPost" displayType="Detail">
    <Place Parts_Title="Content:1"/>
    <Place Parts_Common_Body="Content:2"/>
    <Place Parts_Common_Body_Summary="-" />
    <Place Parts_Blogs_Blog_Description="Content:2"/>
  </Match>
  <Match ContentType="BlogPost" displayType="Summary">
    <Place Parts_Common_Body_Summary="Content:2;Alternate=Parts_Common_Body_Summary-BlogPost"/>
    <Place Parts_Common_Body="-"/>
    <Place Parts_Title="-"/>
  </Match>
orchardbot commented 12 years ago

Znowman commented:

I have used the path (path="/news" etc.) criteria as a workaround but that's very nasty because i have to copy each match tag for each culture specific path. You will see the problem when you view the details page of a blog item and a recent blog posts widget placed on the right. It is overriding each others placement.