Re: using reststop with tilt

2010-07-10 Thread David Susco
Got a chance to work on this this morning.

First patch worked fine, no problem. The second wasn't working for me
until I remembered you need to separate out a method's name as its own
argument when passing it to another method.

So, from my example above, you need to do this:

render :_button, R(SomeController), 'Some Controller'

The comma after _button is the key.

Anyway, they both worked for me, thanks Magnus.

Dave

On Fri, Jul 9, 2010 at 9:47 PM, David Susco dsu...@gmail.com wrote:
 Thanks Magnus, those changes make sense to me. I can test them out no
 problem, just not until Monday. I'll send out another e-mail then.

 Thanks,
 Dave

 On Fri, Jul 9, 2010 at 5:30 PM, Philippe Monnet r...@monnet-usa.com wrote:
 Yes I think the first patch makes sense to filter out partials from the
 process of applying the layout.
 For the second patch now I get why Dave's parameters were not being used. So
 now your change would send *a . Cool.
 Dave do you want to try that out?
 And then Magnus can go ahead and apply it and maybe also to update the
 official gem.

 On 7/9/2010 2:20 PM, Magnus Holm wrote:

 Should we apply a patch like this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..f3195b3 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -272,7 +272,7 @@ module Camping
      def render(v, o={}, b)
        if t = lookup(v)
          s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 -        s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
 +        s = render(L, o.merge(L = false)) { s } if v.to_s[0] != ?_
  o[L] != false  lookup(L)
          s
        else
          raise Can't find template #{v}

 Also, currently you can pass arguments to `render`. What about this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..c262757 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -269,9 +269,10 @@ module Camping
      #     end
      #   end
      #
 -    def render(v, o={}, b)
 +    def render(v, *a, b)
        if t = lookup(v)
 -        s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 +        o = a[0] || {}
 +        s = (t == true) ? mab{ send(v, *a, b) } : t.render(self,
 o[:locals] || {}, b)
          s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
          s
        else


 // Magnus Holm



 On Fri, Jul 9, 2010 at 19:12, David Susco dsu...@gmail.com wrote:


 I do have the latest reststop gem, but the problem occurs when I'm
 *not* using reststop. The regular camping render method does not check
 for the _, where as the reststop render does. Line 166 is reststop is
 working, but there's no equivalent logic (that I can see) in camping
 render.

 I've tried calling partials in haml like this without any luck:

 =render :_button R(SomeController) 'Some Controller'
 =render _button R(SomeController) 'Some Controller'

 Dave

 On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
     a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you 

Re: using reststop with tilt

2010-07-09 Thread David Susco
Arg, I new it would be something simple. Thanks.

Dave

On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com wrote:
 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-09 Thread David Susco
FYI, when not using reststop, calling render :_some_partial from a
template will automatically wrap the partial in the layout.

I think this is because the render method automatically wraps a view
in the layout if the layout exists, rather than checking if the first
character is an underscore and then wrapping the view in the layout if
this is not the case (like the basic_render method from reststop).

Another thing that is not possibly when using Tilt (whether using
reststop or not) is calling a partial that takes arguments. For
instance, I have a Markaby partial for a button:

  def _button href, text='Cancel'
a.button text, :href=href
  end

I can call that from other Markaby views with:

_button R(SomeController), 'Some Controller'

But I can't call render on that method because the camping lookup
method will try to turn the entire render argument into a symbol. It's
trying to lookup a method _button R(SomeController), 'Some
Controller' rather than a method _button with the arguments
R(SomeController), 'Some Controller'.

Hopefully that was clear enough.

Dave

On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:
 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com wrote:
 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Dave




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-09 Thread Philippe Monnet
For issue #1: I think I added the change  on line 166( when committing 
my last changes for gem 0.5.3) to check for partials in the normal flow 
of restop_render. Could you verify you have the latest?


For issue #2: what does your %=render ... % code looks like?
Is only the name of the partial inside the quotes (e.g. %=render 
_mypartial 123 'arg2' % )? If so the Camping render should be only 
performing the lookup on the partial name (the v argument) and send the 
other arguments along.


