diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 23c53bdfb..0d2454de6 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -3,10 +3,8 @@ class RepositoriesController < ApplicationController before_action :check_view_all_permissions, only: :index before_action :check_edit_and_destroy_permissions, only: %(destroy destroy_modal rename_modal update) - before_action :check_create_permissions, only: [ - :create_new_modal, - :create - ] + before_action :check_create_permissions, only: + %(create_new_modal create) def index render('repositories/index') @@ -34,9 +32,9 @@ class RepositoriesController < ApplicationController respond_to do |format| if @repository.save - flash[:success] = t("repositories.create.success_flash", name: @repository.name) + flash[:success] = t("repositories.index.modal_create.success_flash", name: @repository.name) format.json { - render json: { url: team_repositories_path(@team, create_action: true) }, + render json: { url: team_repositories_path(repository: @repository) }, status: :ok } else diff --git a/app/views/repositories/index/_create_new_modal.html.erb b/app/views/repositories/index/_create_new_modal.html.erb index 8a243e238..881f69203 100644 --- a/app/views/repositories/index/_create_new_modal.html.erb +++ b/app/views/repositories/index/_create_new_modal.html.erb @@ -4,12 +4,12 @@ diff --git a/app/views/repositories/index/_create_new_modal_body.html.erb b/app/views/repositories/index/_create_new_modal_body.html.erb index f7eea8f87..8a6b739bf 100644 --- a/app/views/repositories/index/_create_new_modal_body.html.erb +++ b/app/views/repositories/index/_create_new_modal_body.html.erb @@ -1,3 +1,3 @@ <%= bootstrap_form_for [@team, @new_repository], remote: :true do |f| %> - <%= f.text_field :name, label: t("repositories.create.name_label"), placeholder: t("repositories.create.name_placeholder") %> + <%= f.text_field :name, label: t("repositories.index.modal_create.name_label"), placeholder: t("repositories.index.modal_create.name_placeholder") %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 135b91687..0dfbbd71d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -177,12 +177,12 @@ en: name: "New repository name" name_placeholder: "My repository" rename: "Rename repository" - create: - title: "Create new repository" - name_label: "Repository name" - name_placeholder: "My repository" - submit: "Create repository" - success_flash: "Repository %{name} successfully created." + modal_create: + title: "Create new repository" + name_label: "Repository name" + name_placeholder: "My repository" + submit: "Create repository" + success_flash: "Repository %{name} successfully created." comments: options_dropdown: