|
4 | 4 | .card-body#canned-responses |
5 | 5 | %h4 Your canned responses |
6 | 6 | - if @canned_responses.present? |
7 | | - .d-flex.flex-wrap.gap-4.align-self-stretch.pt-4 |
8 | | - - @canned_responses.each do |canned_response| |
9 | | - = render(CardComponent.new) do |component| |
10 | | - - if canned_response.decision_type |
11 | | - %p.card-text |
12 | | - %b Decision's reason: |
13 | | - %span.mb-2= canned_response.decision_type.humanize |
14 | | - %p.card-text |
15 | | - %b Content: |
16 | | - .canned-response-card-text.mb-2 |
17 | | - = render partial: 'webui/shared/collapsible_text', locals: { text: canned_response.content, render_markdown: true } |
| 7 | + %ul.list-group.list-group-flush |
| 8 | + - canned_responses_decision_types = @canned_responses.pluck(:decision_type).uniq |
| 9 | + - canned_responses_decision_types.each do |decision_type| |
| 10 | + %li.list-group-item.py-4 |
| 11 | + %h5= decision_type.humanize |
| 12 | + .d-flex.flex-wrap.gap-4.align-self-stretch |
| 13 | + - @canned_responses.filter { |cr| cr.decision_type == decision_type }.each do |canned_response| |
| 14 | + = render(CardComponent.new) do |component| |
| 15 | + - if canned_response.decision_type |
| 16 | + %p.card-text |
| 17 | + %b Decision's reason: |
| 18 | + %span.mb-2= canned_response.decision_type.humanize |
| 19 | + %p.card-text |
| 20 | + %b Content: |
| 21 | + .canned-response-card-text.mb-2 |
| 22 | + = render partial: 'webui/shared/collapsible_text', locals: { text: canned_response.content, render_markdown: true } |
18 | 23 |
|
19 | | - - component.with_header do |
20 | | - = canned_response.title |
| 24 | + - component.with_header do |
| 25 | + = canned_response.title |
21 | 26 |
|
22 | | - - component.with_delete_button do |
23 | | - = link_to '#', title: 'Delete Canned Response', |
24 | | - data: { 'bs-toggle': 'modal', 'bs-target': '#delete-canned-response-modal', |
25 | | - canned_response_title: canned_response.title, action: canned_response_path(canned_response) } do |
26 | | - %i.fas.fa-times-circle.text-danger |
| 27 | + - component.with_delete_button do |
| 28 | + = link_to '#', title: 'Delete Canned Response', |
| 29 | + data: { 'bs-toggle': 'modal', 'bs-target': '#delete-canned-response-modal', |
| 30 | + canned_response_title: canned_response.title, action: canned_response_path(canned_response) } do |
| 31 | + %i.fas.fa-times-circle.text-danger |
27 | 32 |
|
28 | | - - component.with_action do |
29 | | - = link_to(edit_canned_response_path(canned_response), title: 'Edit Canned Response', class: 'nav-link p-1') do |
30 | | - %i.fas.fa-edit |
31 | | - Edit |
| 33 | + - component.with_action do |
| 34 | + = link_to(edit_canned_response_path(canned_response), title: 'Edit Canned Response', class: 'nav-link p-1') do |
| 35 | + %i.fas.fa-edit |
| 36 | + Edit |
32 | 37 |
|
33 | 38 | .modal.fade#delete-canned-response-modal{ tabindex: -1, role: 'dialog', |
34 | 39 | aria: { labelledby: 'delete-canned-response-modal-label', hidden: true } } |
|
0 commit comments