Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Feature/sup 2150 ext acc card add profile url link #601

Merged
merged 3 commits into from
Dec 10, 2015

Conversation

vikasrohit
Copy link
Contributor

@parthshah @nlitwin @tladendo please suggest any change required to make the code robust and bug free. Specifically, do you guys see any other alternative to using preventStopPropagation directive, for avoiding opening of two links, when clicked on the URL inside a external web link card?

vikasrohit added 2 commits December 9, 2015 16:40
-- Added click listener to open the profile URL, if available for external accounts cards (not for external web links)
…rd is not opening up the weblink

-- Opened web link in new tab for external web link cards
-- Prevented double new tabs for the link when clicked on the URL in the card itself
@@ -1,5 +1,5 @@
.external-link-list
div.external-link-tile(ng-repeat="account in linkedAccountsData", ng-class="{'external-link-tile--editable' : editable}")
div.external-link-tile(ng-repeat="account in linkedAccountsData", ng-class="{'external-link-tile--editable' : editable, 'external-link-tile--pending' : account.status === 'PENDING' || account.data.status === 'PENDING'}", ng-click="openLink(account)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to check both account.status and account.data.status? is the API not consistent?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using a div would it help to use anchor tag here? We wouldn't need an anchor tag for the url in that case..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that depends on whether we want the whole thing clickable or just the anchor tag below. But we can delete div since we have an .external-link-tile class :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are maintaining different nesting for added external account and web link. I was thinking to clean it up, however, it would have required more time and testing. Along with that, I was not sure which data structure to cleanup. For external accounts, we are nesting the added external account one more deep level e.g.

{
    status: 'SUCCESS' | 'ERROR',
    linkedAccount: {
        provider: 'github',
        data: {
            handle: '',
            status: 'PENDING',
            ...
        }
    }
}

while for external web links, it is

{
    provider: 'weblink',
    data: {
        handle: '',
        url: '',
        title: '',
        status: 'PENDING'
    }
}

Can you please suggest which one to fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale behind not using anchor tag is that it defeats the purpose of the anchor tag. I think it is not recommended to render a complicated HTML inside an anchor tag. Regarding the anchor tag on URL, we can still avoid it because if I remove the preventEventPropagation directive from it, it would bubble the event to the div and it would take user to the link. Only thing would be that we have to style the URL text as anchor.

@parthshah
Copy link
Contributor

I think the requirement is to make the whole card clickable, hence my suggestion of replacing div w/ anchor tag :)

-- Removed unnecessary div text as per code review comment
@vikasrohit
Copy link
Contributor Author

@parthshah @nlitwin I have created issue 605 for tracking the data structure change and regarding replacing the div with anchor tag, I think we need more discussion because using anchor tag can cause slightly complicated logic for handling pending state cards and styling the URL field to look like an anchor.
I am going ahead to merge the PR into dev to get it QA'ed. If you guys like to have a separate issue to track the anchor thing, please let me know and if you guys agree with my rationale, we are good to go. :)

vikasrohit pushed a commit that referenced this pull request Dec 10, 2015
…rd-add-profile-url-link

Feature/sup 2150 ext acc card add profile url link
@vikasrohit vikasrohit merged commit c6634b3 into dev Dec 10, 2015
@vikasrohit vikasrohit deleted the feature/sup-2150-ext-acc-card-add-profile-url-link branch December 15, 2015 06:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants