hiding added fields in detail view

Topics: Administration, General
May 6, 2012 at 3:17 PM

I have a 'content type' with 3 fields added (2*text, 1* Media picker field)
This contentype is used in a 'Projector' and I would like, for the details view, hide all added fields.

In 'Placement.info' I can hide the two 'Text' fields:
<Match DisplayType="Summary">
            <Place Parts_Tags_ShowTags="Nowhere"
                   Parts_Common_Metadata_Summary="Nowhere"
                    Parts_BingMap="Nowhere"
                    Fields_Common_Text="Nowhere"
                    />
        </Match>
? However, how do I hide the Image field (Media Picker Field)?
? or, is there a more elegant way to ONLY have the title in the details view ?

I tested with all kind of variations like below:
 Fields_Common_Media="Nowhere"

Thanks for your time and hints
ed

Developer
May 6, 2012 at 4:16 PM

I believe the shape you need to hide is: "Fields_MediaPicker". So your placement should look like this:

  

<Match DisplayType="Summary">
            <Place Parts_Tags_ShowTags="Nowhere"
                   Parts_Common_Metadata_Summary="Nowhere"
                    Parts_BingMap="Nowhere"
                    Fields_Common_Text="Nowhere"
                    Fields_MediaPicker="-"
              />
</Match>

You could also hide each individual media picker field if desired:

<Match DisplayType="Summary">
            <Place Parts_Tags_ShowTags="Nowhere"
                   Parts_Common_Metadata_Summary="Nowhere"
                    Parts_BingMap="Nowhere"
                    Fields_Common_Text="Nowhere"
                    Fields_MediaPicker-MyFirstMediaFied="-"
                    Fields_MediaPicker-MySecondMediaFied="-"
              />
</Match>


 

May 6, 2012 at 4:24 PM

thanks, yes that does it!

apropos my:   ? or, is there a more elegant way to ONLY have the title in the details view ?
Just found in the queries layout using properties instead of content plus some other tweaking does the job!

PS: there is still alot to learn
thanks for your time, ed

Developer
May 6, 2012 at 4:51 PM
Edited May 6, 2012 at 4:52 PM

There is another, perhaps even more elegant, way which is to override the template that is used to render your content. In your overridden template, you simply render the title, nothing else.

For example, if your content type is called "Event", you could create a razor template named "Content-Event.Detail.cshtml", with the following content to just display the title:

<h1>@Model.TitlePart.Title</h1>

Assuming that your content type has a TitlePart.

And yes, there's a lot to learn :)

 

May 8, 2012 at 10:01 PM

If you go down the @sfmskywalker route you may have to access the property like so:

@Model.ContentItem.Get(typeof(YourPart)).SomeProp