view configuration

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

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;
}

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 !!

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

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,