Commit 5babf538 authored by Jan Provaznik's avatar Jan Provaznik

Move requirements under requirements_management

* updates controller and its route
* views
* js file location
parent 71d1d51e
# frozen_string_literal: true # frozen_string_literal: true
class Projects::RequirementsController < Projects::ApplicationController class Projects::RequirementsManagement::RequirementsController < Projects::ApplicationController
before_action :authorize_read_requirement! before_action :authorize_read_requirement!
before_action :verify_requirements_management_flag! before_action :verify_requirements_management_flag!
before_action do before_action do
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
- return unless can?(current_user, :read_requirement, project) - return unless can?(current_user, :read_requirement, project)
= nav_link(path: 'requirements#index') do = nav_link(path: 'requirements#index') do
= link_to project_requirements_path(project), class: 'qa-project-requirements-link' do = link_to project_requirements_management_requirements_path(project), class: 'qa-project-requirements-link' do
.nav-icon-container .nav-icon-container
= sprite_icon('requirements') = sprite_icon('requirements')
%span.nav-item-name %span.nav-item-name
= _('Requirements') = _('Requirements')
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items
= nav_link(path: 'requirements#index', html_options: { class: "fly-out-top-item" } ) do = nav_link(path: 'requirements#index', html_options: { class: "fly-out-top-item" } ) do
= link_to project_requirements_path(project) do = link_to project_requirements_management_requirements_path(project) do
%strong.fly-out-top-item-name= _('Requirements') %strong.fly-out-top-item-name= _('Requirements')
%li.divider.fly-out-top-item %li.divider.fly-out-top-item
= nav_link(path: 'requirements#index', html_options: { class: 'home' }) do = nav_link(path: 'requirements#index', html_options: { class: 'home' }) do
= link_to project_requirements_path(project), title: 'List' do = link_to project_requirements_management_requirements_path(project), title: 'List' do
%span= _('List') %span= _('List')
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
opened: requirements_count['opened'], opened: requirements_count['opened'],
archived: requirements_count['archived'], archived: requirements_count['archived'],
all: total_requirements, all: total_requirements,
requirements_web_url: project_requirements_path(@project), requirements_web_url: project_requirements_management_requirements_path(@project),
can_create_requirement: can?(current_user, :create_requirement, @project), can_create_requirement: can?(current_user, :create_requirement, @project),
empty_state_path: image_path('illustrations/empty-state/empty-requirements-lg.svg') } } empty_state_path: image_path('illustrations/empty-state/empty-requirements-lg.svg') } }
- if current_tab_count == 0 - if current_tab_count == 0
......
---
title: Change UI requirements route from project/requirements to project/requirements_management/requirements
merge_request: 30583
author:
type: changed
...@@ -11,7 +11,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -11,7 +11,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Begin of the /-/ scope. # Begin of the /-/ scope.
# Use this scope for all new project routes. # Use this scope for all new project routes.
scope '-' do scope '-' do
resources :requirements, only: [:index] namespace :requirements_management do
resources :requirements, only: [:index]
end
resources :packages, only: [:index, :show, :destroy], module: :packages resources :packages, only: [:index, :show, :destroy], module: :packages
resources :package_files, only: [], module: :packages do resources :package_files, only: [], module: :packages do
member do member do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe Projects::RequirementsController do describe Projects::RequirementsManagement::RequirementsController do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
......
...@@ -35,7 +35,7 @@ describe 'Requirements list', :js do ...@@ -35,7 +35,7 @@ describe 'Requirements list', :js do
context 'when requirements exist for the project' do context 'when requirements exist for the project' do
before do before do
visit project_requirements_path(project) visit project_requirements_management_requirements_path(project)
wait_for_requests wait_for_requests
end end
...@@ -245,7 +245,7 @@ describe 'Requirements list', :js do ...@@ -245,7 +245,7 @@ describe 'Requirements list', :js do
context 'when accessing project as guest user' do context 'when accessing project as guest user' do
before do before do
sign_in(user_guest) sign_in(user_guest)
visit project_requirements_path(project) visit project_requirements_management_requirements_path(project)
wait_for_requests wait_for_requests
end end
......
...@@ -7,9 +7,9 @@ describe 'EE-specific project routing' do ...@@ -7,9 +7,9 @@ describe 'EE-specific project routing' do
allow(Project).to receive(:find_by_full_path).with('gitlab/gitlabhq', any_args).and_return(true) allow(Project).to receive(:find_by_full_path).with('gitlab/gitlabhq', any_args).and_return(true)
end end
describe Projects::RequirementsController, 'routing', type: :routing do describe Projects::RequirementsManagement::RequirementsController, 'routing', type: :routing do
it "to #index" do it "to #index" do
expect(get("/gitlab/gitlabhq/-/requirements")).to route_to('projects/requirements#index', namespace_id: 'gitlab', project_id: 'gitlabhq') expect(get("/gitlab/gitlabhq/-/requirements_management/requirements")).to route_to('projects/requirements_management/requirements#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment