From 6ef25105b883d7e5c7054845913b6021186b1f11 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Thu, 29 Jun 2017 12:04:20 +0200 Subject: [PATCH] [webui] Flip comment and accept boxes on request#show view because before it was easy to oversee comments. #3184 --- .../app/views/webui/comment/_new.html.haml | 2 +- .../app/views/webui/comment/_show.html.haml | 2 +- src/api/app/views/webui/request/show.html.erb | 161 +++++++++--------- 3 files changed, 84 insertions(+), 81 deletions(-) diff --git a/src/api/app/views/webui/comment/_new.html.haml b/src/api/app/views/webui/comment/_new.html.haml index bab7dc02576..e364702c8d7 100644 --- a/src/api/app/views/webui/comment/_new.html.haml +++ b/src/api/app/views/webui/comment/_new.html.haml @@ -2,5 +2,5 @@ = form_for @comment, method: :post do |f| = hidden_field_tag :commentable_type, commentable.class = hidden_field_tag :commentable_id, commentable.id - ~ f.text_area :body, size: '80x4', onkeyup: 'sz(this);', onclick: 'sz(this);', style: 'width: 90%;', placeholder: 'Add a new comment (markdown markup supported)', required: 'required' + ~ f.text_area :body, size: '80x4', onkeyup: 'sz(this);', onclick: 'sz(this);', placeholder: 'Add a new comment (markdown markup supported)', required: 'required' = f.submit 'Add comment' diff --git a/src/api/app/views/webui/comment/_show.html.haml b/src/api/app/views/webui/comment/_show.html.haml index 53ac735f48a..461573903c5 100644 --- a/src/api/app/views/webui/comment/_show.html.haml +++ b/src/api/app/views/webui/comment/_show.html.haml @@ -8,7 +8,7 @@ = comment_body(comment) = render partial: 'webui/comment/links', locals: { comment: comment } = render partial: 'webui/comment/reply', locals: { comment: comment, level: 0, commentable: commentable } - .comment_new.grid_16.alpha.omega + .comment_new.alpha.omega = render partial: 'webui/comment/new', locals: { commentable: commentable } - content_for :ready_function do setup_comment_page(); diff --git a/src/api/app/views/webui/request/show.html.erb b/src/api/app/views/webui/request/show.html.erb index b191eb4f940..dffeafa8dde 100644 --- a/src/api/app/views/webui/request/show.html.erb +++ b/src/api/app/views/webui/request/show.html.erb @@ -205,87 +205,95 @@
-
-
- <%= possibly_empty_ul id: 'review_descision_select', fallback: "

There's nothing to be done right now

