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