1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Initial avatar display! More coming soon, including a button on the user preferences page to the upload page :P

This commit is contained in:
Starbeamrainbowlabs 2017-06-18 12:00:40 +01:00
parent 2e1e6a5b2b
commit 3ec7722453
5 changed files with 21 additions and 2 deletions

View file

@ -9,6 +9,11 @@
- Initial open search support! - Initial open search support!
- After visiting your wiki once, you'll be able to press `<tab>` when typing the path to your wiki to perform a search. - After visiting your wiki once, you'll be able to press `<tab>` when typing the path to your wiki to perform a search.
- It'll only work if your wiki is at the top-level of a domain (subdomains are ok). This is a restriction of the protocol, not Pepperminty Wiki! - It'll only work if your wiki is at the top-level of a domain (subdomains are ok). This is a restriction of the protocol, not Pepperminty Wiki!
- Avatars!
- Gravatar is used if a user hasn't uploaded an avatar yet
- An identicon is rendered if a user hasn't specified an email address or uploaded a gravatar yet either
- Added `avatars_show` and `avatars_size` settings to control the displaying & size of rendered avatars.
- Added the `avatar` action, which 307 redirects to the appropriate avatar image
### Changed ### Changed
- Updated MathJax CDN link, as cdn.mathjax.org is being retired ([source](https://www.mathjax.org/cdn-shutting-down/)). - Updated MathJax CDN link, as cdn.mathjax.org is being retired ([source](https://www.mathjax.org/cdn-shutting-down/)).

View file

@ -155,6 +155,8 @@ $guiConfig = <<<'GUICONFIG'
}}, }},
"min_preview_size": {"type": "number", "description": "The minimum allowed size of generated preview images in pixels.", "default": 1}, "min_preview_size": {"type": "number", "description": "The minimum allowed size of generated preview images in pixels.", "default": 1},
"max_preview_size": {"type": "number", "description": "The maximum allowed size of generated preview images in pixels.", "default": 2048}, "max_preview_size": {"type": "number", "description": "The maximum allowed size of generated preview images in pixels.", "default": 2048},
"avatars_show": {"type": "checkbox", "description": "Whether or not to show avatars requires the 'user-preferences' and 'upload' modules, though uploads themselvess can be turned off so long as all avatars have already been uploaded - it's only the 'preview' action that's actually used.", "default": true},
"avatars_size": {"type": "number", "description": "The image size to render avatars at. Does not affect the size they're stored at - only the inline rendered size (e.g. on the recent changes page etc.)", "default": 32},
"search_characters_context": {"type": "number", "description": "The number of characters that should be displayed either side of a matching term in the context below each search result.", "default": 200}, "search_characters_context": {"type": "number", "description": "The number of characters that should be displayed either side of a matching term in the context below each search result.", "default": 200},
"search_title_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's title.", "default": 10}, "search_title_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's title.", "default": 10},
"search_tags_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3}, "search_tags_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3},
@ -250,6 +252,7 @@ audio, video, img { max-width: 100%; }
figure:not(.preview) { display: inline-block; } figure:not(.preview) { display: inline-block; }
figure:not(.preview) > :first-child { display: block; } figure:not(.preview) > :first-child { display: block; }
figcaption { text-align: center; } figcaption { text-align: center; }
.avatar { vertical-align: middle; }
.printable { padding: 2rem; } .printable { padding: 2rem; }
@ -1560,9 +1563,13 @@ class page_renderer
{ {
global $settings; global $settings;
$result = ""; $result = "";
$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>";
if($settings->avatars_show)
$result .= "<img class='avatar' src='?action=avatar&user=" . urlencode($name) . "&size=$settings->avatars_size' /> ";
if(in_array($name, $settings->admins)) if(in_array($name, $settings->admins))
$result .= $settings->admindisplaychar; $result .= $settings->admindisplaychar;
$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>" . htmlentities($name) . "</a>"; $result .= htmlentities($name);
$result .= "</a>";
return $result; return $result;
} }

View file

@ -1214,9 +1214,13 @@ class page_renderer
{ {
global $settings; global $settings;
$result = ""; $result = "";
$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>";
if($settings->avatars_show)
$result .= "<img class='avatar' src='?action=avatar&user=" . urlencode($name) . "&size=$settings->avatars_size' /> ";
if(in_array($name, $settings->admins)) if(in_array($name, $settings->admins))
$result .= $settings->admindisplaychar; $result .= $settings->admindisplaychar;
$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>" . htmlentities($name) . "</a>"; $result .= htmlentities($name);
$result .= "</a>";
return $result; return $result;
} }

View file

@ -133,6 +133,8 @@
}}, }},
"min_preview_size": {"type": "number", "description": "The minimum allowed size of generated preview images in pixels.", "default": 1}, "min_preview_size": {"type": "number", "description": "The minimum allowed size of generated preview images in pixels.", "default": 1},
"max_preview_size": {"type": "number", "description": "The maximum allowed size of generated preview images in pixels.", "default": 2048}, "max_preview_size": {"type": "number", "description": "The maximum allowed size of generated preview images in pixels.", "default": 2048},
"avatars_show": {"type": "checkbox", "description": "Whether or not to show avatars requires the 'user-preferences' and 'upload' modules, though uploads themselvess can be turned off so long as all avatars have already been uploaded - it's only the 'preview' action that's actually used.", "default": true},
"avatars_size": {"type": "number", "description": "The image size to render avatars at. Does not affect the size they're stored at - only the inline rendered size (e.g. on the recent changes page etc.)", "default": 32},
"search_characters_context": {"type": "number", "description": "The number of characters that should be displayed either side of a matching term in the context below each search result.", "default": 200}, "search_characters_context": {"type": "number", "description": "The number of characters that should be displayed either side of a matching term in the context below each search result.", "default": 200},
"search_title_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's title.", "default": 10}, "search_title_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's title.", "default": 10},
"search_tags_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3}, "search_tags_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3},

View file

@ -41,6 +41,7 @@ audio, video, img { max-width: 100%; }
figure:not(.preview) { display: inline-block; } figure:not(.preview) { display: inline-block; }
figure:not(.preview) > :first-child { display: block; } figure:not(.preview) > :first-child { display: block; }
figcaption { text-align: center; } figcaption { text-align: center; }
.avatar { vertical-align: middle; }
.printable { padding: 2rem; } .printable { padding: 2rem; }