Skip to content

Style sprint across the whole plugin#2337

Merged
ideadude merged 2 commits into
gocodebox:devfrom
kimcoleman:admin-design-improvements-sprint
Mar 1, 2023
Merged

Style sprint across the whole plugin#2337
ideadude merged 2 commits into
gocodebox:devfrom
kimcoleman:admin-design-improvements-sprint

Conversation

@kimcoleman

@kimcoleman kimcoleman commented Feb 4, 2023

Copy link
Copy Markdown
Member

Description

Entire plugin style improvements in progress.

Types of changes

These changes do not include primary changes in functionality. This is design and UX-related updates only.

Questions

We need a helper function to determine our "pages" that we'd load our header and filtered footer (rate us) messages. This code is currently duplicated in

  • includes/admin/class-llms-admin-header.php
  • includes/admin/class-llms-admin-review.php

This exists now but I think it pulls more than we'd need. Maybe I'm using it wrong. https://github.com/gocodebox/lifterlms/blob/dev/includes/admin/class.llms.admin.assets.php#L144-L152

FontAwesome is out of date. But if this automatically updates when we release (not sure on the build process to pull that in or if we manually "update" the version to trigger that) we should review usage through the plugin. I removed our "ellipsis" since that's a known FA change in 6.2+ and we can rather use the dashicon "hamburger" consistently throughout the UI for dragging icon.

Checklist:

  • My code has been tested.
  • My code passes all existing automated tests.
  • My code follows the LifterLMS Coding & Documentation Standards.

$tr.append( '<td><span class="dashicons dashicons-menu llms-drag-handle ui-sortable-handle"></span></td>' );
$tr.append( '<td><a href="' + window.llms.admin_url + 'post.php?action=edit&post=' + id + '">' + title + '</a></td>' );
$tr.append( '<td><a class="llms-button-danger small" data-id="' + id + '" href="#llms-course-remove" style="float:right;">' + LLMS.l10n.translate( 'Remove course' ) + '</a><a class="llms-button-secondary small" data-id="' + id + '" href="#llms-course-bulk-enroll" style="float:right;">' + LLMS.l10n.translate( 'Enroll All Members' ) + '</a></td>' );
$tr.append( '<td><a class="llms-button-danger small" data-id="' + id + '" href="#llms-course-remove" style="float:right;">' + LLMS.l10n.translate( 'Remove course' ) + '</a><a class="llms-button-secondary small" data-id="' + id + '" href="#llms-course-bulk-enroll" style="float:right;margin-right:5px;">' + LLMS.l10n.translate( 'Enroll All Members' ) + '</a></td>' );

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML

[DOM text](1) is reinterpreted as HTML without escaping meta-characters.
$tr.append( '<td><span class="dashicons dashicons-menu llms-drag-handle ui-sortable-handle"></span></td>' );
$tr.append( '<td><a href="' + window.llms.admin_url + 'post.php?action=edit&post=' + id + '">' + title + '</a></td>' );
$tr.append( '<td><a class="llms-button-danger small" data-id="' + id + '" href="#llms-course-remove" style="float:right;">' + LLMS.l10n.translate( 'Remove course' ) + '</a><a class="llms-button-secondary small" data-id="' + id + '" href="#llms-course-bulk-enroll" style="float:right;">' + LLMS.l10n.translate( 'Enroll All Members' ) + '</a></td>' );
$tr.append( '<td><a class="llms-button-danger small" data-id="' + id + '" href="#llms-course-remove" style="float:right;">' + LLMS.l10n.translate( 'Remove course' ) + '</a><a class="llms-button-secondary small" data-id="' + id + '" href="#llms-course-bulk-enroll" style="float:right;margin-right:5px;">' + LLMS.l10n.translate( 'Enroll All Members' ) + '</a></td>' );

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML

[DOM text](1) is reinterpreted as HTML without escaping meta-characters.
Comment thread assets/js/llms-admin-forms.js Outdated

Check failure

Code scanning / ESLint

Assignments to [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)/[outerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) properties or calls to [insertAdjacentHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML) method manipulate DOM directly without any sanitization and should be avoided. Use document.createElement() or similar methods instead.

