From 0ce04a9bc10e6a7cfb38df9edcbcd5c09376dad4 Mon Sep 17 00:00:00 2001 From: adamblum Date: Fri, 13 Feb 2009 09:42:26 -0800 Subject: [PATCH] handle displaying credentials properly --- app/controllers/apps_controller.rb | 2 +- app/views/apps/index.html.erb | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index a1712cf1..a26c6edb 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -33,7 +33,7 @@ def index flash[:notice]="You have no existing apps" end apps=App.find :all - @subapps=apps.reject { |app| !app.anonymous and !current_user.apps.index(app) } + @subapps=apps.reject { |app| !app.anonymous and !@current_user.apps.index(app) } respond_to do |format| format.html # index.html.erb diff --git a/app/views/apps/index.html.erb b/app/views/apps/index.html.erb index 5eb9028d..2f181e90 100644 --- a/app/views/apps/index.html.erb +++ b/app/views/apps/index.html.erb @@ -32,26 +32,21 @@ Credentials <%for app in @subapps %> - -<%if @current_user.login="anonymous" and app.anonymous %> - <%=link_to app.name, edit_app_path(app) %> - <%=h app.description %> -<%end%> - -<%if @current_user.login!="anonymous" %> <%=link_to app.name, edit_app_path(app)%> - <%=h app.description %> + <%=h app.description %> + <%if !app.anonymous %> <%sub=Membership.find_by_app_id_and_user_id app.id,@current_user.id%> - <%if sub and sub.credential%> - - <%=link_to "Edit", {:action=>"getcred",:id=>app.id,:sub_id=>sub.id}%> - <%else%> - <%=link_to "Create",{:action=>"getcred",:id=>app.id,:sub_id=>sub.id}%> - + <%if sub and sub.credential %> + + <%=link_to "Edit", {:action=>"getcred",:id=>app.id,:sub_id=>sub.id}%> + <%else%> + <%=link_to "Create",{:action=>"getcred",:id=>app.id,:sub_id=>sub.id}%> + + <%end%> <%end%> -<%end%> + <%end%> <%else%> You have no subscribed apps.