On 7/9/2010 9:14 AM, David Susco wrote:

FYI, when not using reststop, calling render :_some_partial from a
template will automatically wrap the partial in the layout.

I think this is because the render method automatically wraps a view
in the layout if the layout exists, rather than checking if the first
character is an underscore and then wrapping the view in the layout if
this is not the case (like the basic_render method from reststop).

Another thing that is not possibly when using Tilt (whether using
reststop or not) is calling a partial that takes arguments. For
instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
 a.button text, :href=href
   end

I can call that from other Markaby views with:

_button R(SomeController), 'Some Controller'

But I can't call render on that method because the camping lookup
method will try to turn the entire render argument into a symbol. It's
trying to lookup a method _button R(SomeController), 'Some
Controller' rather than a method _button with the arguments
R(SomeController), 'Some Controller'.

Hopefully that was clear enough.

Dave

On Fri, Jul 9, 2010 at 9:10 AM, David Suscodsu...@gmail.com  wrote:
   

Arg, I new it would be something simple. Thanks.

Dave

On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnetr...@monnet-usa.com  wrote:
 

David,

If you're using Tilt, to make partials work in ERB or HAML you would need to
explicitly call render with the name of the partial. So for example, in ERB:
 %=render _mypartial %

Philippe (@techarch)

On 7/8/2010 2:19 PM, David Susco wrote:

Thanks Philippe, it's working great.

Has anyone gotten partials to work with Tilt?

Dave

On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnetr...@monnet-usa.com  wrote:


I fixed the issue in the basic_render method. At the time I worked on
RESTstop I had done the minimum needed to make it work with the new version
of Camping. And when Tilt support was added I did not fully retrofit the
code to make it work with Tilt templates. Problem corrected!
Thanks David for helping us make the implementation more robust.

I have also published a new 0.5.3 version of the gem.

Philippe (@techarch)

On 7/6/2010 10:07 PM, Philippe Monnet wrote:

Hi David, I will look into this (probably this week-end though) - as I
actually did not try Tilt at the same time as RESTstop.

On 7/6/2010 7:45 AM, David Susco wrote:

Still fooling around with this, no luck yet. Found some other things though.

It seems I need to fully qualify controllers as arguments for URL and
R methods when using Tilt (this is irrespective of whether I'm using
reststop or not). Is there anything I can do to get around this?

Also, is there anyway to call partials (markaby or other template
files) from a template file?

Dave

On Wed, Jun 30, 2010 at 9:46 AM, David Suscodsu...@gmail.com  wrote:


