forked from Cavemanon/cavepaintings
Help extension
Provides foundation for help pages that are generated from loaded extensions, starting with comprehensive search documentation. Addresses #522
This commit is contained in:
@@ -228,6 +228,16 @@ class NumericScore extends Extension
|
||||
$event->replace('$score', $event->image->numeric_score);
|
||||
}
|
||||
|
||||
public function onHelpPageBuilding(HelpPageBuildingEvent $event)
|
||||
{
|
||||
if($event->key===HelpPages::SEARCH) {
|
||||
$block = new Block();
|
||||
$block->header = "Numeric Score";
|
||||
$block->body = $this->theme->get_help_html();
|
||||
$event->add_block($block);
|
||||
}
|
||||
}
|
||||
|
||||
public function onSearchTermParse(SearchTermParseEvent $event)
|
||||
{
|
||||
$matches = [];
|
||||
|
@@ -91,4 +91,47 @@ class NumericScoreTheme extends Themelet
|
||||
$page->add_block(new Block("Navigation", $nav_html, "left", 10));
|
||||
$page->add_block(new Block(null, $html, "main", 30));
|
||||
}
|
||||
|
||||
|
||||
public function get_help_html()
|
||||
{
|
||||
return '<p>Search for images that have received numeric scores by the score or by the scorer.</p>
|
||||
<div class="command_example">
|
||||
<pre>score=1</pre>
|
||||
<p>Returns images with a score of 1.</p>
|
||||
</div>
|
||||
<div class="command_example">
|
||||
<pre>score>0</pre>
|
||||
<p>Returns images with a score of 1 or more.</p>
|
||||
</div>
|
||||
<p>Can use <, <=, >, >=, or =.</p>
|
||||
|
||||
<div class="command_example">
|
||||
<pre>upvoted_by=username</pre>
|
||||
<p>Returns images upvoted by "username".</p>
|
||||
</div>
|
||||
<div class="command_example">
|
||||
<pre>upvoted_by_id=123</pre>
|
||||
<p>Returns images upvoted by user 123.</p>
|
||||
</div>
|
||||
<div class="command_example">
|
||||
<pre>downvoted_by=username</pre>
|
||||
<p>Returns images downvoted by "username".</p>
|
||||
</div>
|
||||
<div class="command_example">
|
||||
<pre>downvoted_by_id=123</pre>
|
||||
<p>Returns images downvoted by user 123.</p>
|
||||
</div>
|
||||
|
||||
<div class="command_example">
|
||||
<pre>order:score_desc</pre>
|
||||
<p>Sorts the search results by score, descending.</p>
|
||||
</div>
|
||||
<div class="command_example">
|
||||
<pre>order:score_asc</pre>
|
||||
<p>Sorts the search results by score, ascending.</p>
|
||||
</div>
|
||||
';
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user