Fixe repository rename modal submit button. Consistent variable renaming. [SCI-1269]

This commit is contained in:
Matej Zrimšek 2017-06-02 17:38:46 +02:00
parent c82fd66146
commit 73aaef0949
3 changed files with 12 additions and 11 deletions

View file

@ -22,9 +22,10 @@ class RepositoriesController < ApplicationController
end
def destroy
@repo = Repository.find(params[:id])
flash[:success] = t('repositories.index.delete_flash', name: @repo.name)
@repo.destroy
@repository = Repository.find(params[:id])
flash[:success] = t('repositories.index.delete_flash',
name: @repository.name)
@repository.destroy
redirect_to :back
end
@ -42,18 +43,18 @@ class RepositoriesController < ApplicationController
end
def update
@repo = Repository.find(params[:id])
old_name = @repo.name
@repo.update_attributes(repository_params)
@repository = Repository.find(params[:id])
old_name = @repository.name
@repository.update_attributes(repository_params)
respond_to do |format|
format.json do
if @repo.save
if @repository.save
flash[:success] = t('repositories.index.rename_flash',
old_name: old_name, new_name: @repo.name)
old_name: old_name, new_name: @repository.name)
render json: {}, status: :ok
else
render json: @repo.errors, status: :unprocessable_entity
render json: @repository.errors, status: :unprocessable_entity
end
end
end

View file

@ -23,7 +23,7 @@
</div>
</div>
<div class="modal-footer">
<%= f.submit t("repositories.index.modal_rename.copy"), class: "btn btn-primary" %>
<%= f.submit t("repositories.index.modal_rename.rename"), class: "btn btn-primary" %>
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
</div>
</div>

View file

@ -174,7 +174,7 @@ en:
title_html: "Rename repository <em>%{name}</em>"
name: "New repository name"
name_placeholder: "My repository"
copy: "Copy repository"
rename: "Rename repository"
nav:
breadcrumbs:
repositories: "Repositories"