I'm trying to use the new Tilt integration with reststop. All the
aliases and whatnot under Implementing your own service
(http://wiki.github.com/camping/reststop/) are there and :views has
been set in the options hash. I tried creating sub-directories in the
views directory (html, HTML) but I still couldn't get it to work.

I can get my haml template to display if I get rid of the alias for
reststop_render. All the other render calls to markaby still work when
I do this too. However, I'm assuming I'm loosing the second argument
for render in reststop when I do this.

Am I missing some other setting/configuration option to get this to
work with the alias for reststop_render?

--
Dave





___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list





___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

   



--
Dave

 



   


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: using reststop with tilt

2010-07-09 Thread David Susco
I do have the latest reststop gem, but the problem occurs when I'm
*not* using reststop. The regular camping render method does not check
for the _, where as the reststop render does. Line 166 is reststop is
working, but there's no equivalent logic (that I can see) in camping
render.

I've tried calling partials in haml like this without any luck:

=render :_button R(SomeController) 'Some Controller'
=render _button R(SomeController) 'Some Controller'

Dave

On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com wrote:
 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
 a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list





 

Re: using reststop with tilt

2010-07-09 Thread Magnus Holm
Should we apply a patch like this?

diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
index 636ad6f..f3195b3 100644
--- a/lib/camping-unabridged.rb
+++ b/lib/camping-unabridged.rb
@@ -272,7 +272,7 @@ module Camping
 def render(v, o={}, b)
   if t = lookup(v)
 s = (t == true) ? mab{ send(v, b) } : t.render(self,
o[:locals] || {}, b)
-s = render(L, o.merge(L = false)) { s } if o[L] != false  lookup(L)
+s = render(L, o.merge(L = false)) { s } if v.to_s[0] != ?_
 o[L] != false  lookup(L)
 s
   else
 raise Can't find template #{v}

Also, currently you can pass arguments to `render`. What about this?

diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
index 636ad6f..c262757 100644
--- a/lib/camping-unabridged.rb
+++ b/lib/camping-unabridged.rb
@@ -269,9 +269,10 @@ module Camping
 # end
 #   end
 #
-def render(v, o={}, b)
+def render(v, *a, b)
   if t = lookup(v)
-s = (t == true) ? mab{ send(v, b) } : t.render(self,
o[:locals] || {}, b)
+o = a[0] || {}
+s = (t == true) ? mab{ send(v, *a, b) } : t.render(self,
o[:locals] || {}, b)
 s = render(L, o.merge(L = false)) { s } if o[L] != false  lookup(L)
 s
   else


// Magnus Holm



On Fri, Jul 9, 2010 at 19:12, David Susco dsu...@gmail.com wrote:
 I do have the latest reststop gem, but the problem occurs when I'm
 *not* using reststop. The regular camping render method does not check
 for the _, where as the reststop render does. Line 166 is reststop is
 working, but there's no equivalent logic (that I can see) in camping
 render.

 I've tried calling partials in haml like this without any luck:

 =render :_button R(SomeController) 'Some Controller'
 =render _button R(SomeController) 'Some Controller'

 Dave

 On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com wrote:
 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
     a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R 

Re: using reststop with tilt

2010-07-09 Thread Philippe Monnet
Yes I think the first patch makes sense to filter out partials from the 
process of applying the layout.
For the second patch now I get why Dave's parameters were not being 
used. So now your change would send *a . Cool.

Dave do you want to try that out?
And then Magnus can go ahead and apply it and maybe also to update the 
official gem.


On 7/9/2010 2:20 PM, Magnus Holm wrote:

Should we apply a patch like this?

diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
index 636ad6f..f3195b3 100644
--- a/lib/camping-unabridged.rb
+++ b/lib/camping-unabridged.rb
@@ -272,7 +272,7 @@ module Camping
  def render(v, o={},b)
if t = lookup(v)
  s = (t == true) ? mab{ send(v,b) } : t.render(self,
o[:locals] || {},b)
-s = render(L, o.merge(L =  false)) { s } if o[L] != false  lookup(L)
+s = render(L, o.merge(L =  false)) { s } if v.to_s[0] != ?_
  o[L] != false  lookup(L)
  s
else
  raise Can't find template #{v}

Also, currently you can pass arguments to `render`. What about this?

diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
index 636ad6f..c262757 100644
--- a/lib/camping-unabridged.rb
+++ b/lib/camping-unabridged.rb
@@ -269,9 +269,10 @@ module Camping
  # end
  #   end
  #
-def render(v, o={},b)
+def render(v, *a,b)
if t = lookup(v)
-s = (t == true) ? mab{ send(v,b) } : t.render(self,
o[:locals] || {},b)
+o = a[0] || {}
+s = (t == true) ? mab{ send(v, *a,b) } : t.render(self,
o[:locals] || {},b)
  s = render(L, o.merge(L =  false)) { s } if o[L] != false  
lookup(L)
  s
else


// Magnus Holm



On Fri, Jul 9, 2010 at 19:12, David Suscodsu...@gmail.com  wrote:
   

I do have the latest reststop gem, but the problem occurs when I'm
*not* using reststop. The regular camping render method does not check
for the _, where as the reststop render does. Line 166 is reststop is
working, but there's no equivalent logic (that I can see) in camping
render.

I've tried calling partials in haml like this without any luck:

=render :_button R(SomeController) 'Some Controller'
=render _button R(SomeController) 'Some Controller'

Dave

On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnetr...@monnet-usa.com  wrote:
 

For issue #1: I think I added the change  on line 166( when committing my
last changes for gem 0.5.3) to check for partials in the normal flow of
restop_render. Could you verify you have the latest?

