Skip to content

Commit

Permalink
Switch Project config page to bootstrap
Browse files Browse the repository at this point in the history
Converted the view and changed the controller to show the right thing

Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de>
  • Loading branch information
Moises Deniz Aleman and saraycp committed Nov 27, 2018
1 parent 5f245dd commit bd7a569
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/api/app/controllers/webui/project_controller.rb
Expand Up @@ -539,6 +539,7 @@ def prjconf
sliced_params.permit!

@content = @project.config.content(sliced_params.to_h)
switch_to_webui2
return if @content
flash[:error] = @project.config.errors.full_messages.to_sentence
redirect_to controller: 'project', nextstatus: 404
Expand All @@ -555,11 +556,13 @@ def save_prjconf

if content
flash.now[:success] = 'Config successfully saved!'
render layout: false, partial: 'layouts/webui/flash', object: flash
status = 200
else
flash.now[:error] = @project.config.errors.full_messages.to_sentence
render layout: false, status: 400, partial: 'layouts/webui/flash', object: flash
status = 400
end
switch_to_webui2
render layout: false, status: status, partial: 'layouts/webui2/flash', object: flash
end

def clear_failed_comment
Expand Down
Expand Up @@ -10,3 +10,6 @@
- if current_page?(project_requests_path)
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
Requests
- elsif current_page?(project_config_path(@project))
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
Configuration
16 changes: 16 additions & 0 deletions src/api/app/views/webui2/webui/project/prjconf.html.haml
@@ -0,0 +1,16 @@
:ruby
content_for(:content_for_head, javascript_include_tag('webui2/cm2/index-prjconf'))
@pagetitle = "Project Configuration of #{@project}"
@metarobots = 'noindex'

.card
= render(partial: 'webui/project/tabs', locals: { project: @project })

.card-body
%h3= @pagetitle
- if User.current.can_modify?(@project)
= render partial: 'shared/editor', locals: { text: @content, mode: 'prjconf',
save: { url: save_project_config_path, method: :post,
data: { project: @project.name, submit: 'config' } } }
- else
= render partial: 'shared/editor', locals: { text: @content, mode: 'prjconf', style: { read_only: true } }
2 changes: 1 addition & 1 deletion src/api/config/routes.rb
Expand Up @@ -283,7 +283,7 @@ def self.public_or_about_path?(request)
get 'project/meta/:project' => :meta, constraints: cons, as: 'project_meta'
post 'project/save_meta/:project' => :save_meta, constraints: cons
get 'project/prjconf/:project' => :prjconf, constraints: cons, as: :project_config
post 'project/save_prjconf/:project' => :save_prjconf, constraints: cons
post 'project/save_prjconf/:project' => :save_prjconf, constraints: cons, as: :save_project_config
get 'project/clear_failed_comment/:project' => :clear_failed_comment, constraints: cons
get 'project/edit/:project' => :edit, constraints: cons
get 'project/edit_comment_form/:project' => :edit_comment_form, constraints: cons
Expand Down

0 comments on commit bd7a569

Please sign in to comment.