Commit ce5ef00f authored by Coung Ngo's avatar Coung Ngo

Add iteration page within projects

Add Iteration link under Issues in the left sidebar, and add
iterations index page within a project to allow users to
eventually view an interation report at a project level
parent 85aeffd2
......@@ -85,7 +85,7 @@
%span
= _('Milestones')
= render_if_exists 'layouts/nav/sidebar/iterations_link'
= render_if_exists 'layouts/nav/sidebar/group_iterations_link'
- if group_sidebar_link?(:merge_requests)
= nav_link(path: 'groups#merge_requests') do
......
......@@ -121,6 +121,8 @@
%span
= _('Milestones')
= render_if_exists 'layouts/nav/sidebar/project_iterations_link'
- if project_nav_tab?(:external_issue_tracker)
- issue_tracker = @project.external_issue_tracker
- if issue_tracker.is_a?(JiraService) && project_jira_issues_integration?
......
# frozen_string_literal: true
class Projects::IterationsController < Projects::ApplicationController
before_action :check_iterations_available!
before_action :authorize_show_iteration!, only: [:index]
def index; end
private
def check_iterations_available!
render_404 unless project.feature_available?(:iterations)
end
def authorize_show_iteration!
render_404 unless can?(current_user, :read_iteration, project)
end
end
- return unless License.feature_available?(:iterations)
- return unless Feature.enabled?(:group_iterations, @group, default_enabled: true)
= nav_link(controller: :iterations) do
= link_to project_iterations_path(@project), title: _('Iterations') do
%span
= _('Iterations')
---
title: Add iteration page within projects
merge_request: 37715
author:
type: added
......@@ -111,6 +111,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resources :issues, only: [:index]
end
end
resources :iterations, only: [:index]
end
# End of the /-/ scope.
......
......@@ -11,6 +11,8 @@ RSpec.describe 'Project navbar' do
let_it_be(:project) { create(:project, :repository) }
before do
stub_feature_flags(group_iterations: false)
insert_package_nav(_('Operations'))
project.add_maintainer(user)
......@@ -97,4 +99,21 @@ RSpec.describe 'Project navbar' do
it_behaves_like 'verified navigation bar'
end
context 'when iterations is available' do
before do
stub_licensed_features(iterations: true)
stub_feature_flags(group_iterations: true)
insert_after_sub_nav_item(
_('Milestones'),
within: _('Issues'),
new_sub_nav_item_name: _('Iterations')
)
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
end
......@@ -245,4 +245,56 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).to have_link('Operations', href: project_settings_operations_path(project))
end
end
describe 'iterations link' do
let_it_be(:current_user) { create(:user) }
before do
project.add_guest(current_user)
allow(view).to receive(:current_user).and_return(current_user)
end
context 'with iterations licensed feature available' do
before do
stub_licensed_features(iterations: true)
end
context 'with group iterations feature flag enabled' do
before do
stub_feature_flags(group_iterations: true)
end
it 'is visible' do
render
expect(rendered).to have_text 'Iterations'
end
end
context 'with iterations feature flag disabled' do
before do
stub_feature_flags(group_iterations: false)
end
it 'is not visible' do
render
expect(rendered).not_to have_text 'Iterations'
end
end
end
context 'with iterations licensed feature disabled' do
before do
stub_licensed_features(iterations: false)
end
it 'is not visible' do
render
expect(rendered).not_to have_text 'Iterations'
end
end
end
end
......@@ -12,6 +12,8 @@ RSpec.describe 'Project navbar' do
let_it_be(:project) { create(:project, :repository) }
before do
stub_feature_flags(group_iterations: false)
insert_package_nav(_('Operations'))
project.add_maintainer(user)
......
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