For issue #2: what does your%=render ... %  code looks like?
Is only the name of the partial inside the quotes (e.g.%=render
_mypartial 123 'arg2' %  )? If so the Camping render should be only
performing the lookup on the partial name (the v argument) and send the
other arguments along.

On 7/9/2010 9:14 AM, David Susco wrote:

FYI, when not using reststop, calling render :_some_partial from a
template will automatically wrap the partial in the layout.

I think this is because the render method automatically wraps a view
in the layout if the layout exists, rather than checking if the first
character is an underscore and then wrapping the view in the layout if
this is not the case (like the basic_render method from reststop).

Another thing that is not possibly when using Tilt (whether using
reststop or not) is calling a partial that takes arguments. For
instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
 a.button text, :href=href
   end

I can call that from other Markaby views with:

_button R(SomeController), 'Some Controller'

But I can't call render on that method because the camping lookup
method will try to turn the entire render argument into a symbol. It's
trying to lookup a method _button R(SomeController), 'Some
Controller' rather than a method _button with the arguments
R(SomeController), 'Some Controller'.

Hopefully that was clear enough.

Dave

On Fri, Jul 9, 2010 at 9:10 AM, David Suscodsu...@gmail.com  wrote:


Arg, I new it would be something simple. Thanks.

Dave

On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnetr...@monnet-usa.com
wrote:


David,

If you're using Tilt, to make partials work in ERB or HAML you would need to
explicitly call render with the name of the partial. So for example, in ERB:
 %=render _mypartial %

Philippe (@techarch)

On 7/8/2010 2:19 PM, David Susco wrote:

Thanks Philippe, it's working great.

Has anyone gotten partials to work with Tilt?

Dave

On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnetr...@monnet-usa.com  wrote:


I fixed the issue in the basic_render method. At the time I worked on
RESTstop I had done the minimum needed to make it work with the new version
of Camping. And when Tilt support was added I did not fully retrofit the
code to make it work with Tilt templates. Problem corrected!
Thanks David for helping us make the implementation more robust.

I have also published a new 0.5.3 version of the gem.

Philippe (@techarch)

On 7/6/2010 10:07 PM, 

Re: using reststop with tilt

2010-07-09 Thread David Susco
Thanks Magnus, those changes make sense to me. I can test them out no
problem, just not until Monday. I'll send out another e-mail then.

Thanks,
Dave

On Fri, Jul 9, 2010 at 5:30 PM, Philippe Monnet r...@monnet-usa.com wrote:
 Yes I think the first patch makes sense to filter out partials from the
 process of applying the layout.
 For the second patch now I get why Dave's parameters were not being used. So
 now your change would send *a . Cool.
 Dave do you want to try that out?
 And then Magnus can go ahead and apply it and maybe also to update the
 official gem.

 On 7/9/2010 2:20 PM, Magnus Holm wrote:

 Should we apply a patch like this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..f3195b3 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -272,7 +272,7 @@ module Camping
  def render(v, o={}, b)
if t = lookup(v)
  s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 -s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
 +s = render(L, o.merge(L = false)) { s } if v.to_s[0] != ?_
  o[L] != false  lookup(L)
  s
else
  raise Can't find template #{v}

 Also, currently you can pass arguments to `render`. What about this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..c262757 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -269,9 +269,10 @@ module Camping
  # end
  #   end
  #
 -def render(v, o={}, b)
 +def render(v, *a, b)
if t = lookup(v)
 -s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 +o = a[0] || {}
 +s = (t == true) ? mab{ send(v, *a, b) } : t.render(self,
 o[:locals] || {}, b)
  s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
  s
