Skip to content

Commit bf64c34

Browse files
SaadYousafawaisdar001
authored andcommitted
feat: add program discussion for learner dashboard
1 parent 8cf751a commit bf64c34

8 files changed

Lines changed: 100 additions & 1 deletion

File tree

lms/djangoapps/learner_dashboard/config/__init__.py

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
This module contains various configuration settings via
3+
waffle switches for the learner_dashboard app.
4+
"""
5+
6+
from edx_toggles.toggles import WaffleFlag
7+
8+
# .. toggle_name: learner_dashboard.enable_program_discussions
9+
# .. toggle_implementation: WaffleFlag
10+
# .. toggle_default: False
11+
# .. toggle_description: Waffle flag to enable new Program discussion experience for course.
12+
# .. toggle_use_cases: temporary, open_edx
13+
# .. toggle_creation_date: 2021-08-25
14+
# .. toggle_target_removal_date: 2021-12-31
15+
# .. toggle_warnings: When the flag is ON, the new experience for Program discussions will be enabled.
16+
# .. toggle_tickets: TNL-8434
17+
ENABLE_PROGRAM_DISCUSSIONS = WaffleFlag(
18+
'learner_dashboard.enable_program_discussions',
19+
__name__,
20+
)

lms/djangoapps/learner_dashboard/programs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from web_fragments.fragment import Fragment
1313

1414
from lms.djangoapps.commerce.utils import EcommerceService
15-
from lms.djangoapps.learner_dashboard.utils import FAKE_COURSE_KEY, strip_course_id
15+
from lms.djangoapps.learner_dashboard.utils import FAKE_COURSE_KEY, strip_course_id, program_discussions_is_enabled
1616
from openedx.core.djangoapps.catalog.constants import PathwayType
1717
from openedx.core.djangoapps.catalog.utils import get_pathways
1818
from openedx.core.djangoapps.credentials.utils import get_credentials_records_url
@@ -136,6 +136,7 @@ def render_to_fragment(self, request, program_uuid, **kwargs): # lint-amnesty,
136136
'certificate_data': certificate_data,
137137
'industry_pathways': industry_pathways,
138138
'credit_pathways': credit_pathways,
139+
'program_discussions_enabled': program_discussions_is_enabled()
139140
}
140141

141142
html = render_to_string('learner_dashboard/program_details_fragment.html', context)

lms/djangoapps/learner_dashboard/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from opaque_keys.edx.keys import CourseKey
77

8+
from lms.djangoapps.learner_dashboard.config.waffle import ENABLE_PROGRAM_DISCUSSIONS
9+
810
FAKE_COURSE_KEY = CourseKey.from_string('course-v1:fake+course+run')
911

1012

@@ -15,3 +17,10 @@ def strip_course_id(path):
1517
"""
1618
course_id = str(FAKE_COURSE_KEY)
1719
return path.split(course_id)[0]
20+
21+
22+
def program_discussions_is_enabled():
23+
"""
24+
check if program discussion is enabled.
25+
"""
26+
return ENABLE_PROGRAM_DISCUSSIONS.is_enabled()

lms/static/js/learner_dashboard/views/program_details_view.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class ProgramDetailsView extends Backbone.View {
7474
remainingCount,
7575
completedCount,
7676
completeProgramURL: buyButtonUrl,
77+
programDiscussionEnabled: this.options.programDiscussionEnabled,
7778
};
7879
data = $.extend(data, this.programModel.toJSON());
7980
HtmlUtils.setHtml(this.$el, this.tpl(data));

lms/static/sass/views/_program-details.scss

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,3 +837,44 @@ $btn-color-primary: $primary-dark;
837837
}
838838
}
839839
}
840+
841+
.program-detail-nav {
842+
@extend .content;
843+
844+
display: block;
845+
width: 100%;
846+
padding: 40px;
847+
848+
.program-detail-nav-list {
849+
@extend %ui-no-list;
850+
851+
border-bottom: 1px solid $gray-base;
852+
853+
.nav-item {
854+
@extend %t-copy-base;
855+
856+
font-weight: 500;
857+
font-size: 1.125rem;
858+
display: inline-block;
859+
860+
.btn-link {
861+
display: inline-block;
862+
padding: ($baseline/2);
863+
border: 0;
864+
box-shadow: none;
865+
text-shadow: none;
866+
color: theme-color("primary");
867+
cursor: pointer;
868+
869+
&:hover,
870+
&:focus {
871+
border-bottom: 3px solid theme-color("primary");
872+
}
873+
874+
&.active {
875+
border-bottom: 3px solid theme-color("primary");
876+
}
877+
}
878+
}
879+
}
880+
}

lms/templates/learner_dashboard/program_details_fragment.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
userPreferences: ${user_preferences | n, dump_js_escaped_json},
2121
industryPathways: ${industry_pathways | n, dump_js_escaped_json},
2222
creditPathways: ${credit_pathways | n, dump_js_escaped_json},
23+
programDiscussionEnabled: ${program_discussions_enabled | n, dump_js_escaped_json},
2324
});
2425
</%static:webpack>
2526
</%block>

lms/templates/learner_dashboard/program_details_view.underscore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
<header class="js-program-header program-header full-width-banner"></header>
22
<!-- TODO: consider if article is the most appropriate element here -->
3+
4+
<% if (programDiscussionEnabled) { %>
5+
<div class="program-detail-nav">
6+
<ul class="nav nav-tabs program-detail-nav-list" id="programTabs" role="tablist">
7+
<li class="nav-item" role="presentation">
8+
<button class="nav-link btn-link active" id="home-tab" data-toggle="tab" data-target="#journey" type="button" role="tab" aria-controls="journey" aria-selected="true">Journey</button>
9+
</li>
10+
<li class="nav-item" role="presentation">
11+
<button class="nav-link btn-link" id="profile-tab" data-toggle="tab" data-target="#community" type="button" role="tab" aria-controls="community" aria-selected="false">Community</button>
12+
</li>
13+
<li class="nav-item" role="presentation">
14+
<button class="nav-link btn-link" id="contact-tab" data-toggle="tab" data-target="#live" type="button" role="tab" aria-controls="live" aria-selected="false">Live</button>
15+
</li>
16+
<li class="nav-item" role="presentation">
17+
<button class="nav-link btn-link" id="contact-tab" data-toggle="tab" data-target="#pathways" type="button" role="tab" aria-controls="pathways" aria-selected="false">Pathways</button>
18+
</li>
19+
</ul>
20+
</div>
21+
<div class="tab-content" id="ProgramTabContent">
22+
<div class="tab-pane fade show active" id="journey" role="tabpanel" aria-labelledby="journey-tab">Journey tab content</div>
23+
<div class="tab-pane fade" id="community" role="tabpanel" aria-labelledby="community-tab">Community tab content</div>
24+
<div class="tab-pane fade" id="live" role="tabpanel" aria-labelledby="live-tab">Live tab content</div>
25+
<div class="tab-pane fade" id="pathways" role="tabpanel" aria-labelledby="pathaways-tab">Pathways tab content</div>
26+
</div>
27+
<% } %>
28+
329
<article class="program-details-content">
430
<div class="program-heading">
531
<% if (completedCount === totalCount) { %>

0 commit comments

Comments
 (0)