-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Enhance news load resources using load-group - EXO-63805 #910
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,7 @@ | |
activityId: '${activityId}', | ||
hiddenSpace: ${news.hiddenSpace}, | ||
isSpaceMember: ${news.isSpaceMember}, | ||
favorite: ${news.isFavorite} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this variable ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}, | ||
} """ | ||
def notAuthorizedUserLabel = ""; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
webapp/src/main/webapp/news-extensions/activity-extensions/extensions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
Copyright (C) 2023 eXo Platform SAS. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
const newsActivityTypeExtensionOptions = { | ||
name: 'News', | ||
getExtendedComponent: (activity, isActivityDetail) => { | ||
if (activity && isActivityDetail) { | ||
return { | ||
component: Vue.options.components['exo-news-details-activity'], | ||
overrideHeader: true, | ||
overrideFooter: false, | ||
}; | ||
} | ||
}, | ||
extendSharedActivity: (activity, isActivityDetail) => isActivityDetail, | ||
showSharedInformationFooter: (activity, isActivityDetail) => isActivityDetail, | ||
init: (activity, isActivityDetail) => { | ||
let activityId = activity.id; | ||
if (activity.parentActivity) { | ||
activityId = activity.parentActivity.id; | ||
} | ||
if (!activity.news || isActivityDetail) { | ||
return Vue.prototype.$newsServices.getNewsByActivityId(activityId) | ||
.then(news => activity.news = news); | ||
} | ||
}, | ||
canEdit: () => false, | ||
canShare: () => true, | ||
hideOnDelete: true, | ||
supportsThumbnail: true, | ||
windowTitlePrefixKey: 'news.window.title', | ||
getThumbnail: (activity) => activity?.news?.illustrationURL && `${activity?.news?.illustrationURL}&size=305x285` || '/news/images/news.png', | ||
getThumbnailProperties: (activity) => !(activity?.news?.illustrationURL) && { | ||
height: '90px', | ||
width: '90px', | ||
noBorder: true, | ||
} || null, | ||
isUseSameViewForMobile: (activity) => !activity?.news?.illustrationURL, | ||
getTitle: (activity) => { | ||
const news = activity?.news; | ||
if (news?.title) { | ||
return news.title; | ||
} | ||
return ''; | ||
}, | ||
getSourceLink: (activity) => `${eXo.env.portal.context}/${eXo.env.portal.portalName}/activity?id=${!activity.parentActivity ? activity.id : activity.parentActivity.id}`, | ||
getSummary: (activity) => { | ||
const news = activity?.news; | ||
if (news?.summary) { | ||
return news.summary; | ||
} else if (news?.body) { | ||
return Vue.prototype.$utils.htmlToText(news.body); | ||
} | ||
return ''; | ||
}, | ||
getTooltip: (activity, isActivityDetail) => !isActivityDetail && activity && 'news.activity.clickToShowDetail', | ||
}; | ||
|
||
export function initExtensions() { | ||
extensionRegistry.registerExtension('activity', 'type', { | ||
type: 'news', | ||
options: newsActivityTypeExtensionOptions, | ||
}); | ||
} |
20 changes: 20 additions & 0 deletions
20
webapp/src/main/webapp/news-extensions/activity-extensions/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright (C) 2023 eXo Platform SAS. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import {initExtensions} from './extensions.js'; | ||
|
||
export function init() { | ||
initExtensions(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
webapp/src/main/webapp/news-extensions/analytics-extensions/extensions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright (C) 2023 eXo Platform SAS. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
export function initExtensions() { | ||
extensionRegistry.registerExtension('AnalyticsTable', 'CellValue', { | ||
type: 'news', | ||
options: { | ||
// Rank of executing 'match' method | ||
rank: 60, | ||
// Used Vue component to display cell value | ||
vueComponent: Vue.options.components['analytics-table-cell-content-value'], | ||
// Method complete signature : match: (fieldName, aggregationType, fieldDataType, item) => { ... } | ||
match: (fieldName, aggregationType) => fieldName === 'contentId.keyword' && aggregationType === 'TERMS', | ||
}, | ||
}); | ||
|
||
extensionRegistry.registerExtension('AnalyticsSamples', 'SampleItem', { | ||
type: 'news', | ||
options: { | ||
// Rank of executing 'match' method | ||
rank: 30, | ||
// Used Vue component to display cell value | ||
vueComponent: Vue.options.components['analytics-sample-item-content'], | ||
match: fieldName => fieldName === 'contentId', | ||
}, | ||
}); | ||
} |
26 changes: 26 additions & 0 deletions
26
webapp/src/main/webapp/news-extensions/analytics-extensions/initComponents.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright (C) 2023 eXo Platform SAS. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import AnalyticsTableCellContentValue from './components/analytics/AnalyticsTableCellContentValue.vue'; | ||
import AnalyticsSampleItemContent from './components/analytics/AnalyticsSampleItemContent.vue'; | ||
|
||
const components = { | ||
'analytics-table-cell-content-value': AnalyticsTableCellContentValue, | ||
'analytics-sample-item-content': AnalyticsSampleItemContent, | ||
}; | ||
|
||
for (const key in components) { | ||
Vue.component(key, components[key]); | ||
} |
28 changes: 28 additions & 0 deletions
28
webapp/src/main/webapp/news-extensions/analytics-extensions/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Copyright (C) 2023 eXo Platform SAS. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import './initComponents.js'; | ||
import {initExtensions} from './extensions.js'; | ||
import * as newsServices from '../../services/newsServices'; | ||
|
||
if (!Vue.prototype.$newsServices) { | ||
window.Object.defineProperty(Vue.prototype, '$newsServices', { | ||
value: newsServices, | ||
}); | ||
} | ||
|
||
export function init() { | ||
initExtensions(); | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it should be removed? i have faced an existing old issue and i fixed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is that when access news details and that you have set the news as favorite, you will still have the option to set it again and the icon of favorite is empty icon which indicates that news is not marked as favorite while it's the case