Reputation: 808
Easy one for Tuesday morning... Im trying to call a javascript function from inside this ruby tag...
<% @efforts.each do |effort| %>
<% if effort.project_task.project.project_name == "ADMIN"%>
??????????????
<% else %>
<tr>
<td><%= effort.project_task.project.project_number %> <%= effort.project_task.project.project_name %> -
<%= effort.project_task.task_name %>
<td><%= text_field :effort, :hours, :name => 'effort_' + effort.project_task_id.to_s, :id => 'effort_' + effort.project_task_id.to_s,
:value => "%d" % (effort.hours.nil? ? 0 : effort.hours), :size => 20 %>
<td><%= link_to image_tag('icons/delete.png'), effort, :confirm => 'Are you sure?', :method => :delete %>
</tr>
<% end %>
<% end %>
Where the question marks are i want to call a javascript function. But how do i do that?
Upvotes: 0
Views: 415
Reputation: 1099
You can use javascript_tag:
<%= javascript_tag do -%>
alert('All is good')
<% end -%>
Upvotes: 1