diff --git a/build/index.php b/build/index.php index aafb1b6..f135dcc 100644 --- a/build/index.php +++ b/build/index.php @@ -264,12 +264,15 @@ h1 { text-align: center; } .logo { max-width: 4rem; max-height: 4rem; vertical-align: middle; } main:not(.printable) { padding: 2rem; background: #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); } +.search-result::before { content: attr(data-result-number); position: relative; top: 3.2rem; color: rgba(33, 33, 33, 0.3); font-size: 2rem; } +.search-result > h2 { margin-left: 2rem; } + label:not(.link-display-label) { display: inline-block; min-width: 7rem; } input[type=text]:not(.link-display), input[type=password], textarea { margin: 0.5rem 0.8rem; } input[type=text], input[type=password], textarea, #search-box { padding: 0.5rem 0.8rem; background: #d5cbf9; border: 0; border-radius: 0.3rem; font-size: 1rem; color: #442772; } -textarea { width: calc(100% - 2rem); min-height: 35rem; font-size: 1.25rem; } -textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); margin: 0.5rem 0.8rem; padding: 0.5rem; } -textarea ~ input[type=submit] { font-weight: bolder; } +textarea { min-height: 35rem; font-size: 1.25rem; } +textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); } +textarea ~ input[type=submit] { margin: 0.5rem 0.8rem; padding: 0.5rem; font-weight: bolder; } .editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; } .page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; } @@ -1376,6 +1379,7 @@ register_module([ $content .= " \n"; $content .= ""; + $i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something foreach($results as $result) { $link = "?page=" . rawurlencode($result["pagename"]); @@ -1383,10 +1387,14 @@ register_module([ $context = search::extract_context($_GET["query"], $pagesource); $context = search::highlight_context($_GET["query"], $context); - $content .= "
\n"; + // We add 1 to $i here to convert it from an index to a result + // number as people expect it to start from 1 + $content .= "
\n"; $content .= "

" . $result["pagename"] . "

\n"; $content .= "

$context

\n"; $content .= "
\n"; + + $i++; } $content .= "\n"; diff --git a/module_index.json b/module_index.json index 295606c..4fea5b4 100644 --- a/module_index.json +++ b/module_index.json @@ -50,7 +50,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds proper search functionality to Pepperminty Wiki. Note that this module, at the moment, just contains test code while I figure out how best to write a search engine.", "id": "feature-search", - "lastupdate": 1446300290, + "lastupdate": 1446300948, "optional": false }, { diff --git a/modules/feature-search.php b/modules/feature-search.php index 2607f46..46ebb4f 100644 --- a/modules/feature-search.php +++ b/modules/feature-search.php @@ -51,6 +51,7 @@ register_module([ $content .= " \n"; $content .= ""; + $i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something foreach($results as $result) { $link = "?page=" . rawurlencode($result["pagename"]); @@ -58,10 +59,14 @@ register_module([ $context = search::extract_context($_GET["query"], $pagesource); $context = search::highlight_context($_GET["query"], $context); - $content .= "
\n"; + // We add 1 to $i here to convert it from an index to a result + // number as people expect it to start from 1 + $content .= "
\n"; $content .= "

" . $result["pagename"] . "

\n"; $content .= "

$context

\n"; $content .= "
\n"; + + $i++; } $content .= "\n"; diff --git a/settings.fragment.php b/settings.fragment.php index bdfa76a..1174418 100644 --- a/settings.fragment.php +++ b/settings.fragment.php @@ -261,12 +261,15 @@ h1 { text-align: center; } .logo { max-width: 4rem; max-height: 4rem; vertical-align: middle; } main:not(.printable) { padding: 2rem; background: #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); } +.search-result::before { content: attr(data-result-number); position: relative; top: 3.2rem; color: rgba(33, 33, 33, 0.3); font-size: 2rem; } +.search-result > h2 { margin-left: 2rem; } + label:not(.link-display-label) { display: inline-block; min-width: 7rem; } input[type=text]:not(.link-display), input[type=password], textarea { margin: 0.5rem 0.8rem; } input[type=text], input[type=password], textarea, #search-box { padding: 0.5rem 0.8rem; background: #d5cbf9; border: 0; border-radius: 0.3rem; font-size: 1rem; color: #442772; } -textarea { width: calc(100% - 2rem); min-height: 35rem; font-size: 1.25rem; } -textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); margin: 0.5rem 0.8rem; padding: 0.5rem; } -textarea ~ input[type=submit] { font-weight: bolder; } +textarea { min-height: 35rem; font-size: 1.25rem; } +textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); } +textarea ~ input[type=submit] { margin: 0.5rem 0.8rem; padding: 0.5rem; font-weight: bolder; } .editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; } .page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; }