Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#650 Use popups for links #13421

Merged
merged 1 commit into from
Jan 24, 2019
Merged

dev/core#650 Use popups for links #13421

merged 1 commit into from
Jan 24, 2019

Conversation

chamilwijesooriya
Copy link
Contributor

@chamilwijesooriya chamilwijesooriya commented Jan 8, 2019

Overview

GitLab Issue 650

Before

  • Membership and Recurring Contribution links opened as separate pages

Steps to reproduce:

  1. Create a recurring contribution manually
$result = civicrm_api3('ContributionRecur', 'create', [
    'contact_id' => contact_id_of_your_choosing,
    'amount' => 50,
    'frequency_interval' => 1,
]);
  1. Create a membership
  2. Link the recurring contribution to the membership
$result = civicrm_api3('Membership', 'create', [
    'id' => id_of_the_membership,
    'contribution_recur_id' => id_of_the_recurring_contribution,
]);
  1. View the membership and click on recurring contribution link
    membership

  2. View the recurring contribution and click on membership link
    recur

After

  • In templates/CRM/Contribute/Page/ContributionRecur.tpl added class crm-popup to the hyperlink in following code block
{if $recur.membership_id}
<tr>
    <td class="label">{ts}Membership{/ts}</td>
    <td><a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/membership" q="action=view&reset=1&cid=`$contactId`&id=`$recur.membership_id`&context=membership&selectedChild=member"}'>{$recur.membership_name}</a></td>
</tr>
{/if}
  • In templates/CRM/Member/Form/MembershipView.tpl added class crm-popup to the hyperlink in following code block
{if $contribution_recur_id}
<tr>
    <td class="label">{ts}Recurring Contribution{/ts}</td>
    <td>
        <a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/contributionrecur" q="reset=1&id=`$contribution_recur_id`&cid=`$contactId`&context=contribution"}'>View Recurring Contribution
        </a>
    </td>
</tr>
{/if}

@civibot
Copy link

civibot bot commented Jan 8, 2019

(Standard links)

@civibot civibot bot added the master label Jan 8, 2019
@colemanw
Copy link
Member

colemanw commented Jan 8, 2019

@chamilwijesooriya could you say more about what screen(s) are affected by this? A screenshot might be helpful.

@chamilwijesooriya
Copy link
Contributor Author

@colemanw sorry for that. Updated the PR

@mattwire
Copy link
Contributor

mattwire commented Jan 9, 2019

@chamilwijesooriya I've tested this and I'm not sure it quite does what you describe.

  • If you open one of the pages above as a separate page the links will open as popups - this is an improvement and I would be happy for this to be merged.
  • However, when you view one of the pages above in a popup and THEN click the link it is opened as a page and the popup is closed - did you intend for that?

@chamilwijesooriya
Copy link
Contributor Author

chamilwijesooriya commented Jan 9, 2019

@mattwire I'm not sure about your 2nd observation, 'cause it works the same as 1st for me.
It should be opening as normal popups in civi, on top of each other.

@mattwire
Copy link
Contributor

mattwire commented Jan 9, 2019

It should be opening as normal popups in civi, on top of each other.

For me the crm-popup seemed to be removed when loaded via a popup. I added it via the browser console to test but don't really like the popups on top of each other - we don't do that anywhere else. @colemanw The right thing to do I think is to load the link in the same popup but that goes a little beyond my popup/js foo?

@chamilwijesooriya
Copy link
Contributor Author

@mattwire in that case I'm not sure what else to do. I just followed what's mentioned here under CRM.popup https://docs.civicrm.org/dev/en/latest/framework/ajax/

@chamilwijesooriya
Copy link
Contributor Author

It seems to replace the existing popup if I use the class action-item instead of crm-popup. Any thoughts @mattwire ?

@eileenmcnaughton eileenmcnaughton changed the title GitLab issue 650 Use popups for links dev/core#650 Use popups for links Jan 9, 2019
Changed class to action-item
@colemanw
Copy link
Member

I've re-tested this and the new action-item class does the trick perfectly. It now opens within the same dialog, and clicking done brings you back to the membership record. Thanks @chamilwijesooriya!

@colemanw colemanw merged commit b94db0d into civicrm:master Jan 24, 2019
@chamilwijesooriya
Copy link
Contributor Author

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants