Skip to content

Commit

Permalink
Merge pull request #8281 from dmarcoux/bootstrap-patchinfo
Browse files Browse the repository at this point in the history
Replace Bento views by Bootstrap views for patchinfo
  • Loading branch information
David Kang committed Sep 6, 2019
2 parents 4860667 + 8a06bcf commit 61e71d7
Show file tree
Hide file tree
Showing 18 changed files with 122 additions and 379 deletions.
4 changes: 0 additions & 4 deletions src/api/app/controllers/webui/patchinfo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ def destroy
end
end

def delete_dialog
render_dialog
end

def update_issues
authorize @project, :update?

Expand Down
11 changes: 0 additions & 11 deletions src/api/app/views/webui/patchinfo/_delete_dialog.html.haml

This file was deleted.

137 changes: 0 additions & 137 deletions src/api/app/views/webui/patchinfo/_form.html.haml

This file was deleted.

50 changes: 48 additions & 2 deletions src/api/app/views/webui/patchinfo/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
- @pagetitle = "Edit Patchinfo for #{@project}"
- patchinfo_bread_crumb 'Edit Patchinfo'
= render partial: 'form'

.card
= render partial: 'webui/package/tabs', locals: { project: @project, package: @package }
.card-body
%h3= @pagetitle

= form_for(@patchinfo, url: update_patchinfo_path(project: @project, package: @package), method: :put, html: { id: 'patchinfo' }) do |form|
= form.hidden_field(:name)
.form-group.col-md-8.col-lg-4
= render partial: 'webui/autocomplete', locals: { html_id: 'patchinfo[packager]', label: 'Packager', value: @patchinfo.packager,
data: { source: autocomplete_users_path } }
.form-group.col-md-6
= form.label(:summary) do
Summary
%abbr.text-danger{ title: 'required' } *
%small.form-text Summarize the changes (minimum 10 characters)
= form.text_area(:summary, required: true, class: 'form-control', minlength: 10)
.form-group.col-md-6
= form.label(:description) do
Description
%abbr.text-danger{ title: 'required' } *
%small.form-text Fully describe the changes (minimum 50 characters)
= form.text_area(:description, required: true, rows: 8, class: 'form-control', minlength: 50)
.form-group.col-sm-6.col-md-2
= form.label(:version)
= form.text_field(:version, class: 'form-control')
.form-group.col-md-6
= form.label(:message)
= form.text_area(:message, rows: 4, class: 'form-control')
.form-group.col-sm-6.col-md-3
= form.label(:category)
= form.select(:category, options_for_select(Patchinfo::CATEGORIES, @patchinfo.category), {}, class: 'custom-select')
.form-group.col-sm-6.col-md-3
= form.label(:rating)
= form.select(:rating, options_for_select(Patchinfo::RATINGS, @patchinfo.rating), {}, class: 'custom-select')
= render partial: 'webui/patchinfo/form/issues',
locals: { form: form, issues: @patchinfo.issues, project: @project, package: @package }
= render partial: 'webui/patchinfo/form/required_actions',
locals: { form: form, zypp_restart_needed: @zypp_restart_needed, relogin: @relogin, reboot: @reboot }
= render partial: 'webui/patchinfo/form/binaries',
locals: { form: form, binarylist: @binarylist, binaries: @patchinfo.binaries }
= render partial: 'webui/patchinfo/form/block_release',
locals: { form: form, patchinfo_block: @patchinfo.block }

= form.submit('Save', class: 'btn btn-primary', data: { disable_with: 'Saving...' })

- content_for :ready_function do
setupPatchinfo();
135 changes: 51 additions & 84 deletions src/api/app/views/webui/patchinfo/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,86 +1,53 @@
- @pagetitle = @package
- patchinfo_bread_crumb 'Patchinfo'
= render partial: 'webui/package/tabs'
.section
.grid_8.alpha
.box.show_left.show_right
.box{ style: "background-color:#DDDDDD; margin-top: 0" }
%h2{ style: "display: inline" }
= @patchinfo.category
update for #{truncate(@pkg_names.join(', '), length: 20)}

