(Did the programming forum disappear?)
Anyway, I have chef which is a ruby program, and I have a hard time understanding ruby. I need a class! But anyway, if someone could answer my question, i would appreciate it.
I want to add a small 'YAY.jpg' next to the node name, if it has 'detroit' in the name. Anyone have an idea how to modify this to do so?
Code:
.block#block-tables
.content
%h2.title
Node List
.inner
= render('navigation', :active => 'index')
.content
.inner
%table.table
%tr
%th.first{:colspan => 2} Name
%th
%th.last
- even = false
- if @node_list.empty?
- if session[:environment]
%td{:colspan => 4}= "The environment #{session[:environment]} has no nodes"
- else
%td{:colspan => 4}= "You have no nodes - try connecting one, or creating or editing a #{link_to('node', nodes_path)}".html_safe
- else
- @node_list.sort_by {|value| value.downcase}.each do |node|
%tr{:class => even ? "even": "odd" }
%td{:colspan => 2}= link_to node, node_path(node)
%td
= link_to('Edit', edit_node_path(node))
|
= link_to('Delete', node_path(node), :method => "delete", :confirm => "Really delete Node #{node}? There is no undo.")
- even = (not even)