Saturday, 15 January 2011

orchardcms - Building a list of downloadable items in Orchard 1.6 -



orchardcms - Building a list of downloadable items in Orchard 1.6 -

i'm new orchard , i'm wondering "best" way of building basic list of documents download link?

say scenario this, want create list of newsletters, news letter in pdf format , users should able download straight list view. admin, should able add together new newsletter , should turn in list.

my current train of thought to, through dashboard,

create content type "newsletter" title field , media picker field, using media picker field upload pdf file. then create query, filter on content type "newsletter" create projection pointing query

however, gives me list of content items, showing title links actual content item.

i've tried adding layout query , set display properties instead of content. doing can list can command "output" bit more. , i've gotten list title , doing rewrite , putting in mediapicker.url, displays url in list. here stuck..

as mediapicker.url outputs url in format ~/media/default/xyz/filename.pdf, cant set a href, doesn't give right download link file.

soo, question is, thinking , doing totally wrong way or missing obvious? ideas , suggestions , more welcome.

use or adapt next template override in theme:

@{ var url = model.contentfield.url; } @if(model.contentfield.url != null) { if (url.startswith("~/")) { url = href(url); } <div class="media-picker-field attachment-pdf"> <a href="@url" class="pdf-download" title="@t("download pdf")"><span>download</span></a> </div> }

modify text needed. template fields.mediapicker-pdf.cshtml used media picker field named pdf.

orchardcms orchardcms-1.6

No comments:

Post a Comment