fix rename/delete/copy modals not working

This commit is contained in:
Mojca Lorber 2017-06-08 15:13:00 +02:00
parent 0004c2b7d5
commit be52af4e4f
3 changed files with 35 additions and 36 deletions

View file

@ -18,7 +18,8 @@ class RepositoriesController < ApplicationController
format.json do
render json: {
html: render_to_string(
partial: 'repositories/repository_tab_content.html.erb'
partial: 'repositories/repository.html.erb',
locals: { repository: @repository }
)
}
end

View file

@ -1,35 +0,0 @@
<div id="repository-toolbar">
<div class="dropdown text-right">
<div class="btn btn-default btn-xs"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true"
<%= "disabled='disabled'" if !can_edit_and_destroy_repository @repository %>>
<span class="glyphicon glyphicon-cog"></span>
<span class="caret"></span>
</div>
<% if can_edit_and_destroy_repository @repository %>
<ul class="dropdown-menu pull-right">
<li class="dropdown-header">
<%= t("repositories.index.options_dropdown.header") %>
</li>
<li>
<%= link_to t('repositories.index.options_dropdown.rename'),
team_repository_rename_modal_path(repository_id: @repository),
class: "rename-repo-option",
remote: true %>
</li>
<li role="separator" class="divider"></li>
<li>
<%= link_to t('repositories.index.modal_delete.delete'),
team_repository_destroy_modal_path(repository_id: @repository),
class: "delete-repo-option",
remote: true %>
</li>
</ul>
<% end %>
</div>
</div>
<%= render partial: 'repositories/repository.html.erb', locals: { repository: @repository } %>

View file

@ -38,6 +38,39 @@
<% @repositories.each do |repo| %>
<div class="tab-pane tab-pane-settings" id="custom_repo_<%= repo.id %>">
<!-- Tab Content -->
<div id="repository-toolbar">
<div class="dropdown text-right">
<div class="btn btn-default btn-xs"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true"
<%= "disabled='disabled'" if !can_edit_and_destroy_repository repo %>>
<span class="glyphicon glyphicon-cog"></span>
<span class="caret"></span>
</div>
<% if can_edit_and_destroy_repository repo %>
<ul class="dropdown-menu pull-right">
<li class="dropdown-header">
<%= t("repositories.index.options_dropdown.header") %>
</li>
<li>
<%= link_to t('repositories.index.options_dropdown.rename'),
team_repository_rename_modal_path(repository_id: repo),
class: "rename-repo-option",
remote: true %>
</li>
<li role="separator" class="divider"></li>
<li>
<%= link_to t('repositories.index.modal_delete.delete'),
team_repository_destroy_modal_path(repository_id: repo),
class: "delete-repo-option",
remote: true %>
</li>
</ul>
<% end %>
</div>
</div>
<div class="tab-content-body"></div>
</div>
<% end %>