Files
edx-platform/lms/static/js/learner_dashboard/views/sidebar_view.js
Nawfal Ahmed 7174da78d0 feat: subscription changes and alerts for program dashboard and details (#32217)
* feat: subscription changes on program dashboard and details (#31909)

  - add a h2 programs heading on program dashboard
  - subscription ui changes on program dashboard
  - subscription alerts on both pages

* feat: add subscription upsell, fix responsive layout of program dashboard (#31943)

* test: update tests for subscription changes on program dashboard (#32021)

* feat: subscription api changes on program dashboard (#32085)

* feat: add subscription segment events to program details and dashboard (#32164)

* feat: subscription changes on program dashboard and details pages (#32205)
2023-05-16 10:34:42 +00:00

51 lines
1.3 KiB
JavaScript

import Backbone from 'backbone';
import HtmlUtils from 'edx-ui-toolkit/js/utils/html-utils';
import NewProgramsView from './explore_new_programs_view';
import SubscriptionUpsellView from './subscription_upsell_view';
import sidebarTpl from '../../../templates/learner_dashboard/sidebar.underscore';
class SidebarView extends Backbone.View {
constructor(options) {
const defaults = {
el: '.sidebar',
events: {
'click .js-subscription-upsell-cta ': 'trackSubscriptionUpsellCTA',
},
};
super(Object.assign({}, defaults, options));
}
initialize(data) {
this.tpl = HtmlUtils.template(sidebarTpl);
this.context = data.context;
}
render() {
HtmlUtils.setHtml(this.$el, this.tpl(this.context));
this.postRender();
}
postRender() {
if (this.context.isUserB2CSubscriptionsEnabled) {
this.subscriptionUpsellView = new SubscriptionUpsellView({
context: this.context,
});
}
this.newProgramsView = new NewProgramsView({
context: this.context,
});
}
trackSubscriptionUpsellCTA() {
window.analytics.track(
'edx.bi.user.subscription.program-dashboard.upsell.clicked'
);
}
}
export default SidebarView;