Skip to content
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

Feature: Add selectable SCSS snippets #710

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

Menrath
Copy link
Contributor

@Menrath Menrath commented Sep 5, 2024

This is a result from a DevCamp session at the 2024 https://moodlemootdach.org

Thanks for @abias, @bartdenhoed and the others!

Note: All commits in this PR should definitely get squashed before merging.

Description:
TODO

What is still missing:

  • Unit-Tests, e.g. parsing the SCSS top level header, adding new snippets to the DB, sorting, etc., fetch enabled SCSS snippets.
  • Verify Copyright
  • Improve PHPdocs
  • Think whether we need to sanitze the Meta values in the SCSS top comments (e.g., via the HTMLPurifier library)
  • Fix all ToDos in the code
  • Add a modal popup for showing the details of the snippet
  • Extend the resolve_page_url() function for Behat which is added within Behat optimisations, addresses #765. #767
  • Add some Behat tests for the general functionality
  • Allow adding snippets via filepicker, including using the snippets downloaded from https://github.com/moodle-an-hochschulen/moodle-theme_boost_union_snippets
  • Fix sortorder gaps (in the database) when snippets are deleted
  • Finalize the built-in snippets (code, description, screenshot)
  • Finalize the https://github.com/moodle-an-hochschulen/moodle-theme_boost_union_snippets repo (and remove the wip tag)
  • Add 'Tested on' metadata to snippets

Additional features / aspects:

  • Remove the CSS header comments from the SCSS file when it is added to the SCSS stack as they would otherwise be shipped to the browser (which is an unnecessary overhead).
  • Add a restriction to each snippet to only include it if a particular plugin is installed
  • Add a restriction to each snippet to only include it if Moodle core version is lower / greater than a given value
  • Build concept and software support to retrieve SCSS snippets from marketplace
  • Add snippets from a private Github repo
  • Add snippets in child theme
  • Add inline search to the snippets table
  • Allow the admin to automatically activate / deactivate the snippets based on time constraints
  • Try to ship the updated SCSS directly after reloading the page and not just with the subsequent page load
  • Fix redirect to /theme/boost_union/snippets/overview.php when the settings tab is saved
  • Do not purge the cache after each change on the overview page, provide an "Apply changes" button instead
  • Show the CSS code in the information modal, just for information purposes

To Discuss:

  • Snippets filename: provide recommendation for either using underscores or dashes.

@abias
Copy link
Member

abias commented Sep 6, 2024

Hi @Menrath ,

many thanks for taking the time to submit this PR after the Devcamp!
I just went ahead an squashed the commits in your branch and amended the list of possible additional features based on the results of the Devcamp as well.

As soon as I have time, I will then review the PR.
Please stay tuned.

Cheers,
Alex

@Menrath Menrath force-pushed the css_snippets branch 2 times, most recently from 41d45e6 to 125838b Compare September 10, 2024 10:24
Copy link
Contributor Author

@Menrath Menrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Those improvements all look good to me!

@Menrath
Copy link
Contributor Author

Menrath commented Sep 16, 2024

@abias I started some drafts on manually uploading snippets: Two possible solutions: just use a filepicker and add a delete action to the table, or use the filemanager and it's builtin "management" of uploaded files. I would favour the first, as the UI could be more compact. Maybe also putting the pilepicker in a modal to save UI space?

@abias
Copy link
Member

abias commented Nov 6, 2024

I started some drafts on manually uploading snippets: Two possible solutions: just use a filepicker and add a delete action to the table, or use the filemanager and it's builtin "management" of uploaded files. I would favour the first, as the UI could be more compact. Maybe also putting the pilepicker in a modal to save UI space?

@Menrath - Thanks for asking.
Frankly, I would favour the second one as all the management functionality is already there in the filepicker and it matches the way how BU manages other uploaded files.

I just went ahead and pushed some additional commits which introduce a settings tab on the CSS snippets page on which you will find a (already functional) kill switch for the built-in snippets and a (currently not yet working) filepicker for uploaded snippets. I would appreciate if you could go ahead and add the necessary logic to load and use the uploaded snippets on this basis.

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.

2 participants