forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Muhammad Faraz Maqsood
authored and
Muhammad Faraz Maqsood
committed
Jan 12, 2024
1 parent
b26e0c4
commit 7216d84
Showing
5 changed files
with
65 additions
and
5 deletions.
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
37 changes: 37 additions & 0 deletions
37
lms/static/js/learner_dashboard/views/program_list_header_view.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,37 @@ | ||
import Backbone from 'backbone'; | ||
|
||
import HtmlUtils from 'edx-ui-toolkit/js/utils/html-utils'; | ||
|
||
import programListHeaderTpl from '../../../templates/learner_dashboard/program_list_header_view.underscore'; | ||
|
||
class ProgramListHeaderView extends Backbone.View { | ||
constructor(options) { | ||
const defaults = { | ||
el: '.js-program-list-header', | ||
}; | ||
super(Object.assign({}, defaults, options)); | ||
} | ||
|
||
initialize({ context }) { | ||
this.context = context; | ||
this.tpl = HtmlUtils.template(programListHeaderTpl); | ||
this.programAndSubscriptionData = context.programsData | ||
.map((programData) => ({ | ||
programData, | ||
subscriptionData: context.subscriptionCollection | ||
?.findWhere({ | ||
resource_id: programData.uuid, | ||
subscription_state: 'active', | ||
}) | ||
?.toJSON(), | ||
})) | ||
.filter(({ subscriptionData }) => !!subscriptionData); | ||
this.render(); | ||
} | ||
|
||
render() { | ||
HtmlUtils.setHtml(this.$el, this.tpl(this.context)); | ||
} | ||
} | ||
|
||
export default ProgramListHeaderView; |
2 changes: 2 additions & 0 deletions
2
lms/templates/learner_dashboard/program_list_header_view.underscore
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,2 @@ | ||
<h2><%- gettext('My programs') %></h2> | ||
<div class="js-program-list-alerts program-list-alerts program-subscription-alert-wrapper mr-md-3"></div> |
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