Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7487931
TemplateSearchLayout.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
TemplateSearchLayout.js
View Options
const
FavoritesStore
=
require
(
'./FavoritesStore.js'
);
const
SearchWidget
=
require
(
'./SearchWidget.js'
);
const
TemplateList
=
require
(
'./TemplateList.js'
);
/**
* @class
* @extends OO.ui.PanelLayout
*
* @constructor
* @param {Object} [config] Configuration options.
*/
function
TemplateSearchLayout
(
config
)
{
config
=
Object
.
assign
(
{
padded
:
true
,
expanded
:
false
},
config
);
TemplateSearchLayout
.
super
.
call
(
this
,
config
);
const
favoritesStore
=
new
FavoritesStore
();
this
.
searchWidget
=
new
SearchWidget
(
{
favoritesStore
:
favoritesStore
}
);
this
.
searchWidget
.
connect
(
this
,
{
choose
:
'onAddTemplate'
}
);
this
.
searchWidget
.
getMenu
().
connect
(
this
,
{
choose
:
'onAddTemplate'
}
);
const
field
=
new
OO
.
ui
.
FieldLayout
(
this
.
searchWidget
,
{
label
:
mw
.
msg
(
'templatedata-search-description'
),
align
:
'top'
}
);
// By design, this is a tab bar with just a single tab.
const
tabLayout
=
new
OO
.
ui
.
IndexLayout
(
{
expanded
:
false
,
framed
:
false
,
classes
:
[
'ext-templatedata-search-tabs'
]
}
);
const
templateList
=
new
TemplateList
(
{
favoritesStore
:
favoritesStore
}
);
templateList
.
connect
(
this
,
{
choose
:
'onAddTemplate'
}
);
tabLayout
.
addTabPanels
(
[
templateList
]
);
const
searchFieldset
=
new
OO
.
ui
.
FieldsetLayout
(
{
label
:
mw
.
msg
(
'templatedata-search-title'
),
icon
:
'puzzle'
,
items
:
[
field
,
tabLayout
]
}
);
this
.
$element
.
addClass
(
'ext-templatedata-search'
)
.
append
(
$
(
'<div>'
)
.
append
(
searchFieldset
.
$element
)
);
}
/* Setup */
OO
.
inheritClass
(
TemplateSearchLayout
,
OO
.
ui
.
PanelLayout
);
/* Events */
/**
* When a template is choosen by searching or other means.
*
* @event choose
* @param {Object} The template data of the chosen template.
*/
/* Methods */
/**
* @fires choose
* @param {Object} data The texmplate data of the choosen template
*/
TemplateSearchLayout
.
prototype
.
onAddTemplate
=
function
(
data
)
{
if
(
!
data
)
{
return
;
}
this
.
emit
(
'choose'
,
data
);
};
TemplateSearchLayout
.
prototype
.
focus
=
function
()
{
this
.
searchWidget
.
$input
.
trigger
(
'focus'
);
};
module
.
exports
=
TemplateSearchLayout
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 16:33 (1 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7d/82/0f0c33445d202e0d7e117ca61484
Default Alt Text
TemplateSearchLayout.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment