Skip to content

Commit

Permalink
Merge pull request #9536 from dmarcoux/release-request-modal-to-page
Browse files Browse the repository at this point in the history
Move project release request modal to its own page
  • Loading branch information
dmarcoux committed May 12, 2020
2 parents 1fc5fa4 + 9948044 commit a2c5b7d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 27 deletions.
8 changes: 6 additions & 2 deletions src/api/app/controllers/webui/project_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class Webui::ProjectController < Webui::WebuiController

before_action :lockout_spiders, only: [:requests, :buildresults]

before_action :require_login, only: [:create, :toggle_watch, :destroy, :new,
before_action :require_login, only: [:create, :toggle_watch, :destroy, :new, :release_request,
:new_release_request, :new_package, :edit_comment]

before_action :set_project, only: [:autocomplete_repositories, :users, :subprojects,
:new_package, :edit,
:new_package, :edit, :release_request,
:show, :buildresult,
:destroy, :remove_path_from_target,
:requests, :save, :monitor, :toggle_watch,
Expand Down Expand Up @@ -91,6 +91,10 @@ def new_package
authorize @project, :update?
end

def release_request
authorize @project, :update?
end

def new_release_request
if params[:skiprequest]
# FIXME2.3: do it directly here, api function missing
Expand Down
3 changes: 3 additions & 0 deletions src/api/app/views/webui/project/_breadcrumb_items.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@
- elsif current_page?(project_subprojects_path(@project))
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
Subprojects
- elsif current_page?(project_release_request_path(@project))
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
Create Maintenance Release Request

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%li.list-inline-item
= link_to('#', class: 'nav-link', data: { toggle: 'modal', target: '#project-release-request-modal' }) do
= link_to(project_release_request_path(@project), class: 'nav-link') do
%i.fas.fa-share-square.text-warning
Request to Release
22 changes: 22 additions & 0 deletions src/api/app/views/webui/project/release_request.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- @pagetitle = 'Create Maintenance Release Request'

.row
.col
.card
= render partial: 'tabs', locals: { project: @project }
.card-body
.row
.col-12
%h3= @pagetitle
.col-12
%p Do you want to release #{link_to(@project, project_show_path(@project))} as a maintenance update?
.col-12.col-md-9.col-lg-6
= form_tag(project_new_release_request_path(@project)) do
= hidden_field_tag(:project, @project.name)
.form-group
= label_tag(:sourceproject, 'From Project:')
= text_field_tag(:sourceproject, @project.name, disabled: true, class: 'form-control')
.form-group
= label_tag(:description, 'Description:')
= text_area_tag(:description, '', rows: 3, class: 'form-control')
= submit_tag('Create', class: 'btn btn-sm btn-primary px-4')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%li.nav-item
= link_to('#', class: 'nav-link', data: { toggle: 'modal', target: '#project-release-request-modal' }) do
= link_to(project_release_request_path(@project), class: 'nav-link') do
%i.fas.fa-share-square.fa-lg.mr-2
Request to Release
4 changes: 1 addition & 3 deletions src/api/app/views/webui/project/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@
= render partial: 'create_package_modal', locals: { project: @project }
= render partial: 'new_package_branch_modal', locals: { project: @project, remote_projects: @remote_projects }

- if can_be_released?(@project, @packages, @open_release_requests, @has_patchinfo)
= render partial: 'project_release_request_dialog', locals: { project: @project }
- elsif !@project.is_maintenance?
- if !can_be_released?(@project, @packages, @open_release_requests, @has_patchinfo) && !@project.is_maintenance?
= render partial: 'project_submit_update_dialog', locals: { project: @project, release_targets: @releasetargets }
- elsif !@project.is_locked?
= render partial: 'webui/request/add_role_request_dialog', locals: { project: @project }
Expand Down
1 change: 1 addition & 0 deletions src/api/config/routes/webui_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
get 'project/subprojects/:project' => :subprojects, constraints: cons, as: 'project_subprojects'
get 'project/attributes/:project', to: redirect('/attribs/%{project}'), constraints: cons
get 'project/new_package/:project' => :new_package, constraints: cons, as: 'project_new_package'
get 'project/release_request/(:project)' => :release_request, constraints: cons, as: :project_release_request
post 'project/new_release_request/(:project)' => :new_release_request, constraints: cons, as: :project_new_release_request
get 'project/show/:project' => :show, constraints: cons, as: 'project_show'
get 'project/buildresult' => :buildresult, constraints: cons, as: 'project_buildresult'
Expand Down

0 comments on commit a2c5b7d

Please sign in to comment.