.card.mb-3
= render partial: 'webui2/webui/package/tabs', locals: { project: @project, package: @package }
.card-body
.patchinfo.row
.col-md-8
= patchinfo_header(@patchinfo, @pkg_names)
#description-text
= render partial: 'webui/webui/collapsible_text', locals: { text: @patchinfo.description }
.col-md-4
= render partial: 'side_elements', locals: { patchinfo: @patchinfo, packager: @packager }

.col-md-12
- if User.possibly_nobody.can_modify?(@package)
%ul.horizontal-list
%li
= link_to sprite_tag('package_edit'), edit_patchinfo_path(project: @project, package: @package)
= link_to "Edit patchinfo", edit_patchinfo_path(project: @project, package: @package), id: 'edit-patchinfo'
%li
= link_to(sprite_tag('package_delete'), { action: :delete_dialog, package: @package, project: @project }, remote: true)
= link_to('Delete patchinfo', { action: :delete_dialog, package: @package, project: @project }, remote: true, id: 'delete-patchinfo')
- if @patchinfo.block
.box.ui-state-error.ui-widget-shadow{ style: "min-height:15px;" }
%b This update is currently blocked:
%br/
- if @patchinfo.block_reason.present?
= @patchinfo.block_reason
- else
No reason entered.
%strong#summary= @patchinfo.summary
%br/
%label#info
- if @packager
This update was submitted from #{user_with_realname_and_icon(@packager)} and rated as
- else
This update is rated as
%span{ style: "color: #{patchinfo_rating_color(@patchinfo.rating)}" }= @patchinfo.rating
.box.show_left.show_right
%b Description:
%br/
= description_wrapper(@patchinfo.description)
- if @patchinfo.message.present?
.box.show_left.show_right
%strong Message:
%pre.plain= @patchinfo.message
- if @patchinfo.version
.box.show_left.show_right
%b Version:
%span= @patchinfo.version
.box.show_left.show_right
%b Fixed bugs:
- if @patchinfo.issues.present?
%ul
- @patchinfo.issues.each do |issue|
- if issue[0] == "CVE"
%li
= link_to((issue[1]).to_s, issue[2]) + ": #{issue[3]}"
- else
%li
= link_to("#{issue[0]}##{issue[1]}", issue[2]) + ": #{issue[3]}"
.box.show_left.show_right
%b Required actions:
%br/
%ul
%li
Relogin suggested:
- if @patchinfo.relogin_needed
= image_tag "ok.png", id: "relogin_true"
- else
= image_tag "req-decline.png", id: "relogin_false"
%li
Reboot suggested:
- if @patchinfo.reboot_needed
= image_tag "ok.png", id: "reboot_true"
- else
= image_tag "req-decline.png", id: "reboot_false"
%li
Package-manager restart:
- if @patchinfo.zypp_restart_needed
= image_tag "ok.png", id: "zypp_true"
- else
= image_tag "req-decline.png", id: "zypp_false"
- unless @patchinfo.binaries.empty?
.box.show_left.show_right
%b Selected binaries:
%br/
%ul
- @patchinfo.binaries.each do |bin|
%li= bin
%ul.list-inline.mb-0
%li.list-inline-item
= link_to(edit_patchinfo_path(project: @project, package: @package)) do
%i.fas.fa-edit.text-secondary
Edit patchinfo
%li.list-inline-item
= link_to('#', class: 'nav-link', data: { toggle: 'modal', target: '#delete-patchinfo-modal' }) do
%i.fas.fa-times-circle.text-danger
Delete patchinfo
= render partial: 'delete_patchinfo_modal', locals: { project: @project, package: @package }

.patchinfo.row
- if @patchinfo.message.present?
.col-md-12
.card.mb-3
%h5.card-header Message
.card-body
= simple_format @patchinfo.message

.col-md-6
.card.mb-3
%h5.card-header Fixed bugs
.card-body
- @patchinfo.issues.each do |issue|
.media
%i.pt-1.mr-1.fas.fa-bug.text-danger
.media-body.mb-3
= patchinfo_issue_link(issue[1], issue[0], issue[2])
- if issue[3].present?
%div= issue[3]
.col-md-6
.card.mb-3
%h5.card-header Selected Binaries
.card-body.binaries
- @patchinfo.binaries.each do |binary|
%span.badge.badge-warning
%i.mr-1.fa.fa-archive
= binary
Loading

0 comments on commit 61e71d7

Please sign in to comment.