Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Link Dinâmico
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lucas Lima de Souza  
View profile   Translate to Translated (View Original)
 More options Jun 11 2012, 10:56 pm
From: Lucas Lima de Souza <lucaslim...@gmail.com>
Date: Mon, 11 Jun 2012 19:56:43 -0700 (PDT)
Local: Mon, Jun 11 2012 10:56 pm
Subject: Link Dinâmico

E aí galera.

Estou precisando de ajuda para inserir um link no final da div Task e
trocar a string NEW RECORDE por um número aleatório.

Formulário que chama a o método para adicionar o link

<%=simple_form_for @list do |f| %>

<p>
<%=f.label :name %><br />
<%=f.input_field :name %>
</p>

<h3> Taks</h3>

<%=f.simple_fields_for :tasks do |task_form| %>
<%= render 'task_form', :f => task_form %>
<% end %>

<%= add_task_link(f)%> #-----------------------> chama o método passando o
formulário

<%= f.button :submit%>

<% end %>

TASK FORM

<div id="tasks"
<%=f.label :name %><br />
<%=f.input_field :name %><br />
</div>

MÉTODO PARA MONTAR O LINK

 def add_task_link(f)
link_to 'add a task' do |page|
      f.simple_fields_for :tasks, Task.new, :child_index => 'NEW_RECORD' do
|fo|
        html = render 'task_form', :f => fo
        page <<  "$('tasks').insert({ bottom:
'#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime())

});"

end
    end
end

Obrigado.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rafael Mendonça França  
View profile   Translate to Translated (View Original)
 More options Jun 11 2012, 11:04 pm
From: Rafael Mendonça França <rafaelmfra...@gmail.com>
Date: Tue, 12 Jun 2012 00:04:34 -0300
Local: Mon, Jun 11 2012 11:04 pm
Subject: Re: Link Dinâmico

Essa pergunta não é relacionada ao SimpleForm.

Porem, recomendo a você assistir esses screencasts:
http://railscasts.com/episodes/73-complex-forms-part-1
http://railscasts.com/episodes/74-complex-forms-part-2
http://railscasts.com/episodes/75-complex-forms-part-3

E depois olhar o código dessa gem: https://github.com/ryanb/nested_form

Caso tenha alguma dúvida sugiro que você procure ajuda em uma lista mais
genérica como a rails-br.

Abraço,

Rafael Mendonça França
http://twitter.com/rafaelfranca
https://github.com/rafaelfranca

2012/6/11 Lucas Lima de Souza <lucaslim...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lucas Lima de Souza  
View profile   Translate to Translated (View Original)
 More options Jun 12 2012, 8:30 am
From: Lucas Lima de Souza <lucaslim...@gmail.com>
Date: Tue, 12 Jun 2012 05:30:26 -0700 (PDT)
Local: Tues, Jun 12 2012 8:30 am
Subject: Re: Link Dinâmico

Valeu obrigado.

On Monday, June 11, 2012 11:56:43 PM UTC-3, Lucas Lima de Souza wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »