forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Tag sections, subsections, and the whole course (openedx#34690)
(In the legacy UI, if the 'new_studio_mfe.use_tagging_taxonomy_list_page' waffle flag is enabled)
- Loading branch information
1 parent
534d275
commit 4e855ee
Showing
9 changed files
with
125 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
define([ | ||
'jquery', 'underscore', 'backbone', 'js/utils/templates', | ||
'edx-ui-toolkit/js/utils/html-utils', 'js/views/utils/tagging_drawer_utils', | ||
'js/views/tag_count', 'js/models/tag_count'], | ||
function( | ||
$, _, Backbone, TemplateUtils, HtmlUtils, TaggingDrawerUtils, TagCountView, TagCountModel | ||
) { | ||
'use strict'; | ||
|
||
var CourseManageTagsView = Backbone.View.extend({ | ||
events: { | ||
'click .manage-tags-button': 'openManageTagsDrawer', | ||
}, | ||
|
||
initialize: function() { | ||
this.template = TemplateUtils.loadTemplate('course-manage-tags'); | ||
this.courseId = course.id; | ||
}, | ||
|
||
openManageTagsDrawer: function(event) { | ||
const taxonomyTagsWidgetUrl = this.model.get('taxonomy_tags_widget_url'); | ||
const contentId = this.courseId; | ||
TaggingDrawerUtils.openDrawer(taxonomyTagsWidgetUrl, contentId); | ||
}, | ||
|
||
renderTagCount: function() { | ||
const contentId = this.courseId; | ||
const tagCountsForCourse = this.model.get('course_tags_count'); | ||
const tagsCount = tagCountsForCourse !== undefined ? tagCountsForCourse[contentId] : 0; | ||
var countModel = new TagCountModel({ | ||
content_id: contentId, | ||
tags_count: tagsCount, | ||
course_authoring_url: this.model.get('course_authoring_url'), | ||
}, {parse: true}); | ||
var tagCountView = new TagCountView({el: this.$('.tag-count'), model: countModel}); | ||
tagCountView.setupMessageListener(); | ||
tagCountView.render(); | ||
this.$('.tag-count').click((event) => { | ||
event.preventDefault(); | ||
this.openManageTagsDrawer(); | ||
}); | ||
}, | ||
|
||
render: function() { | ||
var html = this.template(this.model.attributes); | ||
HtmlUtils.setHtml(this.$el, HtmlUtils.HTML(html)); | ||
this.renderTagCount(); | ||
return this; | ||
} | ||
}); | ||
|
||
return CourseManageTagsView; | ||
} | ||
); |
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
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,8 @@ | ||
<div class="course-manage-tags-container"> | ||
<h2 class="status-course-manage-tags-label"> | ||
<%- gettext('Course tags') %> | ||
</h2> | ||
<br> | ||
<span class="status-course-manage-tags-value tag-count" data-locator="<%- course.id %>"></span> | ||
<a class="status-course-manage-tags-info manage-tags-button" href="#"><%- gettext('Manage tags') %></a> | ||
</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
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