Getting <live-editor> to update more than one part?

45 views
Skip to first unread message

Tim Griffin

unread,
May 14, 2013, 10:48:49 AM5/14/13
to hobo...@googlegroups.com
Hi all, 

Almost no results in Hobo Users for <live-editor> so I don't know if anyone else is trying to use the tag? 

I'm curious, though, if there might be a practical way of having a <live-editor> tag update more than one part. In my case, I'd love a change to a <live-editor> field to be reflected by the "updated_at" field (which is updated automatically). 

Something like this would be great:

<field-list fields="wholly_cancelled_text">  

  <wholly-cancelled-text-view:>
    <div part="part-w">
      <live-editor-innards updates="part-w,div-history"/>
    </div>
  </wholly-cancelled-text-view:>

</field-list>

...

<div part="div-history">
  <field-list fields="created_at, updated_at"/>
</div>


Any ideas? 

Tim

Bryan Larsen

unread,
May 14, 2013, 10:54:26 AM5/14/13
to Hobo Users
Hmmm, that looks like it should work.  If it doesn't, try:

  <live-editor-innards updates="..." ajax="&false"/>

if that works, raise a bug report.

Thanks,
Bryan



Tim

--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hobousers+...@googlegroups.com.
To post to this group, send email to hobo...@googlegroups.com.
Visit this group at http://groups.google.com/group/hobousers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tim Griffin

unread,
May 14, 2013, 12:11:59 PM5/14/13
to hobo...@googlegroups.com
No go, Bryan;

I've logged issue 32 for Hobo 2.0.0.

Tim

Ignacio Huerta

unread,
May 17, 2013, 5:32:43 AM5/17/13
to hobo...@googlegroups.com, Tim Griffin
I was looking at this issue and I found out the problem is the "updates"
syntax.

You wrote:

<live-editor-innards updates="part-w,div-history"/>

But with updates you have to use the Dom id:

<live-editor-innards updates="#part-w, #div-history"/>

http://cookbook.hobocentral.net/manual/ajax#specifying-the-dom-id

I have tested it and it seems to work correctly :).

Regards,
Ignacio

El 14/05/13 18:11, Tim Griffin escribi�:
> No go, Bryan;
>
> I've logged issue 32 <https://github.com/Hobo/hobo/issues/32> for Hobo
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre

Tim Griffin

unread,
May 17, 2013, 5:11:20 PM5/17/13
to Ignacio Huerta, hobo...@googlegroups.com
Ah hah! Thank you Ignacio. 

That was an easy oversight on my part, and I'm happy to know it hasn't required any re-engineering on your part!

Best regards,
Tim


On Fri, May 17, 2013 at 5:32 AM, Ignacio Huerta <ign...@ihuerta.net> wrote:
I was looking at this issue and I found out the problem is the "updates" syntax.

You wrote:

        <live-editor-innards updates="part-w,div-history"/>

But with updates you have to use the Dom id:

        <live-editor-innards updates="#part-w, #div-history"/>

http://cookbook.hobocentral.net/manual/ajax#specifying-the-dom-id

I have tested it and it seems to work correctly :).

Regards,
Ignacio

El 14/05/13 18:11, Tim Griffin escribió:

To post to this group, send email to hobo...@googlegroups.com.
Visit this group at http://groups.google.com/group/hobousers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35

Ignacio Huerta

unread,
May 17, 2013, 6:03:32 PM5/17/13
to Tim Griffin, hobo...@googlegroups.com
You are welcome! :)

El 17/05/13 23:11, Tim Griffin escribi�:
> Ah hah! Thank you Ignacio.
>
> That was an easy oversight on my part, and I'm happy to know it hasn't
> required any re-engineering on your part!
>
> Best regards,
> Tim
>
>
> On Fri, May 17, 2013 at 5:32 AM, Ignacio Huerta <ign...@ihuerta.net
> <mailto:ign...@ihuerta.net>> wrote:
>
> I was looking at this issue and I found out the problem is the
> "updates" syntax.
>
> You wrote:
>
> <live-editor-innards updates="part-w,div-history"/>
>
> But with updates you have to use the Dom id:
>
> <live-editor-innards updates="#part-w, #div-history"/>
>
> http://cookbook.hobocentral.__net/manual/ajax#specifying-__the-dom-id <http://cookbook.hobocentral.net/manual/ajax#specifying-the-dom-id>
>
> I have tested it and it seems to work correctly :).
>
> Regards,
> Ignacio
>
> El 14/05/13 18:11, Tim Griffin escribi�:
>
> No go, Bryan;
>
> I've logged issue 32 <https://github.com/Hobo/hobo/__issues/32
> <https://github.com/Hobo/hobo/issues/32>> for Hobo
> 2.0.0.
>
> Tim
>
>
> On Tuesday, May 14, 2013 10:48:49 AM UTC-4, Tim Griffin wrote:
>
> Hi all,
>
> Almost no results in Hobo Users for <live-editor> so I
> don't know if
> anyone else is trying to use the tag?
>
> I'm curious, though, if there might be a practical way of
> having a
> <live-editor> tag update more than one part. In my case,
> I'd love a
> change to a <live-editor> field to be reflected by the
> "updated_at"
> field (which is updated automatically).
>
> Something like this would be great:
>
> <field-list fields="wholly_cancelled_text"__>
>
> <wholly-cancelled-text-view:>
> <div part="part-w">
> <live-editor-innards updates="part-w,div-history"/>
> </div>
> </wholly-cancelled-text-view:>
>
> </field-list>
>
> ...
>
> <div part="div-history">
> <field-list fields="created_at, updated_at"/>
> </div>
>
>
> Any ideas?
>
> Tim
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from
> it, send
> an email to hobousers+unsubscribe@__googlegroups.com
> <mailto:hobousers%2Bunsu...@googlegroups.com>.
> To post to this group, send email to hobo...@googlegroups.com
> <mailto:hobo...@googlegroups.com>.
> Visit this group at
> http://groups.google.com/__group/hobousers?hl=en
> <http://groups.google.com/group/hobousers?hl=en>.
> For more options, visit
> https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> Ignacio Huerta Arteche
> http://www.ihuerta.net
> Tel�fono: 0034 645 70 77 35
> Email realizado con software libre
>
>

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35