Do not write to DOM directly using innerHTML/outerHTML property
@@ -1,2 +1,2 @@
!function(){var e,t,n=window.wp.i18n.__,o="page-title-action",r="llms-forms-help-text";function i(){var e=document.querySelector("."+r);"none"===e.style.display?(e.style.display="block",e.className+=" notice notice-info"):e.style.display="none"}document.querySelector("."+o)||(t=document.querySelector(".wp-heading-inline"),(e=document.createElement("button")).className=o+" button",e.innerHTML=n("Add New Form","lifterlms"),e.disabled="disabled",e.style="vertical-align: inherit",t.after(e),e.after((t=document.createElement("button"),e=n("Help","lifterlms"),t.className="button dashicons dashicons-editor-help",t.style=["border-radius: 50%;","border-color: #50575e","color: #50575e","font-size: 23px;","height: 30px;","line-height: 1;","margin-left: 5px;","padding: 0;","position: relative;","top: 3px","vertical-align: baseline;","width: 30px;"].join(";"),t.innerHTML='<span class="screen-reader-text>'+e+"</span>",t.title=n("Help","lifterlms"),t.addEventListener("click",i),t)),document.querySelector(".wrap").insertBefore(((e=document.createElement("div")).className=r,e.style="display:none",e.innerHTML="<p><b>Want to create custom forms and custom fields for your forms?</b></p>",e.innerHTML+="<p>Create unique student information forms for specific courses and memberships. Also unlock the power of custom fields so you can collect and display any form field data you can imagine.</p>",e.innerHTML+='<p><a class="button-primary" target="_blank" rel="noopener" href="https://lifterlms.com/product/custom-fields/?utm_source=LifterLMS%20Plugin&utm_medium=Add%20Form%20Notice&utm_campaign=Add%20Form%20In%20App%20Upgrade%20Flow">Learn More</a></p>',e),document.querySelector(".wp-header-end")))}();
!function(){var e,t,n=window.wp.i18n.__,i="page-title-action",o="llms-forms-help-text";function l(){var e=document.querySelector("."+o);"none"===e.style.display?(e.style.display="flex",e.className+=" notice notice-info llms-admin-notice"):e.style.display="none"}document.querySelector("."+i)||(t=document.querySelector(".wp-heading-inline"),(e=document.createElement("button")).className=i+" button",e.innerHTML=n("Add New Form","lifterlms"),e.disabled="disabled",e.style="vertical-align: inherit",t.after(e),e.after((t=document.createElement("button"),e=n("Help","lifterlms"),t.className="button dashicons dashicons-editor-help",t.style=["background-color: #466dd8","border-radius: 50%;","border-color: #466dd8","color: #FFF","font-size: 23px;","height: 30px;","line-height: 1;","margin-left: 5px;","padding: 0;","position: relative;","top: 3px","vertical-align: baseline;","width: 30px;"].join(";"),t.innerHTML='<span class="screen-reader-text>'+e+"</span>",t.title=n("Help","lifterlms"),t.addEventListener("click",l),t)),document.querySelector(".wrap").insertBefore(((e=document.createElement("div")).className=o,e.style="display:none",e.innerHTML='<div class="llms-admin-notice-icon"></div><div class="llms-admin-notice-content"><h3>Create Custom Forms and Fields</h3><p>Create unique student information forms for specific courses and memberships. Also unlock the power of custom fields so you can collect and display any form field data you can imagine.</p><p><a class="llms-button-primary" target="_blank" rel="noopener" href="https://lifterlms.com/product/custom-fields/?utm_source=LifterLMS%20Plugin&utm_medium=Add%20Form%20Notice&utm_campaign=Add%20Form%20In%20App%20Upgrade%20Flow">Learn More</a></p></div>',e),document.querySelector(".wp-header-end")))}();

Check failure

Code scanning / ESLint

Assignments to [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)/[outerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) properties or calls to [insertAdjacentHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML) method manipulate DOM directly without any sanitization and should be avoided. Use document.createElement() or similar methods instead.

Do not write to DOM directly using innerHTML/outerHTML property
@kimcoleman kimcoleman marked this pull request as ready for review February 22, 2023 12:32
@ideadude ideadude added this to the 7.1 milestone Feb 22, 2023
@ideadude ideadude merged commit aceb571 into gocodebox:dev Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants