Commit 9004e18e authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Alessio Caiazza

Adds releases index route

Renders empty index page
Adds Releases entry to the navigation bar behind a feature flag
Renders 404 when feature flag for releases is not enabled
parent a3049115
......@@ -8,6 +8,7 @@ export default class ShortcutsNavigation extends Shortcuts {
Mousetrap.bind('g p', () => findAndFollowLink('.shortcuts-project'));
Mousetrap.bind('g v', () => findAndFollowLink('.shortcuts-project-activity'));
Mousetrap.bind('g r', () => findAndFollowLink('.shortcuts-project-releases'));
Mousetrap.bind('g f', () => findAndFollowLink('.shortcuts-tree'));
Mousetrap.bind('g c', () => findAndFollowLink('.shortcuts-commits'));
Mousetrap.bind('g j', () => findAndFollowLink('.shortcuts-builds'));
......
......@@ -4,9 +4,13 @@ class Projects::ReleasesController < Projects::ApplicationController
# Authorize
before_action :require_non_empty_project
before_action :authorize_download_code!
before_action :authorize_push_code!
before_action :tag
before_action :release
before_action :authorize_push_code!, except: [:index]
before_action :tag, except: [:index]
before_action :release, except: [:index]
before_action :check_releases_page_feature_flag, only: [:index]
def index
end
def edit
end
......@@ -26,6 +30,12 @@ class Projects::ReleasesController < Projects::ApplicationController
private
def check_releases_page_feature_flag
return render_404 unless Feature.enabled?(:releases_page)
push_frontend_feature_flag(:releases_page)
end
def tag
@tag ||= @repository.find_tag(params[:tag_id])
end
......
......@@ -277,7 +277,7 @@ module ProjectsHelper
nav_tabs = [:home]
if !project.empty_repo? && can?(current_user, :download_code, project)
nav_tabs << [:files, :commits, :network, :graphs, :forks]
nav_tabs << [:files, :commits, :network, :graphs, :forks, :releases]
end
if project.repo_exists? && can?(current_user, :read_merge_request, project)
......@@ -533,6 +533,7 @@ module ProjectsHelper
%w[
projects#show
projects#activity
releases#index
cycle_analytics#show
]
end
......@@ -564,7 +565,6 @@ module ProjectsHelper
projects/repositories
tags
branches
releases
graphs
network
]
......
......@@ -29,6 +29,11 @@
= link_to activity_project_path(@project), title: _('Activity'), class: 'shortcuts-project-activity' do
%span= _('Activity')
- if project_nav_tab?(:releases) && Feature.enabled?(:releases_page)
= nav_link(controller: :releases) do
= link_to project_releases_path(@project), title: _('Releases'), class: 'shortcuts-project-releases' do
%span= _('Releases')
= render_if_exists 'projects/sidebar/security_dashboard'
- if can?(current_user, :read_cycle_analytics, @project)
......@@ -62,7 +67,7 @@
= link_to project_branches_path(@project) do
= _('Branches')
= nav_link(controller: [:tags, :releases]) do
= nav_link(controller: [:tags]) do
= link_to project_tags_path(@project) do
= _('Tags')
......
- @no_container = true
- page_title _('Releases')
%div{ 'class' => container_class }
#js-releases-page
......@@ -95,6 +95,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :releases, only: [:index]
resources :forks, only: [:index, :new, :create]
resource :import, only: [:new, :create, :show]
......
......@@ -5506,6 +5506,9 @@ msgstr ""
msgid "Related merge requests"
msgstr ""
msgid "Releases"
msgstr ""
msgid "Remind later"
msgstr ""
......
......@@ -49,4 +49,30 @@ describe 'layouts/nav/sidebar/_project' do
expect(rendered).to have_css('.sidebar-top-level-items > li.active', text: 'Registry')
end
end
describe 'releases entry' do
describe 'when releases feature flag is disabled' do
before do
stub_feature_flags(releases_page: false)
end
it 'does not render releases link' do
render
expect(rendered).not_to have_link('Releases', href: project_releases_path(project))
end
end
describe 'when releases feature flags is enabled' do
before do
stub_feature_flags(releases_page: true)
end
it 'renders releases link' do
render
expect(rendered).to have_link('Releases', href: project_releases_path(project))
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