>From 1355f89af9031b38e26f7817e69bd03287ee2c60 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@opensuse.org>
Date: Sun, 31 Jan 2010 14:42:59 +0100
Subject: [PATCH] fix display of attributes, and redirect after edition of attributes

---
 src/webui/app/controllers/attribute_controller.rb |    2 ++
 src/webui/app/views/attribute/_attributes.rhtml   |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/webui/app/controllers/attribute_controller.rb b/src/webui/app/controllers/attribute_controller.rb
index 6ed1639..495dd71 100644
--- a/src/webui/app/controllers/attribute_controller.rb
+++ b/src/webui/app/controllers/attribute_controller.rb
@@ -22,6 +22,8 @@ class AttributeController < ApplicationController
     namespace, name = params[:attribute].split /:/
     @attributes.set(namespace, name, values)
     result = @attributes.save
+    opt = {:controller => "attribute", :action => "show", :project => @project.name }
+    opt.store( :package, params[:package] ) if params[:package]
     logger.error result[:msg] if result[:type] == :error
     flash[result[:type]] = result[:msg]
     redirect_to opt
diff --git a/src/webui/app/views/attribute/_attributes.rhtml b/src/webui/app/views/attribute/_attributes.rhtml
index 91ad019..81f2d87 100644
--- a/src/webui/app/views/attribute/_attributes.rhtml
+++ b/src/webui/app/views/attribute/_attributes.rhtml
@@ -1,7 +1,7 @@
 <% if session[:login] %>
 <%= link_to "[Add a new attribute] "+image_tag('list-add.png', :alt => "Add attribute", :title => "Add attribute"), :controller => "attribute", :action => "edit", :project => @project.name, :package => @package  %>
 <% end %>
-<% if @attribute.nil? || !@attribute.has_elements?  %>
+<% if @attributes.nil? || !@attributes.has_elements?  %>
 
     <p><em>No attributes set</em></p>
 
@@ -15,7 +15,7 @@
     <th>Options</th>
   </tr>
 <% i = 0 %>
-<% @attribute.each do |a| %>
+<% @attributes.each do |a| %>
 <%= tr = (i%2==1) ? "<tr class=\"alternate1\">" : "<tr class=\"alternate2\">" %>
 
     <td><%=h a.name %></td>
-- 
1.6.4.2

