I''m trying to create a search on the index page where it will take a
search input and return to the same page. On this page is a list of
all the search items. So I want to highlight them all with AJAX and
then leave then in bold permanently. The problem comes in evaluating
the school and search term. I really have no idea what I''m doing with
this.
page.select("#alphabet strong").each do |element|
element.visual_effect :highlight if @search.include? school
element.insert_html *make bold*
end
<h3>Search <span>schools</span></h3>
<% form_remote_tag :url => { :action => ''result'' } do
%>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
<div id="results">
</div>
<h3>Listing <span>Schools</span></h3>
<div id="alphabet">
<% ''a''.upto ''z'' do |l| %>
<%= l %>
<% for school in @schools %>
<% if school.title.first == l.upcase %>
<strong><%= link_to h (school.title),
new_school_course_path(school) %></strong>
<% end %>
<% end %>
<br />
<% end %>
</div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
sounds like you should be using setStyle (a prototype method) to make
your elements bold, e.g.:
element.setStyle({fontWeight: ''bold''})
I''m not sure if there''s an RJS wrapper for the setStyle method
so I''m
not entirely sure this will work as written. Something like this will
definitely work though:
page <<
"$(#{element}).setStyle({fontWeight:''bold''});"
... which is kinda the long way around.
On Dec 18, 12:10 pm, edberner
<eber...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m trying to create a search on the index page where it will take
a
> search input and return to the same page. On this page is a list of
> all the search items. So I want to highlight them all with AJAX and
> then leave then in bold permanently. The problem comes in evaluating
> the school and search term. I really have no idea what I''m doing
with
> this.
>
> page.select("#alphabet strong").each do |element|
> element.visual_effect :highlight if @search.include? school
> element.insert_html *make bold*
> end
>
> <h3>Search <span>schools</span></h3>
> <% form_remote_tag :url => { :action => ''result''
} do %>
> <p>
> <%= text_field_tag :search, params[:search] %>
> <%= submit_tag "Search", :name => nil %>
> </p>
> <% end %>
>
> <div id="results">
> </div>
>
> <h3>Listing <span>Schools</span></h3>
> <div id="alphabet">
> <% ''a''.upto ''z'' do |l| %>
> <%= l %>
> <% for school in @schools %>
> <% if school.title.first == l.upcase %>
> <strong><%= link_to h
(school.title),
> new_school_course_path(school) %></strong>
> <% end %>
> <% end %>
> <br />
> <% end %>
> </div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
It does not work for some reason....... On Dec 18, 12:21 am, "luis, syndeomedia" <l...-oF7mpmH9JiMmlAP/+Wk3EA@public.gmane.org> wrote:> sounds like you should be using setStyle (a prototype method) to make > your elements bold, e.g.: > > element.setStyle({fontWeight: ''bold''}) > > I''m not sure if there''s an RJS wrapper for the setStyle method so I''m > not entirely sure this will work as written. Something like this will > definitely work though: > > page << "$(#{element}).setStyle({fontWeight:''bold''});" > > ... which is kinda the long way around. > > On Dec 18, 12:10 pm, edberner <eber...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m trying to create a search on the index page where it will take a > > search input and return to the same page. On this page is a list of > > all the search items. So I want to highlight them all with AJAX and > > then leave then in bold permanently. The problem comes in evaluating > > the school and search term. I really have no idea what I''m doing with > > this. > > > page.select("#alphabet strong").each do |element| > > element.visual_effect :highlight if @search.include? school > > element.insert_html *make bold* > > end > > > <h3>Search <span>schools</span></h3> > > <% form_remote_tag :url => { :action => ''result'' } do %> > > <p> > > <%= text_field_tag :search, params[:search] %> > > <%= submit_tag "Search", :name => nil %> > > </p> > > <% end %> > > > <div id="results"> > > </div> > > > <h3>Listing <span>Schools</span></h3> > > <div id="alphabet"> > > <% ''a''.upto ''z'' do |l| %> > > <%= l %> > > <% for school in @schools %> > > <% if school.title.first == l.upcase %> > > <strong><%= link_to h (school.title), > > new_school_course_path(school) %></strong> > > <% end %> > > <% end %> > > <br /> > > <% end %> > > </div>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
page[''element''].setStyle({fontWeight:
''bold''})
On Dec 19, 2007 4:20 PM, edberner
<eberner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> It does not work for some reason.......
>
> On Dec 18, 12:21 am, "luis, syndeomedia"
<l...-oF7mpmH9JiMmlAP/+Wk3EA@public.gmane.org> wrote:
> > sounds like you should be using setStyle (a prototype method) to make
> > your elements bold, e.g.:
> >
> > element.setStyle({fontWeight: ''bold''})
> >
> > I''m not sure if there''s an RJS wrapper for the
setStyle method so I''m
> > not entirely sure this will work as written. Something like this will
> > definitely work though:
> >
> > page <<
"$(#{element}).setStyle({fontWeight:''bold''});"
> >
> > ... which is kinda the long way around.
> >
> > On Dec 18, 12:10 pm, edberner
<eber...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > > I''m trying to create a search on the index page where it
will take a
> > > search input and return to the same page. On this page is a list
of
> > > all the search items. So I want to highlight them all with AJAX
and
> > > then leave then in bold permanently. The problem comes in
evaluating
> > > the school and search term. I really have no idea what
I''m doing with
> > > this.
> >
> > > page.select("#alphabet strong").each do |element|
> > > element.visual_effect :highlight if @search.include? school
> > > element.insert_html *make bold*
> > > end
> >
> > > <h3>Search <span>schools</span></h3>
> > > <% form_remote_tag :url => { :action =>
''result'' } do %>
> > > <p>
> > > <%= text_field_tag :search, params[:search] %>
> > > <%= submit_tag "Search", :name => nil %>
> > > </p>
> > > <% end %>
> >
> > > <div id="results">
> > > </div>
> >
> > > <h3>Listing <span>Schools</span></h3>
> > > <div id="alphabet">
> > > <% ''a''.upto ''z'' do
|l| %>
> > > <%= l %>
> > > <% for school in @schools %>
> > > <% if school.title.first == l.upcase
%>
> > > <strong><%= link_to h
(school.title),
> > > new_school_course_path(school) %></strong>
> > > <% end %>
> > > <% end %>
> > > <br />
> > > <% end %>
> > > </div>
> >
>
--
Ryan Bigg
http://www.frozenplague.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I''m not sure this is the code I''m looking for because I''ve tried every combination of ''element'' including #alphabet dd alphabet dd alphabet and none of those elements work to change the div. More importantly, shouldn''t this change the entire div? I would like to only change those that match the search results. My index has two arrays for all schools and the search results @search. Is there really just no way to pass this to javascript for ajax? Would that be useful? Is what I''m implementing just too ridiculous? On Dec 19, 1:03 am, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> page[''element''].setStyle({fontWeight: ''bold''}) > > On Dec 19, 2007 4:20 PM, edberner <eber...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > It does not work for some reason....... > > > On Dec 18, 12:21 am, "luis, syndeomedia" <l...-oF7mpmH9JiMmlAP/+Wk3EA@public.gmane.org> wrote: > > > sounds like you should be using setStyle (a prototype method) to make > > > your elements bold, e.g.: > > > > element.setStyle({fontWeight: ''bold''}) > > > > I''m not sure if there''s an RJS wrapper for the setStyle method so I''m > > > not entirely sure this will work as written. Something like this will > > > definitely work though: > > > > page << "$(#{element}).setStyle({fontWeight:''bold''});" > > > > ... which is kinda the long way around. > > > > On Dec 18, 12:10 pm, edberner <eber...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I''m trying to create a search on the index page where it will take a > > > > search input and return to the same page. On this page is a list of > > > > all the search items. So I want to highlight them all with AJAX and > > > > then leave then in bold permanently. The problem comes in evaluating > > > > the school and search term. I really have no idea what I''m doing with > > > > this. > > > > > page.select("#alphabet strong").each do |element| > > > > element.visual_effect :highlight if @search.include? school > > > > element.insert_html *make bold* > > > > end > > > > > <h3>Search <span>schools</span></h3> > > > > <% form_remote_tag :url => { :action => ''result'' } do %> > > > > <p> > > > > <%= text_field_tag :search, params[:search] %> > > > > <%= submit_tag "Search", :name => nil %> > > > > </p> > > > > <% end %> > > > > > <div id="results"> > > > > </div> > > > > > <h3>Listing <span>Schools</span></h3> > > > > <div id="alphabet"> > > > > <% ''a''.upto ''z'' do |l| %> > > > > <%= l %> > > > > <% for school in @schools %> > > > > <% if school.title.first == l.upcase %> > > > > <strong><%= link_to h (school.title), > > > > new_school_course_path(school) %></strong> > > > > <% end %> > > > > <% end %> > > > > <br /> > > > > <% end %> > > > > </div> > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---