Re: [Radiant] Looking for something similar to summarize extension for truncating content

2009-01-12 Thread Mohit Sindhwani

Andrew Neil wrote:

You could create a custom Radius tag to wrap around the Rails truncate[1]
method. Something like this might do the trick:


  


Actually, this method should be written up in the Radiant 2009 
Documentation project as a good simple example of bringing in Rails 
methods into Radiant installs - it would help those "entry level" Rails 
programmers who wonder how to bridge the worlds of Rails and Radiant.


Cheers,
Mohit.
1/12/2009 | 9:28 PM.

___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Looking for something similar to summarize extension for truncating content

2009-01-12 Thread Andrew Neil
You could create a custom Radius tag to wrap around the Rails truncate[1]
method. Something like this might do the trick:

desc %{
  Truncates contents if the number of characters is longer than
@length@(defaults to 30). The last characters will be replaced with
the @omission@(defaults to "...").
}
tag 'truncate' do |tag|
  length = tag.attr['length'] || 30
  omission = tag.attr['omission'] || "..."
  content = tag.expand
  truncate(content, :ommision => omission, :length => length)
end

I haven't tested this, so can't guarantee that it would work!

You could call this as follows:

  
  
  

I hope that helps.

Drew

[1]: http://apidock.com/rails/ActionView/Helpers/TextHelper/truncate

On Sun, Jan 11, 2009 at 12:04 PM, Roman Marszalek wrote:

> And wondering how it can be most easily acheived.
>
> I'd like to be able to say something like this (obviously not available)
>
> 
>
> And then it displays the fist 30 characters of the page part.
>
> Anyone know if there's an easy way to achieve this effect.
>
>
> Thanks,
>
> Roman
>
> --
> Roman Marszalek
> Managing Director
> mobile: +44 7786 262 002
> email: supp...@drlogic.co.uk
>
> telephone: 0800 345 7844 (+44 20 7014 3634)
> Our lines are open from 9am to 6pm Monday to Friday
>
> Doctor Logic Limited
> Mac Support for London
> http://drlogic.co.uk
>
> * Dr Logic Backup *
> Backup for Britain
> http://drlogicbackup.co.uk
>
> * Dr Logic Training *
> In partnership with Academy Class
> http://training.drlogic.co.uk
>
>
> Registered in England and Wales. Company No. 04947299.
> Registered Office: 2nd Floor 145-157 St John Street, London EC1V 4PY
> VAT Reg. No. GB848448189
>
> ___
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] Looking for something similar to summarize extension for truncating content

2009-01-11 Thread Roman Marszalek
And wondering how it can be most easily acheived.

I'd like to be able to say something like this (obviously not available)



And then it displays the fist 30 characters of the page part.

Anyone know if there's an easy way to achieve this effect.


Thanks,

Roman

-- 
Roman Marszalek
Managing Director
mobile: +44 7786 262 002
email: supp...@drlogic.co.uk

telephone: 0800 345 7844 (+44 20 7014 3634)
Our lines are open from 9am to 6pm Monday to Friday

Doctor Logic Limited
Mac Support for London
http://drlogic.co.uk

* Dr Logic Backup *
Backup for Britain
http://drlogicbackup.co.uk

* Dr Logic Training *
In partnership with Academy Class
http://training.drlogic.co.uk


Registered in England and Wales. Company No. 04947299.
Registered Office: 2nd Floor 145-157 St John Street, London EC1V 4PY
VAT Reg. No. GB848448189

___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant