Forum: Radiant CMS page_attachments

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89539106c45663863729faeccb944341?d=identicon&s=25 Michael Pyschny (Guest)
on 2007-07-17 18:32
(Received via mailing list)
Hi,

some kind of usage problems with page_attachments:

1.
has somebody found out how to cycle through page_attachments?
I want to render all the attachments as a list or in a gallery like
format but could not find something like <r:attachment:each />
<r:attachment:first />
<r:attachment:next />
<r:attachment:previous />
<r:attachment:count />
<r:attachment:last />

2.
can the upload attachment functionality be made accessible from within a
non-admin page (i.e. from the front-end,
something like Asset-Upload?)

Thanks for your help.
Cheers,
    Michael
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-07-17 21:10
(Received via mailing list)
Michael,

1) page_attachments assumes you want a particular file accessible from a
particular page or its children.  It also assumes you know the name of
the file and makes no assumptions about the format of the file, be it
text, image or some other binary format.  There is no way to iterate
through the attachments of any given page.
2) This again falls out of the scope of page_attachments.  I wouldn't
want random visitors uploading files into my page, so I didn't add that
functionality.

Overall, it sounds like you want some full-fledged gallery software.
The gallery extension might fit your needs.  There's also always room
for another extension that implements the functionality you desire.

Sean
8aeb5ff3546efc726bab713e4e572a40?d=identicon&s=25 Keymone (Guest)
on 2007-07-17 22:34
(Received via mailing list)
1) imho it's not very good assumption... iteration would be VERY useful
feature
for example to easily create javascript-based gallery. when i create
page
Gallery i won't attach anything except images i want to show...

2) i agree with Sean..
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2007-07-17 22:55
(Received via mailing list)
On 7/17/07, Sean Cribbs <seancribbs@gmail.com> wrote:
> Michael,
>
> 1) page_attachments assumes you want a particular file accessible from a
> particular page or its children.  It also assumes you know the name of
> the file and makes no assumptions about the format of the file, be it
> text, image or some other binary format.  There is no way to iterate
> through the attachments of any given page.


Mmm, I disagree...

What If want to attach a few files and show them inside a table? Just
the name and the size, which will allow me later replace those files
with updated ones without thinking on the name of the file :-)

> 2) This again falls out of the scope of page_attachments.  I wouldn't
> want random visitors uploading files into my page, so I didn't add that
> functionality.
>

But I agree on this... file uploads from front-end is way beyond the
scope of page_attachments.. also, i see a lot of attempts to convert
those sites to a pr0n web storage :P

--
Luis Lavena
Multimedia systems
-
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
E91bbb5eae81347ed57880eea764c0f9?d=identicon&s=25 Keith Bingman (Guest)
on 2007-07-18 06:56
(Received via mailing list)
Adding some iteration tags is actually not very hard. You can easily
find all page attachments for a given page and cycle through them. I
have done this, but I am not sure where the tags are... :) I prefer
some sort of gallery plugin for such things, but sometimes it is nice
to have a few images together. I will see if I can find the tags and
post them.

As for  the second part, I would have to agree with Sean.

Keith Bingman
Tel: +49-7731-7983830
keith@keithbingman.com
http://keithbingman.com
89539106c45663863729faeccb944341?d=identicon&s=25 Michael Pyschny (Guest)
on 2007-07-18 10:17
(Received via mailing list)
Hi

On Tue, 2007-07-17 at 23:33 +0300, Keymone wrote:

> 1) imho it's not very good assumption... iteration would be VERY useful
> feature
> for example to easily create javascript-based gallery. when i create page
> Gallery i won't attach anything except images i want to show...
>

Who's developing it? ;-)


> 2) i agree with Sean..

I use Adreas Subscriber extension and upload will only be allowed for
logged in members ...and the quota can easily be controlled by the
page_attachment extension. Quota itself will be defined in the
subscriber config or on per subscriber base. Sounds like a basic asset
management..he?

Cheers
Michael
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-07-18 15:15
(Received via mailing list)
Keith Bingman wrote:
> Adding some iteration tags is actually not very hard. You can easily
> find all page attachments for a given page and cycle through them. I
> have done this, but I am not sure where the tags are... :) I prefer
> some sort of gallery plugin for such things, but sometimes it is nice
> to have a few images together. I will see if I can find the tags and
> post them.
>
>
I wasn't challenging the difficulty, just that I personally don't need
it.  As always with open-source software, anyone is welcome to modify
it.  I can see some compelling use cases for iteration, but
page_attachments was never meant to be a gallery.

Sean
66ea50b15982d1b33aeaaa6df0d7a1dd?d=identicon&s=25 Ryan Heneise (Guest)
on 2007-07-19 17:57
(Received via mailing list)
To iterate over attachments like this:

<r:attachments:each>
   <r:attachment:url />
</r:attachments:each>

Add these tags to page_attachment_tags.rb:

   desc %{
     Gives access to a page's attachments.

     *Usage:*
     <pre><code><r:attachments>...</r:attachments></code></pre>
   }
   tag "attachments" do |tag|
     tag.locals.attachments = tag.locals.page.attachments
     tag.expand
   end

   desc %{
     Cycles through each of the attachments. Inside this tag all
attachments
     are mapped to the current attachment.

     *Usage:*
     <pre><code><r:attachments:each>
      ...
     </r:attachments:each>
     </code></pre>
   }
   tag "attachments:each" do |tag|
     result = []
     tag.locals.attachments.each do |attachment|
       tag.locals.attachment = attachment
       result << tag.expand
     end
     result
   end




On Jul 18, 2007, at 3:15 AM, Michael Pyschny wrote:

>>
> management..he?
>>> from a
>>> functionality.
> Radiant mailing list
> Post:   Radiant@lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>

------------------------------------------------
Ryan Heneise
Art of Mission, Inc.
3720 Gattis School Rd #800 PMB 245
Round Rock, TX 78664

800-722-1492 (phone)

www.artofmission.com
ryan@artofmission.com
This topic is locked and can not be replied to.