3201: Only Projects can be moved to "My Projects."
authorBrett Smith <brett@curoverse.com>
Tue, 8 Jul 2014 22:06:45 +0000 (18:06 -0400)
committerBrett Smith <brett@curoverse.com>
Tue, 8 Jul 2014 22:06:45 +0000 (18:06 -0400)
Before this commit, it was possible to move any object that goes in
folders to "My Projects."  If you did, it would be removed from any
project, and owned by the user directly.  This is non-obvious.  Data
should be removed from projects by using the trash icon on the project
page instead.

Closes #3201.

apps/workbench/app/views/projects/_choose.html.erb

index de72c41c180f4c8aa7d08e77c7b653f3d5438a0a..4bae8aab8fd894b6073439a8f9da8df05c449ff7 100644 (file)
                   <i class="fa fa-fw fa-folder-open-o"></i>
                   <%= projectnode[:object] %>
                 </div>
-              <% else %>
-                <div class="<%= 'selectable project' if !params[:editable] || projectnode[:object].editable? %> row"
+              <% else
+                 row_selectable = !params[:editable] || projectnode[:object].editable?
+                 folder_class = "fa-folder-o"
+                 if projectnode[:object].uuid == current_user.uuid
+                   row_name = "My Projects"
+                   row_selectable &&= (resource_class_for_uuid(params[:action_href].split("/").last) == Group) rescue false
+                   folder_class = "fa-folder-open-o" if not row_selectable
+                 else
+                   row_name = projectnode[:object].friendly_link_name || 'New project'
+                 end %>
+                <div class="<%= 'selectable project' if row_selectable %> row"
                      style="padding-left: <%= 1 + projectnode[:depth] %>em; margin-right: 0px" data-object-uuid="<%= projectnode[:object].uuid %>">
-                  <i class="fa fa-fw fa-folder-o"></i>
-                  <% if projectnode[:object].uuid == current_user.uuid %>
-                    My Projects
-                  <% else %>
-                    <%= projectnode[:object].friendly_link_name || 'New project' %>
-                  <% end %>
+                  <i class="fa fa-fw <%= folder_class %>"></i> <%= row_name %>
                 </div>
               <% end %>
             <% end %>