After repository renaming user is redirected to the same repository. Removed the unimplemented repository copy dropdown option. [SCI-1269]

This commit is contained in:
Matej Zrimšek 2017-06-02 19:08:51 +02:00
parent 73aaef0949
commit d8d54232c3
4 changed files with 12 additions and 14 deletions

View file

@ -42,9 +42,9 @@
if ($modal) {
var form = $modal.find('form');
form
.on('ajax:success', function() {
.on('ajax:success', function(ev, data) {
animateSpinner(form, true);
location.reload();
$(location).attr('href', data.url);
})
.on('ajax:error', function(e, error) {
var msg = JSON.parse(error.responseText);

View file

@ -52,7 +52,9 @@ class RepositoriesController < ApplicationController
if @repository.save
flash[:success] = t('repositories.index.rename_flash',
old_name: old_name, new_name: @repository.name)
render json: {}, status: :ok
render json: {
url: team_repositories_path(@team, repository: @repository)
}, status: :ok
else
render json: @repository.errors, status: :unprocessable_entity
end

View file

@ -6,9 +6,12 @@
<!-- Nav tabs -->
<% if @repositories.present? %>
<% active_repo = @repositories.find_by_id(params[:repository]) %>
<% active_repo = @repositories.first if !active_repo %>
<ul class="nav nav-tabs nav-settings" role="tablist" id="tabs">
<% @repositories.each.with_index do |repo, i| %>
<li role="presentation" class="<%= 'active' if i == 0 %>">
<% @repositories.each do |repo| %>
<li role="presentation" class="<%= 'active' if repo == active_repo %>">
<a class="repository-nav-tab"
href="#custom_repo_<%= repo.id %>"
data-toggle="tab"
@ -19,8 +22,8 @@
</ul>
<!-- Tab panes -->
<div class="tab-content">
<% @repositories.each.with_index do |repo, i| %>
<div class="tab-pane tab-pane-settings <%= 'active' if i == 0 %>" id="custom_repo_<%= repo.id %>">
<% @repositories.each do |repo| %>
<div class="tab-pane tab-pane-settings <%= 'active' if repo == active_repo %>" id="custom_repo_<%= repo.id %>">
<!-- Tab Content -->
<div id="repository-toolbar">
@ -45,12 +48,6 @@
class: "rename-repo-option",
remote: true %>
</li>
<li>
<!-- TODO -->
<a href="#">
<%= t("repositories.index.options_dropdown.copy") %>
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<%= link_to t('repositories.index.modal_delete.delete'),

View file

@ -161,7 +161,6 @@ en:
options_dropdown:
header: "Edit repository"
rename: "Rename"
copy: "Copy"
delete: "Delete"
modal_delete:
title_html: "Delete repository <em>%{name}</em>"