Skip to content

Commit

Permalink
SNOW-330 Page view links url when the id is a clickableuri (#93)
Browse files Browse the repository at this point in the history
Show Page view as links in user actions
Wrap long page view links to fit width
  • Loading branch information
wosullivan committed Oct 2, 2020
1 parent 46b9007 commit a4dd9d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/UserActions/UserActions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ $timestamp-grey: #67768b;
margin-left: 0.5em;
}

.coveo-click {
.coveo-click,
.coveo-view {
a {
cursor: pointer;
color: $coveo-blue-6;
Expand Down
12 changes: 11 additions & 1 deletion src/components/UserActions/UserActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class UserActivity extends Component {
}),
};

private static clickable_uri_ids = ['@clickableuri'];
private actions: UserAction[];
private foldedActions: UserAction[];
private userProfileModel: UserProfileModel;
Expand Down Expand Up @@ -276,8 +277,17 @@ export class UserActivity extends Component {
li.classList.add(VIEW_EVENT_CLASS);

const dataElement = document.createElement('div');
if (UserActivity.clickable_uri_ids.indexOf(action.raw.content_id_key) !== -1) {
//If the content id key is included in the clickable_uri list, make the component a link
const a = document.createElement('a');
a.href = action.raw.content_id_value;
a.innerText = action.raw.content_id_value;
dataElement.appendChild(a);
} else {
dataElement.innerText = `${action.raw.content_id_key}: ${action.raw.content_id_value}`;
}

dataElement.classList.add(DATA_CLASS);
dataElement.innerText = `${action.raw.content_id_key}: ${action.raw.content_id_value}`;

li.appendChild(this.buildTitleSection(action));
li.appendChild(dataElement);
Expand Down

0 comments on commit a4dd9d0

Please sign in to comment.