Show Image - MediaPickerField - in Projection

Topics: Administration, Customizing Orchard, General
Sep 26, 2012 at 4:03 PM

When Edit Query > Layout > Edit Properties > Rewrite Results (NOT checked: 'Exclude from Display') with 'Rewrite Results' like:
<img src="{Content.Fields.Parcours.Image.Url.Absolute}" width="130" height="100" />

I'm able to see the image, BUT ONLY in the 'Summary Screen'!
However, I would like to display it in the 'Details' screen ONLY!

I tried to tweak below 'Placement.info' without success. I.e. 'Fields_MediaPicker-Image="Content:7"'  only shows  'Image:  ~/Media/Default/ClubIdent/xyz.jpg' on the 'Summary' screen.

- is this possible at all ?
- what am I missing ?

any hints and your time are appreciated
ed

<Match ContentType="Parcours">
        <Match DisplayType="Detail">
            <Place Parts_Common_Body="Content:5"
                   Parts_Tags_ShowTags="Nowhere"
                   Parts_Common_Metadata="-"
                   Parts_BingMap="Content:6"
                   Fields_Common_Text="Nowhere"
                    Fields_MediaPicker-Image="Content:7"                 
                    />
        </Match>
        <Match DisplayType="Summary">
            <Place Parts_Tags_ShowTags="Nowhere"
                   Parts_Common_Metadata_Summary="Nowhere"
                    Parts_BingMap="-"
                     Fields_MediaPicker-Image="-"
                   
                    />
        </Match>
    </Match>

Developer
Sep 26, 2012 at 5:21 PM

The Layout properties of the projection won't have effect on the Detail display type of the field.

Instead, Create an alternate (or use shape tracing) in your CurrentTheme\Views : Fields.MediaPicker-Parcours-Image.cshtml


<img src="@Href(Model.ContentField.Url)" width="130" height="100" />

 


Sep 26, 2012 at 8:27 PM
Edited Sep 27, 2012 at 6:36 AM

thanks for your time

clearly I have to read more about this 'alternate' business (any doc recommended?)

After some detours, struggling, trial with the Placement.info file, all is now ok

thanks again for your hint on alternates, ed

Developer
Sep 27, 2012 at 10:15 AM

http://docs.orchardproject.net/Documentation/Alternates

Sep 27, 2012 at 8:06 PM

Hi,

edikaufmann

"After some detours, struggling, trial with the Placement.info file, all is now ok"

>> What did you change in the Placement.info?

>> can you share your updated code.

Sep 28, 2012 at 6:31 AM

well, the Placement.info is exactly as shown in my first msg, i.e.' ' Fields_MediaPicker-Image="Content:7" '

otherwise it's exactly as agriffard explains.

I was more struggling with the 'alternate' naming convention(s) and how to setup the 'queries' in a way that it only shows on the 'details' screen.

To prevent showing '~/Media/Default/ClubIdent/xyz.jpg'  on the details screen you need to check 'Exclude from Display' in the 'queries'.

To show the Image also on the 'details' screen:
Rewrite results: <img src="{Content.Fields.Parcours.Image.Url.Absolute}" width="130" height="100" />
uncheck 'exclude from display'
Placement.info: something like  Fields_MediaPicker-Image="Content:7 in the 'details' section

hope this helps, ed

 

 

 I.e. the 'Rewrite results' is not used at all.

Sep 28, 2012 at 6:42 AM

Hi ed,

Thank you for your time.

I dont find  'Exclude from Display' in part Query/Projection in dashboard.

What is 'Exclude from Display' is it a property from your image?

Best regards,

Alexandre

Sep 28, 2012 at 3:39 PM

assuming you use 'projection' and in turn  also 'queries'; then

goto dashboard:

- queries > Layout > Properties

in 'properties' you finf 'Exclude from Display'

good luck, ed