else


 // Magnus Holm



 On Fri, Jul 9, 2010 at 19:12, David Susco dsu...@gmail.com wrote:


 I do have the latest reststop gem, but the problem occurs when I'm
 *not* using reststop. The regular camping render method does not check
 for the _, where as the reststop render does. Line 166 is reststop is
 working, but there's no equivalent logic (that I can see) in camping
 render.

 I've tried calling partials in haml like this without any luck:

 =render :_button R(SomeController) 'Some Controller'
 =render _button R(SomeController) 'Some Controller'

 Dave

 On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
     a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new 

Re: using reststop with tilt

2010-07-08 Thread David Susco
Thanks Philippe, it's working great.

Has anyone gotten partials to work with Tilt?

Dave

On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:
 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-07 Thread Philippe Monnet
I fixed the issue in the basic_render method. At the time I worked on 
RESTstop I had done the minimum needed to make it work with the new 
version of Camping. And when Tilt support was added I did not fully 
retrofit the code to make it work with Tilt templates. Problem corrected!

Thanks David for helping us make the implementation more robust.

I have also published a new 0.5.3 version of the gem.

Philippe (@techarch)

On 7/6/2010 10:07 PM, Philippe Monnet wrote:
Hi David, I will look into this (probably this week-end though) - as I 
actually did not try Tilt at the same time as RESTstop.


On 7/6/2010 7:45 AM, David Susco wrote:

Still fooling around with this, no luck yet. Found some other things though.

It seems I need to fully qualify controllers as arguments for URL and
R methods when using Tilt (this is irrespective of whether I'm using
reststop or not). Is there anything I can do to get around this?

Also, is there anyway to call partials (markaby or other template
files) from a template file?

Dave

On Wed, Jun 30, 2010 at 9:46 AM, David Suscodsu...@gmail.com  wrote:
   

I'm trying to use the new Tilt integration with reststop. All the
aliases and whatnot under Implementing your own service
(http://wiki.github.com/camping/reststop/) are there and :views has
been set in the options hash. I tried creating sub-directories in the
views directory (html, HTML) but I still couldn't get it to work.

I can get my haml template to display if I get rid of the alias for
reststop_render. All the other render calls to markaby still work when
I do this too. However, I'm assuming I'm loosing the second argument
for render in reststop when I do this.

Am I missing some other setting/configuration option to get this to
work with the alias for reststop_render?

--
Dave

 


   



___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: using reststop with tilt

2010-07-06 Thread David Susco
Still fooling around with this, no luck yet. Found some other things though.

It seems I need to fully qualify controllers as arguments for URL and
R methods when using Tilt (this is irrespective of whether I'm using
reststop or not). Is there anything I can do to get around this?

Also, is there anyway to call partials (markaby or other template
files) from a template file?

Dave

On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:
 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-06 Thread Philippe Monnet
Hi David, I will look into this (probably this week-end though) - as I 
actually did not try Tilt at the same time as RESTstop.


On 7/6/2010 7:45 AM, David Susco wrote:

Still fooling around with this, no luck yet. Found some other things though.

It seems I need to fully qualify controllers as arguments for URL and
R methods when using Tilt (this is irrespective of whether I'm using
reststop or not). Is there anything I can do to get around this?

Also, is there anyway to call partials (markaby or other template
files) from a template file?

Dave

On Wed, Jun 30, 2010 at 9:46 AM, David Suscodsu...@gmail.com  wrote:
   

I'm trying to use the new Tilt integration with reststop. All the
aliases and whatnot under Implementing your own service
(http://wiki.github.com/camping/reststop/) are there and :views has
been set in the options hash. I tried creating sub-directories in the
views directory (html, HTML) but I still couldn't get it to work.

I can get my haml template to display if I get rid of the alias for
reststop_render. All the other render calls to markaby still work when
I do this too. However, I'm assuming I'm loosing the second argument
for render in reststop when I do this.

Am I missing some other setting/configuration option to get this to
work with the alias for reststop_render?

--
Dave

 



   


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list