William Wong

unread,
Nov 4, 2013, 7:53:06 AM11/4/13
to hobo...@googlegroups.com, Tim Griffin
I want to update my table-plus if a product category is changed. Below code seems to change only the product category. Any idea why it doesn't work? Thanks.

<div part="product">
   <table-plus update="product" with="&@assigned_product" fields="this,body,category"> 
      <category-view:> 
         <div part="category"> 
            <live-editor-innards updates="#category,product"/> 
         </div> 
       </category-view> 
    </table-plus> 
</div>


Ignacio Huerta

unread,
Nov 4, 2013, 7:54:42 AM11/4/13
to hobo...@googlegroups.com, Tim Griffin
>From a quick look, it seems that the "updates" syntax is wrong, you are
missing a '#'. It should be:

<live-editor-innards updates="#category,#product"/>

Please write back if it still doesn't work :).

Warm regards,
Ignacio

El 04/11/13 13:53, William Wong escribi�:
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

William Wong

unread,
Nov 4, 2013, 8:46:18 AM11/4/13
to hobo...@googlegroups.com, Tim Griffin
I got a NoMethodError if switch to #product. Below is the error. Thanks.

Started PUT "/products/1-fp1" for 127.0.0.1 at 2013-11-04 21:42:48 +0800
Processing by ProductsController#update as JS
  Parameters: {"render_options"=>{"errors_ok"=>"1"}, "render"=>{"0"=>{"part_context"=>"BAhbCDoQZmluZ2VycHJpbnRJIgl0aGlzBjoGRVRbAA==--acb081fcda04574d1a896a4a7c42051489dce575", "id"=>"product"}, "1"=>{"part_context"=>"BAhbCDoNY2F0ZWdvcnlJIhtmaW5nZXJwcmludDoxOmNhdGVnb3J5BjoGRUZbAA==--99acc85bba99aecb0fe9763db992a78e35a6cd68", "id"=>"category"}, "2"=>{"part_context"=>"BAhbCDoNY2F0ZWdvcnlJIhtmaW5nZXJwcmludDoxOmNhdGVnb3J5BjoGRUZbAA==--99acc85bba99aecb0fe9763db992a78e35a6cd68", "id"=>"category"}}, "page_path"=>"/products", "authenticity_token"=>"yPzoeAP/lpYwW361y3Qen7krhZH0KdAuDme6PW7vsO8=", "product"=>{"category_id"=>"3"}, "id"=>"1-fp1"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", "1"]]
  Product Load (0.2ms)  SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1  [["id", "1-fp1"]]
   (0.1ms)  begin transaction
   (0.4ms)  UPDATE "products" SET "category_id" = 3, "updated_at" = '2013-11-04 13:42:48.252787' WHERE "products"."id" = 1
   (0.9ms)  commit transaction
Call part: product. this-id = this, locals = []
Completed 500 Internal Server Error in 25ms

NoMethodError (undefined method `empty?' for #<Product:0x007fe8d52335a0>):
  app/views/products/index.dryml:4:in `block in product_part'
  app/views/products/index.dryml:3:in `product_part'


  Rendered /Users/william/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.7ms)
  Rendered /Users/william/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.6ms)
  Rendered /Users/william/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (16.5ms)

William Wong

unread,
Nov 4, 2013, 7:14:46 PM11/4/13
to hobo...@googlegroups.com, Tim Griffin
I found the problem. Ignacio is correct, the syntax should be <live-editor-innards updates="#category,#product"/>. When a product category is changed thru live-editor, the update request is sent to "ProductsController#update as JS". But inside ProductsController update, there is no information about @assigned_product. If @assigned_product is set within the hobo_update block (see below), it will work. 

<index-page>
<div part="product">
   <table-plus update="product" with="&@assigned_product" fields="this,body,category"> 
      <category-view:> 
         <div part="category"> 
            <live-editor-innards updates="#category,#product"/> 
         </div> 
       </category-view> 
    </table-plus> 
</div>
<index-page>

def update
    hobo_update do
      @assigned_product = Product.all
    end
end

Ignacio Huerta

unread,
Nov 5, 2013, 1:37:37 AM11/5/13
to hobo...@googlegroups.com, Tim Griffin
Good work, I'm glad you solved it :)

El 05/11/13 01:14, William Wong escribi�:
Reply all
Reply to author
Forward
0 new messages