Skip to content

Commit

Permalink
[#4807] Help partner to remember to submit profile for approval: (#4808)
Browse files Browse the repository at this point in the history
* Duplicate partner actions at top and bottom of long view
* Extract action sto partial to avoid code duplication
* Maintain partner system tests
  • Loading branch information
danielabar authored Nov 30, 2024
1 parent 2ad5ba5 commit f6f64e1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
31 changes: 31 additions & 0 deletions app/views/partners/profiles/_actions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<%# locals: (partner:) %>

<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card card-primary">
<div class="card-footer">
<% if partner.approved? %>
<%= link_to '', class: 'btn btn-info disabled' do %>
<i class="fa fa-check"></i> Approved
<% end %>
<% elsif partner.awaiting_review? %>
<%= link_to '', class: "btn btn-warning disabled" do %>
<i class="fa fa-clock"></i> Pending Approval
<% end %>
<% else %>
<%= link_to partners_approval_request_path, method: :post, class: "btn btn-success" do %>
<i class="fa fa-paper-plane"></i> Submit for Approval
<% end %>
<% end %>

<%= link_to edit_partners_profile_path, class: 'btn btn-primary' do %>
<i class="fa fa-pencil"></i> Update Information
<% end %>
</div>
</div>
</div>
</div>
</div>
</section>
37 changes: 3 additions & 34 deletions app/views/partners/profiles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
</div><!-- /.container-fluid -->
</section>

<%= render 'actions', partner: current_partner %>

<div class="row">
<div class="col-md-12">
<div class="container-fluid">
Expand All @@ -42,37 +44,4 @@
</div>
</div>

<section class="content">
<div class="container-fluid">
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- jquery validation -->
<div class="card card-primary">
<div class="card-footer">
<% if current_partner.approved? %>
<%= link_to '', class: 'btn btn-info disabled' do %>
<i class="fa fa-check"></i> Approved
<% end %>
<% elsif current_partner.awaiting_review? %>
<%= link_to '', class: "btn btn-warning disabled" do %>
<i class="fa fa-clock"></i> Pending Approval
<% end %>
<% else %>
<%= link_to partners_approval_request_path, method: :post, class: "btn btn-success" do %>
<i class="fa fa-paper-plane"></i> Submit for Approval
<% end %>
<% end %>

<%= link_to edit_partners_profile_path, class: 'btn btn-primary' do %>
<i class="fa fa-pencil"></i> Update Information
<% end %>
</div>
</div>
<!-- /.card -->
</div>
<!--/.col (left) -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<%= render 'actions', partner: current_partner %>
6 changes: 3 additions & 3 deletions spec/system/partners/approval_process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
before do
click_on 'My Profile'
assert page.has_content? 'Uninvited'
click_on 'Update Information'
all('a', text: 'Update Information').last.click

fill_in 'Other Agency Type', with: 'Lorem'

Expand All @@ -41,7 +41,7 @@
click_on 'Update Information'
assert page.has_content? 'Details were successfully updated.'

find_link(text: 'Submit for Approval').click
all('a', text: 'Submit for Approval').last.click
assert page.has_content? 'You have submitted your details for approval.'
assert page.has_content? 'Awaiting Review'
end
Expand Down Expand Up @@ -77,7 +77,7 @@
login_as(partner_user)
visit partner_user_root_path
click_on 'My Profile'
click_on 'Submit for Approval'
all('a', text: 'Submit for Approval').last.click
end

it "should render an error message", :aggregate_failures do
Expand Down

0 comments on commit f6f64e1

Please sign in to comment.