On 5 Feb, 00:53, kevinpfromnm <[email protected]> wrote:
> I'm guessing you don't need the hobo_new line.  This is in your
> SentSms model controller right?
>
Right, I was toying around on this subject, I think I found the right
"hobo way" solution, here it is:

the customer card looks like this:

<extend tag="card" for="Customer">
        <old-card: without-creator-link merge>
                <header: replace>
                        <h4 param="heading"><a for="&this"><name/></a></h4>
                        <div param="actions">
                                <a action="edit" if="&can_edit?" 
param="edit-link">Edit</a>
                                <delete-button label="Remove"/>
                        </div>
                </header:>
                <after-body:>
                        <span unless="&this.emails.empty?"><%= 
link_to_show_overlay 'Send
an email', "/emails/#{this.emails.actives.first.id}/sent_emails/new"
%></span>
                        <span if="&(this.emails.empty? and 
this.cellphones.empty?)">|</
span>
                        <span unless="&this.cellphones.empty?"><%= 
link_to_show_overlay
'Send a sms', "/cellphones/#{this.cellphones.actives.first.id}/
sent_smses/new" %></span>
                </after-body:>
        </old-card:>
</extend>

After the body I have the two links to show the overlay.
The sent_smses controller looks like this one:


  def new_for_cellphone
    @cellphone = Cellphone.find(params[:cellphone_id])
    hobo_new
    render_tag :form_for_cellphone
  end

almost the same for the sent_emails controller, I assign to the
@cellphone the.. ehm.. cellphone that owns this sent email (and
probably you are right.. I don't need the hobo_new call.. I'll try it,
definetly!).

In application.dryml I defined the tag that I would like to render in
the last line (really similar to the default new form, I just added a
counter for the written chars as sms only allow 160 chars...

<def tag="form-for-cellphone">
        <section id="form-for-cellphone">
                <header param="content-header">
                        <h2 param="heading">Send a New SMS</h2>
                        <h3 param="subheading">For: <a with="&@cellphone"/></h3>
                </header>

                <section param="content-body">
                        <form method="post" param>
                                <field-list: skip="delivered">
                                        <message-view:>
                                                <div id="charcounter">
                                                        <span 
id="counter">160</span>
                                                </div>
                                                <textarea rows="5" cols="80" 
name="sent_sms[message]"
id="message" onkeyup="javascript:countAndLimit('counter', this,
160);"></textarea>
                                        </message-view:>
                                        <cellphone-label:></cellphone-label:>
                                        <cellphone-view:><input 
name='sent_sms[cellphone_id]'
type='hidden' value='#[email protected]}'/></cellphone-view:>
                                </field-list:>
                                <submit: label="Send Sms"/>
                                <cancel: replace> or <%= link_to_hide_overlay 
'Cancel', "/
customers" %></cancel:>
                        </form>
                </section>
        </section>
</def>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to