Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4094881
SearchResultsView.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
SearchResultsView.js
View Options
const
View
=
require
(
'../View'
),
Icon
=
require
(
'../Icon'
),
Anchor
=
require
(
'../Anchor'
),
icons
=
require
(
'../icons'
),
$spinner
=
icons
.
spinner
().
$el
,
util
=
require
(
'../util'
);
/**
* Render search results.
*
* @extends module:mobile.startup/View
* @param {Object} options
* @param {string} options.searchContentLabel actionable label to tell the user they can "search
* within pages rather than doing a full text search
* @param {string} options.noResultsMsg shows when no results displayed
* @param {string} options.searchContentNoResultsMsg alternative to options.searchContentLabel that
* shows when no search results have been displayed.
*/
class
SearchResultsView
extends
View
{
/** @inheritdoc */
get
isTemplateMode
()
{
return
true
;
}
/** @inheritdoc */
get
template
()
{
return
util
.
template
(
`
<div class="search-results-view">
<div class="search-content">
<div class="caption">
<p class="with-results">{{searchContentLabel}}</p>
<p class="without-results">{{noResultsMsg}}</p>
<p class="without-results">{{{searchContentNoResultsMsg}}}</p>
</div>
</div>
<div class="spinner-container position-fixed"></div>
<div class="results">
<div class="results-list-container"></div>
{{#feedback}}
<div class="search-feedback">
{{prompt}}
</div>
{{/feedback}}
</div>
</div>`
);
}
/** @inheritdoc */
preRender
()
{
const
feedbackLink
=
mw
.
config
.
get
(
'wgCirrusSearchFeedbackLink'
);
if
(
feedbackLink
)
{
this
.
options
.
feedback
=
{
prompt
:
mw
.
msg
(
'mobile-frontend-search-feedback-prompt'
)
};
}
}
/** @inheritdoc */
postRender
(
options
)
{
const
feedbackLink
=
mw
.
config
.
get
(
'wgCirrusSearchFeedbackLink'
);
super
.
postRender
(
options
);
this
.
$el
.
find
(
'.search-content'
).
prepend
(
new
Icon
(
{
icon
:
'articlesSearch'
}
).
$el
);
this
.
$el
.
find
(
'.spinner-container'
).
append
(
$spinner
);
if
(
feedbackLink
)
{
this
.
$el
.
find
(
'.search-feedback'
).
append
(
new
Anchor
(
{
label
:
mw
.
msg
(
'mobile-frontend-search-feedback-link-text'
),
href
:
feedbackLink
}
).
$el
);
}
}
}
module
.
exports
=
SearchResultsView
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 13:31 (4 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
56/3a/12592de6f490f6c93643c5fea898
Default Alt Text
SearchResultsView.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment