<%= javascript_include_tag :defaults %> or <%= javascript_include_tag :prototype %> <script src="/javascripts/prototype.js" type="text/javascript"></script> <script src="/javascripts/effects.js" type="text/javascript"></script> <script src="/javascripts/dragdrop.js" type="text/javascript"></script> <script src="/javascripts/controls.js" type="text/javascript"></script> <script src="/javascripts/application.js" type="text/javascript"></script>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
def search
@raw_phrase = request.raw_post
@posts = []
@posts_pages = []
unless @raw_phrase == ""
@phrase = "%" + @raw_phrase + "%"
@post_pages,@posts = paginate(:entries,
:per_page => 12,
:order => "time DESC",
:conditions => ["content like ?", @phrase])
end
respond_to do |wants|
wants.html { render :partial => "search"}
wants.js { render :partial => "search"}
wants.xml { render :xml => @posts.to_xml }
end
end
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= text_field_tag :searchQuery %>
<%= observe_field( :searchQuery,
:frequency => 0.5,
:update => :searchResults,
:url => { :action => :search },
:loading => "Element.show('search-indicator')",
:complete => "Element.hide('search-indicator')") %>
<%= image_tag("indicator.gif",
:id => 'search-indicator',
:style => 'display:none;') %>
<%= link_to_function "[Show|Hide]",
visual_effect(:toggle_blind, :links, :duration => 1) %>
<a href="#" onclick="Effect.toggle("links",'blind',
{duration:1});; return false;">[Show|Hide]</a>
<%= link_to_remote "More pictures ...", :update => "images",
:url => { :action => "index", :blocktype => 'images', :limit=>'30' },
:loading => visual_effect(:slide_up, :imagescontainer ),
:success => visual_effect(:slide_down, :imagescontainer) %>
<%= link_to_remote "More pictures ...", :update => "images",
:url => { :action => "index", :blocktype => 'images', :limit=>'30' },
:loading => visual_effect(:slide_up, :imagescontainer, :queue => 'front'),
:success => visual_effect(:slide_down, :imagescontainer, :queue => 'end') %>
| Macro | Action |
|---|---|
| javascript_tag | Creates script tag wrapper |
| link_to_function | Creates an anchor tag with an onclick method |
| escape_javascript | Escapes quotes in JS strings |
<%= in_place_editor_field :item, :description, {}, {:rows=>10, :cols=>50} %>
insert_html replace_html select visual_effect
page.insert_html :bottom, 'purchasedlist', @item.name page.visual_effect :highlight, 'purchasedlist' page.replace_html 'totalprice', :partial => 'totalprice'
page.insert_html :bottom, 'purchasedlist', @item.name
page.visual_effect :highlight, 'purchasedlist'
page.replace_html 'totalprice', :partial => 'totalprice'
page.insert_html :bottom, 'purchasedlist', @item.name
page.visual_effect :highlight, 'purchasedlist'
page.replace_html 'totalprice', :partial => 'totalprice'
page.insert_html :bottom, 'purchasedlist', @item.name
page.visual_effect :highlight, 'purchasedlist'
page.replace_html 'totalprice', :partial => 'totalprice'
page.select('p.hint').each do |hint|
hint.visual_effect :highlight
end
module ApplicationHelper
def update_time
page.replace_html 'time', Time.now.to_s(:db)
page.visual_effect :highlight, 'time'
end
end
# Controller action
def poll
render(:update) { |page| page.update_time }
end