-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Start using the HtmlUtils safe template functions #11856
Conversation
This is a new version of https://github.com/edx/edx-platform/pull/11799 that is rebased against master. |
11a408d
to
36eda99
Compare
capitalCamel = _.compose(str.capitalize, str.camelize); | ||
// create Notification.Warning, Notification.Confirmation, etc | ||
var capitalCamel, intents; | ||
capitalCamel = _.compose(str.capitalize, str.camelize); | ||
intents = ["warning", "error", "confirmation", "announcement", "step-required", "help", "mini"]; |
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.
Needs to match indent.
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.
Thanks. I'd tried to revert my changes in this file, but PyCharm fooled me as I had it in 'ignore whitespace' mode. I've fully reverted them now.
36eda99
to
08bcde2
Compare
showNotificationMessage: function() { | ||
var accountSettingsPageUrl = this.options.accountSettingsPageUrl, | ||
accountSettingsLinkHtml = HtmlUtils.joinHtml( | ||
HtmlUtils.HTML('<a href="' + accountSettingsPageUrl + '">'), |
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.
You should have an inner joinHtml() for this as well.
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 seems strange, because we are then implicitly HTML escaping a URL.
@andy-armstrong The code looks clean. Thanks! I was tired when I reviewed, so I should double check. This is a big review. I dropped a bunch of comments that don't necessarily need to get refactored, but it would be nice to use them to help settle best practices to be documented. |
))); | ||
render: function() { | ||
var teamCount = this.model.get('team_count'); | ||
HtmlUtils.setHtml( |
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.
@robrap Here's an example where we use HtmlUtils.setHtml
with a string. It seems useful for updating simple paragraph and span tags. I couldn't find an example for HtmlUtils.append
but it seems reasonable to support it for consistency.
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.
In our best practice guide, would we want people to use this.$el.text(...)
?
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's a very good point. I'll switch it...
fee4f63
to
a0970d6
Compare
57e5d51
to
f627764
Compare
c770cfe
to
2b9ecc4
Compare
This is a general message being posted for all Safe Templates PRs. If you are making steady progress, sorry about this, and thank you! We need to get any Safe Template PRs merged as soon as possible. Make sure you have the latest copy of Feel free to ping me with any questions, and/or refer to the Safe Template Linter documentation. Thanks! |
@andy-armstrong should this PR be closed? |
@cahrens No, I need to get back to merging this. |
2b9ecc4
to
04a9947
Compare
@andy-armstrong FYI: When you rebase from master you'll get reports of violations for this PR in Jenkins under quality. |
8017ad6
to
1b2b82e
Compare
1b2b82e
to
9e34399
Compare
@andy-armstrong OK to close this PR? |
@cahrens @andy-armstrong: I don't think so. @scottrish will be reviewing the remaining safe template open PRs for next steps (prompted by the branch removal request). What would it take to land this work? |
a1e72d8
to
3631498
Compare
3631498
to
df3b52e
Compare
This change starts to convert the platform to use the new HtmlUtils class. I've primarily converted the Teams UI, along with the shared helper classes and Underscore templates that they depend upon.
Sandbox
Testing
Reviewers
If you've been tagged for review, please check your corresponding box once you've given the 👍.
FYI: @AlasdairSwan @dan-f @dsjen @bjacobel
Post-review