Hi,
I have a list of things in my application (let it be list with something
to borrow).
I wanted to change in css and view something.
I wanted to see row with has one field empty (let us say it will be
given back date) in different color(red or something)
Fragement of my view ...
<% for list in @lists -%>
<tr class="<%= ''list-line-even'' -%>" >
<td><%=h list.id -%>)</td>
<td><%=h list.title %></td>
<td><%=h list.body %></td>
<td><%=h list.char %></td>
<td><%=h list.sim %></td>
<td><%=h list.oth %></td>
<td><%=h list.wyp %></td>
<td><%=h list.od %></td>
<td><%=h list.comm %></td>
<% end %>
and CSS
.list-line-even {
background: #f8b0f8 ;
}
that changing color of my list view perfectly i wonder how to add this
feature
if some empty field is in row class is being changed do different..
I thought about :
<% for list in @lists -%>
<tr class="<%= ''list-line-even1'' -%>" >
<% if list.od = ''''-%> <tr class="<%=
''list-line-even'' -%>" >
<td><%=h list.id -%>)</td>
<td><%=h list.title %></td>
<td><%=h list.body %></td>
<td><%=h list.char %></td>
<td><%=h list.sim %></td>
<td><%=h list.oth %></td>
<td><%=h list.wyp %></td>
<td><%=h list.od %></td>
<td><%=h list.comm %></td>
<% end %>
and CSS
.list-line-even1 {
background: #f8b0f8 ;
}
.list-line-even {
background: #fff ;
}
that changig color of my list view perfectly i wonder how to add this
feature
if some empty field is in row class is being changed do different..
Regards
beny18241
--
Posted via http://www.ruby-forum.com/.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
So you want to be able to set a differnt style to cells that are empty.
You can do something like:
In the view:
<td<%= '' class="empty"'' if(list.commm.blank?)
%>>
<%=h list.comm %>
</td>
In the css:
.list-line-even.empty, .list-line-even1.empty {
color: #F00;
}
--
Posted via http://www.ruby-forum.com/.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Sharagoz -- wrote:> So you want to be able to set a differnt style to cells that are empty. > You can do something like: > > In the view: > <td<%= '' class="empty"'' if(list.commm.blank?) %>> > <%=h list.comm %> > </td> > > In the css: > > .list-line-even.empty, .list-line-even1.empty { > color: #F00; > }THANKS WORKS !! -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
beny 18241 wrote:> Sharagoz -- wrote: >> So you want to be able to set a differnt style to cells that are empty. >> You can do something like: >> >> In the view: >> <td<%= '' class="empty"'' if(list.commm.blank?) %>> >> <%=h list.comm %> >> </td> >> >> In the css: >> >> .list-line-even.empty, .list-line-even1.empty { >> color: #F00; >> } > > THANKS WORKS !!Sorry i need to add another question how to make it that way that i have 2 css defined ? I mean: <% for list in @lists -%> <tr class="<%= ''list-line-even'' -%>" > <tr class="<%= ''list-line-even1'' if list.od.blank? -%>" > .... <td><%=h list.id -%>)</td> <td><%=h list.title %></td> <td><%=h list.body %></td> <td><%=h list.char %></td> <td><%=h list.sim %></td> <td><%=h list.oth %></td> <td><%=h list.wyp %></td> <td><%=h list.od %></td> <td><%=h list.comm %></td> Regards beny18241 -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
beny 18241 wrote:> Hi, > > I have a list of things in my application (let it be list with something > to borrow). > I wanted to change in css and view something. > > I wanted to see row with has one field empty (let us say it will be > given back date) in different color(red or something) > > Fragement of my view ... > > <% for list in @lists -%> > <tr class="<%= ''list-line-even'' -%>" >Just a quick question: why are you using <% %> with a literal string? Since the value of the string will never change, you don''t need the <% %>. (And you really should try Haml instead of ERb.) Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.