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 -%>
<%=h list.id -%>) |
<%=h list.title %> |
<%=h list.body %> |
<%=h list.char %> |
<%=h list.sim %> |
<%=h list.oth %> |
<%=h list.wyp %> |
<%=h list.od %> |
<%=h list.comm %> |
<% 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 -%>
<% if list.od = ''-%>
<%=h list.id -%>) |
<%=h list.title %> |
<%=h list.body %> |
<%=h list.char %> |
<%=h list.sim %> |
<%=h list.oth %> |
<%=h list.wyp %> |
<%=h list.od %> |
<%=h list.comm %> |
<% 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
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 %>
In the css:
.list-line-even.empty, .list-line-even1.empty {
color: #F00;
}
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 %>
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 -%>
....
<%=h list.id -%>) |
<%=h list.title %> |
<%=h list.body %> |
<%=h list.char %> |
<%=h list.sim %> |
<%=h list.oth %> |
<%=h list.wyp %> |
<%=h list.od %> |
<%=h list.comm %> |
Regards
beny18241
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 -%>
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
[email protected]