Ronald Evangelista | 6 Nov 2007 10:26
Picon

help on helper module inclusion/extension

I want to include helper methods included to my Camping App from by
requiring an external file but I can't seem to include helpers from
another module.

module CampingHelpers
    def self.included(base)
        base::Helpers.send(:include, Helpers)
    end
    module Helpers
        def show_test
            p "test"
        end
    end
end

Camping.goes :CampingApp
...
module CampingApp::Helpers
     include CampingHelpers
end
...
the show_test method doesn't get included at all.
is it because of camping eval'ling to S.

any help would be appreciated.
thanks!

--

-- 
|^^^^^^^^^^^^\ .||
|NALDEVNGELSTA.___||'""|""\___,
(Continue reading)

Gregor Schmidt | 6 Nov 2007 12:55
Picon
Gravatar

Re: help on helper module inclusion/extension

Hallo Ronald,

I observed the same problems. The only solution I could make up is
adding the methods in the included hook. Not pretty, but it works

module MyHelperModule
  def self.included(base)
    base.const_get(:Helpers).class_eval do
      def pre_code(value)
        self.pre do
          self.code(value)
        end
      end
    end
  end
end

and then include MyHelperModule in your Camping app

Camping.goes :Wild
module Wild
  include MyHelperModule
end

If there is a more elegant solution out there, I will be happy to hear it.

Cheers,

Gregor	

(Continue reading)

why the lucky stiff | 6 Nov 2007 15:47
Favicon
Gravatar

Re: help on helper module inclusion/extension

On Tue, Nov 06, 2007 at 01:26:34AM -0800, Ronald Evangelista wrote:
> I want to include helper methods included to my Camping App from by
> requiring an external file but I can't seem to include helpers from
> another module.

Try mixing into CampApp::Mab class directly, which will add methods
to the Markaby class.

  class CampApp::Mab
    include CampingHelpers
  end

If you want mixed-in methods to be used in controllers, mix into
CampApp module.

_why
Berger, Daniel | 6 Nov 2007 17:42
Favicon

textarea fails on rows attribute

Hi,

Camping 1.5.180
Ruby 1.8.6

It looks like Camping is choking on the 'rows' attribute for input tags:

input(:name => 'cuid', :type => 'text', :size => 10, :rows => 3)

That will fail with:

Markaby::InvalidXhtmlError no attribute `rows' on input elements:
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:143:in
`tag!'
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:140:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:140:in
`tag!'
(eval):92:in `tag!'
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:217:in
`html_tag'
(eval):3:in `input'
C:/Documents and Settings/djberge/workspace/cluri/cluri.rb:118:in
`index'
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:123:in
`instance_eval'
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:123:in
`capture'
c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:155:in
`tag!'
(Continue reading)

Joshua Schairbaum | 6 Nov 2007 18:00
Picon

Re: textarea fails on rows attribute

Daniel,

I believe you want to create a textarea tag, not an input tag.  Then  
you should be able to give it a rows attribute.

Josh
On Nov 6, 2007, at 11:42 AM, Berger, Daniel wrote:

> Hi,
>
> Camping 1.5.180
> Ruby 1.8.6
>
> It looks like Camping is choking on the 'rows' attribute for input  
> tags:
>
> input(:name => 'cuid', :type => 'text', :size => 10, :rows => 3)
>
> That will fail with:
>
> Markaby::InvalidXhtmlError no attribute `rows' on input elements:
> c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb: 
> 143:in
> `tag!'
> c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb: 
> 140:in
> `each'
> c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb: 
> 140:in
> `tag!'
(Continue reading)

Paul Thompson | 6 Nov 2007 17:55

Re: textarea fails on rows attribute


If you want a textarea why not do this instead:
textarea :name => 'cuid', :rows => 3, :cols => 10

Paul

On Tue, Nov 06, 2007 at 10:42:42AM -0600, Berger, Daniel wrote:
> Hi,
> 
> Camping 1.5.180
> Ruby 1.8.6
> 
> It looks like Camping is choking on the 'rows' attribute for input tags:
> 
> input(:name => 'cuid', :type => 'text', :size => 10, :rows => 3)

> 
Paul Thompson | 6 Nov 2007 17:58

Re: textarea fails on rows attribute

If you want a textarea use the following:
textarea :name => 'cdid', :cols => 20, :rows => 10

Paul
Jonas Pfenniger | 6 Nov 2007 18:13
Picon
Gravatar

Re: textarea fails on rows attribute

Hi Daniel,

Markaby throws an exception on malformed html entities to ensure valid
HTML. The <INPUT /> tag doesn't accept that "rows" attribute because
it is not set in the standard (or am I wrong?). I don't remember where
but I think that it is possible to disable those checks if you want
but I thinkt that you're looking for the <TEXTAREA> tag.

--

-- 
Cheers,
  zimbatm
Jonas Pfenniger | 6 Nov 2007 18:15
Picon
Gravatar

Re: Will there be a new release soon?

Hi Daniel,

2007/10/24, Berger, Daniel <Daniel.Berger@...>:
> Is there going to be a 1.5.1 release anytime soon? Seems like there have
> been enough changes in SVN to warrant one and I prefer to use only
> "released" code in production. It gives me warmer, fuzzier feelings than
> using svn/trunk. :)

the svn trunk is near the release but still needs some work on the
following areas :
 * better session handling
 * fastcgi fixes

Look in the track for ticket, patches are welcome :)

--

-- 
Cheers,
  zimbatm
Berger, Daniel | 6 Nov 2007 18:16
Favicon

RE: textarea fails on rows attribute

 > -----Original Message-----
> From: camping-list-bounces@... 
> [mailto:camping-list-bounces@...] On Behalf Of Paul Thompson
> Sent: Tuesday, November 06, 2007 9:58 AM
> To: camping-list@...
> Subject: Re: textarea fails on rows attribute
> 
> If you want a textarea use the following:
> textarea :name => 'cdid', :cols => 20, :rows => 10

Ah, that works, thanks.

Dan

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

Gmane