-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Tagging UX refinement v2 [FC-0036] #34059
Merged
bradenmacdonald
merged 8 commits into
openedx:master
from
open-craft:chris/FAL-3601-UX-refinement-v2
Jan 25, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a96a942
style: drawer-cover color updated for tagging drawer
ChrisChV 0db5218
style: drawer-cover color updated for all tagging drawers
ChrisChV 13f4580
feat: Update TagList component when a tag is updated on Manage tags d…
ChrisChV ebcf800
feat: Reafactor TagCount to be hable to refresh the count
ChrisChV ad2c813
feat: Sync tag count in units
ChrisChV 1544a45
test: Fixing python tests
ChrisChV 61bb176
chore: Test to fix javascript error
ChrisChV 6b78dc9
fix: Bug with javascript
ChrisChV 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
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,13 @@ | ||
import * as TagCountView from 'js/views/tag_count'; | ||
import * as TagCountModel from 'js/models/tag_count'; | ||
|
||
// eslint-disable-next-line no-unused-expressions | ||
'use strict'; | ||
export default function TagCountFactory(TagCountJson, el) { | ||
var model = new TagCountModel(TagCountJson, {parse: true}); | ||
var tagCountView = new TagCountView({el, model}); | ||
tagCountView.setupMessageListener(); | ||
tagCountView.render(); | ||
} | ||
|
||
export {TagCountFactory}; | ||
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,13 @@ | ||
define(['backbone', 'underscore'], function(Backbone, _) { | ||
/** | ||
* Model for Tag count view | ||
*/ | ||
var TagCountModel = Backbone.Model.extend({ | ||
defaults: { | ||
content_id: null, | ||
tags_count: 0, | ||
course_authoring_url: null, | ||
}, | ||
}); | ||
return TagCountModel; | ||
}); |
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,54 @@ | ||
define(['jquery', 'underscore', 'js/views/baseview', 'edx-ui-toolkit/js/utils/html-utils'], | ||
function($, _, BaseView, HtmlUtils) { | ||
'use strict'; | ||
|
||
/** | ||
* TagCountView displays the tag count of a unit/component | ||
* | ||
* This component is being rendered in this way to allow receiving | ||
* messages from the Manage tags drawer and being able to update the count. | ||
*/ | ||
var TagCountView = BaseView.extend({ | ||
// takes TagCountModel as a model | ||
|
||
initialize: function() { | ||
BaseView.prototype.initialize.call(this); | ||
this.template = this.loadTemplate('tag-count'); | ||
}, | ||
|
||
setupMessageListener: function () { | ||
window.addEventListener( | ||
'message', (event) => { | ||
// Listen any message from Manage tags drawer. | ||
var data = event.data; | ||
var courseAuthoringUrl = this.model.get("course_authoring_url") | ||
if (event.origin == courseAuthoringUrl | ||
&& data.includes('[Manage tags drawer] Count updated:')) { | ||
// This message arrives when there is a change in the tag list. | ||
// The message contains the new count of tags. | ||
let jsonData = data.replace(/\[Manage tags drawer\] Count updated: /g, ""); | ||
jsonData = JSON.parse(jsonData); | ||
if (jsonData.contentId == this.model.get("content_id")) { | ||
this.model.set('tags_count', jsonData.count); | ||
this.render(); | ||
} | ||
} | ||
} | ||
); | ||
}, | ||
|
||
render: function() { | ||
HtmlUtils.setHtml( | ||
this.$el, | ||
HtmlUtils.HTML( | ||
this.template({ | ||
tags_count: this.model.get("tags_count"), | ||
}) | ||
) | ||
); | ||
return this; | ||
} | ||
}); | ||
|
||
return TagCountView; | ||
}); |
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,7 @@ | ||
<% if (tags_count && tags_count > 0) { %> | ||
<button data-tooltip="<%- gettext("Manage Tags") %>" class="btn-default action-button manage-tags-button" data-testid="tag-count-button"> | ||
<span class="icon fa fa-tag" aria-hidden="true"></span> | ||
<span><%- tags_count %></span> | ||
<span class="sr action-button-text"><%- gettext("Manage Tags") %></span> | ||
</button> | ||
<% } %> |
Oops, something went wrong.
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.
Ah, these
import
andexport
statements are probably the problem - I don't think the build process used in edx-platform supports them. But it could be something else - not sure.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.
There are other factories that has the same syntax. My tutor is unconfigured, I'm going to try to configure it to try another syntax
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.
That error happened to me, but it was fixed with this line. Maybe clearing the cache?
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.
Nevermind, I found the
r.js optimizer
errorThere 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.
Thx, let me know when you've found a fix.
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.
@bradenmacdonald I fixed the bug. It was an extrra
,
here You can test it? I still need to configure my tutor with the MFE