Displaying 11 results from an estimated 11 matches for "odd_or_even".
2005 Dec 31
7
Dynamic form? Not really!
...t; ''update_contact'', :id => @contact %>
<table border="0" cellpadding="3" cellpadding="0">
<tr>
<th>Field</th><th>Contents</th>
</tr>
### First part - My ''manual'' coded stuff
<% odd_or_even = 0 %>
<tr class="ListLine<%= odd_or_even %>"><td>Company</td>
<td>
<select name="contact[company_id]">
<% @companies.each do |company| %>
<option value="<%= company.id %>">
<%= company.name...
2006 Feb 03
9
Because I''m very slow - trying to use console
I can''t see how to use variables so I am using console to test things
out...
clients table - a column named first_name
My very brief console session...
>> clients = Client.find_by_sql("select * from clients where first_name
= FN")
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42703 Mcolumn
"fn" does not exist Fparse_expr.c L1034
2006 Jun 25
4
Zebra Striping a Collection of Partials
...of partials, where each partial
is a table row. Is it possible to zebra-stripe the table using this
method i.e. alternate table rows get a different CSS class? I can''t work
out how each row partial would know whether it was odd or even.
In the normal scheme of things I could do:
<% odd_or_even = 0
for asset in @assets
odd_or_even = 1 - odd_or_even -%>
<tr class="line<%= odd_or_even %>">
<td...
</tr>
<% end %>
However, it would be nice to replace the above with:
<%= render :partial => ''asset'', :col...
2006 Feb 25
7
Help with DRY: too much code in my view
...save, not too much
problem there. But where I''m having trouble is figuring out where to
place some code I have had to write to get info from multiple tables
into one view. For example, for a list view of "projects" (main table),
I have this code in the list.rhtml:
<%
odd_or_even = 0
for project in @projects
@project_translations = ProjectTranslation.find(project.id)
@business_unit = BusinessUnit.find(project.business_unit_id)
@requestor = User.find(project.requester_user_id)
@vendor_projects =
VendorProject.find_by_project_translation_id(@project_translations...
2006 Mar 27
0
update subset of my data
...ler to their own images by assigning each
dealer their own albumid.
I list their images with:
in my controller:
def list
@dealers = Dealer.find_all
@dealer = current_user.albumid
@popp_image_pages, @popp_images = paginate :popp_images, :per_page
=> 10
end
in my view:
<%
odd_or_even = 0
for popp_image in @popp_images
odd_or_even = 1 - odd_or_even
%>
<% if (@dealer == nil) || (@dealer == popp_image.albumid)%>
this works fine.
I am stuck on updating multiple pop_images i.e the whole six in the
album (dealer)
here''s what I have:
def update
# @dealer...
2006 Feb 15
0
Confused by this error when trying to use ''pagination''
Trying to create stuff without resorting to scaffold command.
I have a list view in my login_controller.rb file...
def list_users
@user_pages, @users = paginate :users, :per_page => 14
end
I have a command in my list_users.rhtml file which undoubtedly calls
this pagination...
<%
odd_or_even = 0
for user in @users
odd_or_even = 1 - odd_or_even
%>
and instead of being presented a list (like those that I started out
with scaffold commands...I get this error.
Unknown action
No action responded to
#<ActionController::Pagination::Paginator:0xb7ab570c>/
Wiki says...
http://wiki...
2006 Feb 02
12
basic ''find'' question
...r="client_first_name">First name</label><br/>
<%= text_field ''client'', ''first_name'' %></p>
<%= submit_tag ''Find'' %>
<%= end_form_tag %>
Which I presume calls list2.rhtml which has...
<%
odd_or_even = 0
for client in @clients
odd_or_even = 1 - odd_or_even
%>
then a table/row/cell definitions and then list the clients
<td><%=h (client.wholename) %>
<% end %>
and within my clients_controller.rb I have
def list2
@clients = Client.find(:first,
:conditions =>...
2006 Jan 26
42
ruby script/generate scaffold Product Admin hangs
Hi
I am running Mac OX tiger with the installed ruby 1.8.2, and
mysql5 (I checked that it was running in preference). I
tried to run the various fixes recommended in agileweb. I am
stuck on page 57, script/generate scaffold...
> Could you paste in your database.yml file, from the
> "config" folder inside your Rails app? If you have any
> passwords entered there, you should
2011 Dec 05
9
jquery - word is not defined
Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me)
Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class
So I''m using...
app/assets/javascripts/people.js.coffee and put in...
2006 Mar 09
3
Need help PLEASE!!! - updating collection from form
...emrec''
end
---------------------- end controller code -------------------------
------------------ view code --------------------------------
<%= form_tag(:action => "update_illness") %>
<table cellpadding="5" cellspacing="0">
<%
odd_or_even = 0
for @illness in @illnesses
odd_or_even = 1 - odd_or_even
%>
<tr valign="top" class = "Listline<%= odd_or_even %>">
<td width="200">
<%=h @illness.illness %>
</td>
<td width="200">...
2006 Feb 04
1
Can I reset the cycle helper?
...ry now and then
there is another type of line, a section header line. I''d like to be
able to start the line after a section heading always as one of the
two classes the cycle helper is cycling between. Is it possible? If
so, how?
bruce
PS. I realise I could do this with ''odd_or_even'' or the %2 method
(mod function), but I do love the cycle helper - it is terse without
being unintelligible :-)