3499: Show home project at /projects/{user_uuid}. closes #3515
[arvados.git] / apps / workbench / app / controllers / projects_controller.rb
index d243ef426800b44fe5cd9b351be67bc33b8222d4..bf1bc937e0e61004743f08cabfede11d7ff35974 100644 (file)
@@ -3,6 +3,31 @@ class ProjectsController < ApplicationController
     Group
   end
 
+  def find_object_by_uuid
+    if current_user and params[:uuid] == current_user.uuid
+      @object = current_user.dup
+      @object.uuid = current_user.uuid
+      class << @object
+        def name
+          'Home'
+        end
+        def description
+          ''
+        end
+        def attribute_editable? attr, *args
+          case attr
+          when 'description', 'name'
+            false
+          else
+            super
+          end
+        end
+      end
+    else
+      super
+    end
+  end
+
   def index_pane_list
     %w(Projects)
   end
@@ -71,12 +96,7 @@ class ProjectsController < ApplicationController
           dst.owner_uuid = target_uuid
           dst.tail_uuid = target_uuid if dst.class == Link
         end
-        begin
-          dst.save!
-        rescue
-          dst.name += " (#{Time.now.localtime})" if dst.respond_to? :name=
-          dst.save!
-        end
+        dst.save!
       end
     end
     session[:selected_move_items] = nil