Skip to content

Commit

Permalink
[webui] fix remote and delete repository handling in path edit UI
Browse files Browse the repository at this point in the history
 - path.link is a broken DB. do not handle this as deleted repo.
 - check when linking against the "deleted" repository was missing
 - remote repositories should not be treated as removed repos
  • Loading branch information
adrianschroeter committed Mar 7, 2016
1 parent 4b502ff commit 9e42cdb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/api/app/models/repository.rb
Expand Up @@ -61,6 +61,11 @@ def cleanup_before_destroy
end
end

def project_name
return self.project.name if self.project
self.remote_project_name
end

class << self
# FIXME: Don't lie, it's find_or_create_by_project_and_name_if_project_is_remote
def find_by_project_and_name( project, repo )
Expand Down
10 changes: 5 additions & 5 deletions src/api/app/views/webui/project/_edit_repository.html.erb
Expand Up @@ -14,25 +14,25 @@
<div style="margin-left: 30px">
<% begin -%>
<% repository.path_elements.each do |path| -%>
<% if path.link.nil? || path.link.project.nil? %>
<% if path.link == Repository.deleted_instance %>
<%= image_tag 'exclamation.png' %> Target repository has been removed
<% else %>
<span><%= path.link.project.name + "/" + path.link.name %></span>
<span><%= path.link.project_name + "/" + path.link.name %></span>

<% if repository.path_elements.size > 1 %>
<% if path != repository.path_elements.first %>
<%= link_to(image_tag('arrow_up.png'), { action: :move_path, project: project, repository: repository, path: path, direction: 'up' }, { class: 'x', method: :post, id: "move_path_up-#{path.link.project.name}_#{path.link.name}" }) -%>
<%= link_to(image_tag('arrow_up.png'), { action: :move_path, project: project, repository: repository, path: path, direction: 'up' }, { class: 'x', method: :post, id: "move_path_up-#{path.link.project_name}_#{path.link.name}" }) -%>
<% end %>
<% if path != repository.path_elements.last %>
<%= link_to(image_tag('arrow_down.png'), { action: :move_path, project: project, repository: repository, path: path, direction: 'down'}, { class: 'x', method: :post, id: "move_path_down-#{path.link.project.name}_#{path.link.name}" }) -%>
<%= link_to(image_tag('arrow_down.png'), { action: :move_path, project: project, repository: repository, path: path, direction: 'down'}, { class: 'x', method: :post, id: "move_path_down-#{path.link.project_name}_#{path.link.name}" }) -%>
<% end %>
<% end %>
<%= link_to(image_tag('drive_delete.png'), { :action => :remove_path_from_target,
:project => project, :repository => repository,
:path => path },
{ data: { confirm: "Really remove #{path.link.project.name} / #{path.link.name} path from repository '#{repository.name}'?" },
{ data: { confirm: "Really remove #{path.link.project_name} / #{path.link.name} path from repository '#{repository.name}'?" },
:class => 'x', :method => :post }) -%>
<% end %>

Expand Down

0 comments on commit 9e42cdb

Please sign in to comment.