".html_safe do %> - <% if @can_handle_request %> -
  • - My Decision -
  • - <% end %> - <% if @my_open_reviews.length > 0 %> - <% @my_open_reviews.each_with_index do |open_review, index| %> -
  • - Review - for <%= render :partial => 'reviewer', :locals => { :review => open_review, :no_icon => true } %> -
  • - <% end %> - <% end %> - <% content_for :ready_function do %> - requestShowReview(); - <% end %> - <% end %> -
    -
    - <% if @can_handle_request %> - <%= form_tag({ :action => 'changerequest' }, { id: 'request_handle_form' }) do %> - <% if @show_project_maintainer_hint %> -
    - - You are a project maintainer but not a package maintainer. This package - has <%= pluralize(@package_maintainers.size, "package maintainer") %> assigned. Please keep - in mind that also package maintainers would like to review this request. - -
    - <% end %> -

    <%= text_area_tag(:reason, nil, :placeholder => 'Please add a comment', :size => '80x2', :style => 'width: 99%') %>

    -

    - <%= hidden_field_tag(:number, @number) %> - <% if @state.in?(["new", "review"]) && @is_target_maintainer %> - <% if @state == 'review' %> - <%= submit_tag 'Accept request', name: 'accepted', id: 'accept_request_button', data: { confirm: 'Do you really want to approve this request, despite of open review requests?' } %> - <% else %> +

    +

    Comments for request <%= @number %> (<%= @comments.length %>)

    + <%= render :partial => 'webui/comment/show', locals: { commentable: @bsreq } %> +
    - <%= submit_tag 'Accept request', name: 'accepted', id: 'accept_request_button' %> - <% end %> - <%= submit_tag 'Decline request', name: 'declined' if !@is_author %> - <% end %> - <% if @state.in?(["new", "review", "declined"]) && @is_author %> - <%= submit_tag 'Revoke request', name: 'revoked', id: 'revoke_request_button' %> +
    +
    +
    + <%= possibly_empty_ul id: 'review_descision_select', fallback: "

    There's nothing to be done right now

    ".html_safe do %> + <% if @can_handle_request %> +
  • + My Decision +
  • + <% end %> + <% if @my_open_reviews.length > 0 %> + <% @my_open_reviews.each_with_index do |open_review, index| %> +
  • + Review + for <%= render :partial => 'reviewer', :locals => { :review => open_review, :no_icon => true } %> +
  • <% end %> - <% if @state == 'declined' %> - <%= submit_tag 'Reopen request', name: 'new', id: 'reopen_request_button' %> + <% end %> + <% content_for :ready_function do %> + requestShowReview(); + <% end %> + <% end %> +
    +
    + <% if @can_handle_request %> + <%= form_tag({ :action => 'changerequest' }, { id: 'request_handle_form' }) do %> + <% if @show_project_maintainer_hint %> +
    + + You are a project maintainer but not a package maintainer. This package + has <%= pluralize(@package_maintainers.size, "package maintainer") %> assigned. Please keep + in mind that also package maintainers would like to review this request. + +
    <% end %> - - <% if @req['actions'].first[:type] == :maintenance_incident %> - <%= link_to(sprited_text('package_link', 'Merge with existing incident'), { :controller => 'request', :action => 'set_incident_dialog', number: @number }, :remote => true) %> +

    <%= text_area_tag(:reason, nil, :placeholder => 'Please add a comment', :size => '80x2', :style => 'width: 99%') %>

    + +

    + <%= hidden_field_tag(:number, @number) %> + <% if @state.in?(["new", "review"]) && @is_target_maintainer %> + <% if @state == 'review' %> + <%= submit_tag 'Accept request', name: 'accepted', id: 'accept_request_button', data: { confirm: 'Do you really want to approve this request, despite of open review requests?' } %> + <% else %> + + <%= submit_tag 'Accept request', name: 'accepted', id: 'accept_request_button' %> <% end %> - -

    - <% end %> - <% content_for :ready_function do %> - requestAddAcceptRequestButton(); - <% end %> + <%= submit_tag 'Decline request', name: 'declined' if !@is_author %> + <% end %> + <% if @state.in?(["new", "review", "declined"]) && @is_author %> + <%= submit_tag 'Revoke request', name: 'revoked', id: 'revoke_request_button' %> + <% end %> + <% if @state == 'declined' %> + <%= submit_tag 'Reopen request', name: 'new', id: 'reopen_request_button' %> + <% end %> + + <% if @req['actions'].first[:type] == :maintenance_incident %> + <%= link_to(sprited_text('package_link', 'Merge with existing incident'), { :controller => 'request', :action => 'set_incident_dialog', number: @number }, :remote => true) %> + <% end %> + +

    + <% end %> + <% content_for :ready_function do %> + requestAddAcceptRequestButton(); + <% end %> + <% end %> +
    + <% @my_open_reviews.each_with_index do |review, index| %> +
    + <%= form_tag(:action => 'modify_review') do %> +

    <%= text_area_tag("review_comment_#{index}", review[:reason], :size => '80x2', :style => 'width: 99%', :class => 'review_comment', :placeholder => 'Please comment on your decision') %>

    + +

    + <%= hidden_field_tag("review_request_number_#{index}", @number) %> + <%= hidden_field_tag("review_by_user_#{index}", review[:by_user]) if review[:by_user] %> + <%= hidden_field_tag("review_by_group_#{index}", review[:by_group]) if review[:by_group] %> + <%= hidden_field_tag("review_by_project_#{index}", review[:by_project]) if review[:by_project] %> + <%= hidden_field_tag("review_by_package_#{index}", review[:by_package]) if review[:by_package] %> + <%= submit_tag 'Approve', name: 'accepted', id: "review_accept_button_#{index}", title: 'Give this request your blessing, it will continue.' %> + <%= submit_tag 'Disregard', name: 'declined', id: "review_decline_button_#{index}", title: 'Veto this request, it will be declined.' %> +

    + <% end %> +
    <% end %>
    - <% @my_open_reviews.each_with_index do |review, index| %> -
    - <%= form_tag(:action => 'modify_review') do %> -

    <%= text_area_tag("review_comment_#{index}", review[:reason], :size => '80x2', :style => 'width: 99%', :class => 'review_comment', :placeholder => 'Please comment on your decision') %>

    - -

    - <%= hidden_field_tag("review_request_number_#{index}", @number) %> - <%= hidden_field_tag("review_by_user_#{index}", review[:by_user]) if review[:by_user] %> - <%= hidden_field_tag("review_by_group_#{index}", review[:by_group]) if review[:by_group] %> - <%= hidden_field_tag("review_by_project_#{index}", review[:by_project]) if review[:by_project] %> - <%= hidden_field_tag("review_by_package_#{index}", review[:by_package]) if review[:by_package] %> - <%= submit_tag 'Approve', name: 'accepted', id: "review_accept_button_#{index}", title: 'Give this request your blessing, it will continue.' %> - <%= submit_tag 'Disregard', name: 'declined', id: "review_decline_button_#{index}", title: 'Veto this request, it will be declined.' %> -

    - <% end %> -
    - <% end %>
    @@ -298,9 +306,4 @@
    -
    -

    Comments for request <%= @number %> (<%= @comments.length %>)

    - <%= render :partial => 'webui/comment/show', locals: { commentable: @bsreq } %> -
    - <%= render :partial => 'webui/request/package_maintainers_dialog' %>