Member Index View Actions: "Adjust Credit Balance" (#17974)
* Adds the Adjust credit balance modal to index view * Adds e2e tests for adjusting credit balances via modal * Adds the ability to update credits to #user_status * Adjusts the e2e to address failures
This commit is contained in:
parent
1eafd7388e
commit
ec55329a3a
4 changed files with 54 additions and 2 deletions
|
|
@ -108,6 +108,9 @@ module Admin
|
|||
flash[:danger] = e.message
|
||||
end
|
||||
|
||||
Credits::Manage.call(@user, credit_params)
|
||||
add_note if user_params[:new_note]
|
||||
|
||||
if request.referer&.include?(admin_user_path(params[:id]))
|
||||
redirect_to admin_user_path(params[:id])
|
||||
else
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@
|
|||
</div>
|
||||
<% if FeatureFlag.enabled?(:member_index_view) %>
|
||||
<%= render "admin/users/index/filters_modal" %>
|
||||
<%= render "admin/users/modals/add_organization_modal" %>
|
||||
<%= render "admin/users/modals/add_role_modal" %>
|
||||
<%= render "admin/users/modals/add_organization_modal" %>
|
||||
<%= render "admin/users/modals/adjust_credits_modal" %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,19 @@
|
|||
Add organization
|
||||
</button>
|
||||
</li>
|
||||
<li><button class="c-btn align-left w-100 c-btn--icon-left"><%= crayons_icon_tag("wallet", aria_hidden: true, class: "c-btn__icon") %>Adjust credit balance</button><hr /></li>
|
||||
<li>
|
||||
<button class="c-btn align-left w-100 c-btn--icon-left"
|
||||
data-modal-title="Adjust balance"
|
||||
data-modal-size="small"
|
||||
data-modal-content-selector="#adjust-balance"
|
||||
data-user-name="<%= user.name %>"
|
||||
data-unspent-credits-count="<%= user.unspent_credits_count %>"
|
||||
data-form-action="<%= user_status_admin_user_path(user) %>">
|
||||
<%= crayons_icon_tag("wallet", aria_hidden: true, class: "c-btn__icon") %>
|
||||
Adjust credit balance
|
||||
</button>
|
||||
<hr />
|
||||
</li>
|
||||
<% end %>
|
||||
<li><button data-copy-email="<%= user.email %>" type="button" class="c-btn w-100 align-left c-btn--icon-left"> <%= crayons_icon_tag("copy", aria_hidden: true, class: "c-btn__icon") %>Copy email address</button></li>
|
||||
<% if FeatureFlag.enabled?(:member_index_view) %>
|
||||
|
|
|
|||
|
|
@ -385,6 +385,22 @@ describe('User index view', () => {
|
|||
}).should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
it('Opens the adjust credit balance modal', () => {
|
||||
cy.enableFeatureFlag('member_index_view');
|
||||
|
||||
openUserActionsDropdown();
|
||||
|
||||
cy.findByRole('button', { name: 'Adjust credit balance' }).click();
|
||||
|
||||
cy.getModal().within(() => {
|
||||
cy.findAllByText('Adjust balance').should('be.visible');
|
||||
cy.findByText('Add a note to this action:').should('be.visible');
|
||||
cy.findByRole('button', {
|
||||
name: 'Adjust balance',
|
||||
}).should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('large screens', () => {
|
||||
|
|
@ -433,6 +449,26 @@ describe('User index view', () => {
|
|||
}).should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
it('Opens the adjust credit balance modal', () => {
|
||||
cy.enableFeatureFlag('member_index_view');
|
||||
|
||||
openUserActionsDropdown();
|
||||
|
||||
cy.findByRole('button', {
|
||||
name: 'Adjust credit balance',
|
||||
}).click();
|
||||
|
||||
cy.getModal().within(() => {
|
||||
cy.findAllByText('Adjust balance').should('be.visible');
|
||||
cy.findByText('Add a note to this action:').should(
|
||||
'be.visible',
|
||||
);
|
||||
cy.findByRole('button', {
|
||||
name: 'Adjust balance',
|
||||
}).should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue