https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Remove useless files.
* web/ranch/app/views/layouts/_left_margin.rhtml,
* web/ranch/app/views/layouts/ranch_benches_list.rhtml,
* web/ranch/app/filters/load_projects_filter.rb,
* web/ranch/app/helpers/graph_form_helper.rb: Remove. Useless since
the layout have changed.
* web/ranch/app/controllers/benches_controller.rb: No longer use the
deprecated helper `graph_form'.
* web/ranch/app/helpers/benches_helper.rb: Inject `graph_form'
`outputs_tag' helper in it.
controllers/benches_controller.rb | 2 +-
helpers/benches_helper.rb | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
Index: web/ranch/app/controllers/benches_controller.rb
--- web/ranch/app/controllers/benches_controller.rb (revision 68)
+++ web/ranch/app/controllers/benches_controller.rb (working copy)
@@ -2,7 +2,7 @@
layout 'benches'
- helper :graph, :graph_form, :benches
+ helper :graph, :benches
before_filter :list
Index: web/ranch/app/helpers/benches_helper.rb
--- web/ranch/app/helpers/benches_helper.rb (revision 68)
+++ web/ranch/app/helpers/benches_helper.rb (working copy)
@@ -1,5 +1,24 @@
module BenchesHelper
+ def outputs_tag(name, bench_name, arg_num=0, nb_arg=1, options={})
+ bench = Bench.find_by_name bench_name
+ outputs = Output.find_by_sql "SELECT name, unit, arg_num " +
+ "FROM outputs " +
+ "WHERE bench_id = #{bench.id} " +
+ "GROUP BY arg_num " +
+ "ORDER BY arg_num"
+
+ str = %(<select id="#{name}" name="#{name}">\n)
+ str += %(<option value="0" #{arg_num.zero? ?
'selected="selected"' : ''}>)
+ str += "**ALL**</option>\n"
+ outputs.each do |output|
+ str += %(<option value="#{output.arg_num}")
+ str += %( selected="selected") if output.arg_num == arg_num
+ str += %(>#{output.name}(#{output.unit})</option>\n)
+ end
+ str += %(</select>\n)
+ end
+
def system_change_tag(hostname, changes, rev_start, rev_stop)
ret = %(
<p>