Skip to content

Commit

Permalink
Add Usage note as Snippet header to be shown in the details popup
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Sep 18, 2024
1 parent aca5a30 commit 938ee63
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion amd/build/snippetsdetailsmodal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/snippetsdetailsmodal.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions amd/src/snippetsdetailsmodal.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const buildModal = async(element) => {
goal: element.getAttribute('data-goal'),
scope: element.getAttribute('data-scope'),
creator: element.getAttribute('data-creator'),
usagenote: element.getAttribute('data-usagenote'),
};

await ModalCancel.create({
Expand Down
4 changes: 3 additions & 1 deletion classes/snippets.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class snippets {
'Goal',
'Description',
'Scope',
'Creator'
'Creator',
'Usage note',
];

/**
Expand Down Expand Up @@ -219,6 +220,7 @@ public static function get_snippet_meta($path, $source): stdClass|null {
$snippet->scope = $headers['Scope'];
$snippet->goal = $headers['Goal'];
$snippet->creator = $headers['Creator'];
$snippet->usagenote = $headers['Usage note'];
$snippet->source = $source;
$snippet->image = $image;

Expand Down
1 change: 1 addition & 0 deletions classes/table/snippets_overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public function col_actions($data) {
'data-scope' => $this->pick_and_build_badge('snippetsscope'.$data->scope),
'data-description' => $data->description,
'data-creator' => $data->creator,
'data-usagenote' => $data->usagenote,
'data-image' => $data->image,
],
];
Expand Down
1 change: 1 addition & 0 deletions lang/en/theme_boost_union.php
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@
$string['snippetssource'] = 'Source';
$string['snippetssourcetheme_boost_union'] = 'Boost Union built-in';
$string['snippetstitle'] = 'Title';
$string['snippetsusagenote'] = 'Usage note';

// Settings: Smart menus page.
$string['smartmenus'] = 'Smart menus';
Expand Down
3 changes: 2 additions & 1 deletion snippets/builtin/international_day_against_homophobia.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* Snippet Title: Rainbow navbar for anti-homophobia day
* Scope: global
* Goal: eyecandy
* Description: 17 May is a special day for the queer community - the International Day against Homophobia, Biphobia and Transphobia. This CSS changes the background of the primary navbar to rainbow colors to commemorate and support the special day.<br /><em>Please note: To make this CSS snippet work, you have to set the 'theme_boost_union | navbarcolor' setting to 'Dark navbar with light font color' as well.</em>
* Description: 17 May is a special day for the queer community - the International Day against Homophobia, Biphobia and Transphobia. This CSS changes the background of the primary navbar to rainbow colors to commemorate and support the special day.
* Usage note: To make this CSS snippet work, you have to set the 'theme_boost_union | navbarcolor' setting to 'Dark navbar with light font color' as well.
* Creator: Nils Promer and Alexander Brehm
*
* @package theme_boost_union
Expand Down
6 changes: 6 additions & 0 deletions templates/snippetsdetailsmodal.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
<img src="{{image}}" alt="{{#str}}snippetsdetailspreview, theme_boost_union{{/str}}" class="w-100 p-2 border rounded">
</div>
{{/image}}
{{#usagenote}}
<div class="mb-4">
<h6>{{#str}}snippetsusagenote, theme_boost_union{{/str}}</h6>
<p>{{{usagenote}}}</p>
</div>
{{/usagenote}}
<h6>{{#str}}snippetsdetails, theme_boost_union{{/str}}</h6>
<table class="table table-striped">
<tbody>
Expand Down

0 comments on commit 938ee63

Please sign in to comment.