Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
b98d116a
Commit
b98d116a
authored
Feb 05, 2014
by
Antonio Ramirez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored to add function on `gii.js`
parent
65c740e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
gii.js
extensions/gii/assets/gii.js
+9
-0
ActiveField.php
extensions/gii/components/ActiveField.php
+1
-8
No files found.
extensions/gii/assets/gii.js
View file @
b98d116a
...
@@ -70,6 +70,15 @@ yii.gii = (function ($) {
...
@@ -70,6 +70,15 @@ yii.gii = (function ($) {
};
};
return
{
return
{
autocomplete
:
function
(
counter
,
data
)
{
var
datum
=
new
Bloodhound
({
datumTokenizer
:
function
(
d
){
return
Bloodhound
.
tokenizers
.
whitespace
(
d
.
word
);},
queryTokenizer
:
Bloodhound
.
tokenizers
.
whitespace
,
local
:
data
});
datum
.
initialize
();
jQuery
(
'.typeahead-'
+
counter
).
typeahead
(
null
,{
displayKey
:
'word'
,
source
:
datum
.
ttAdapter
()});
},
init
:
function
()
{
init
:
function
()
{
initHintBlocks
();
initHintBlocks
();
initStickyInputs
();
initStickyInputs
();
...
...
extensions/gii/components/ActiveField.php
View file @
b98d116a
...
@@ -66,14 +66,7 @@ class ActiveField extends \yii\widgets\ActiveField
...
@@ -66,14 +66,7 @@ class ActiveField extends \yii\widgets\ActiveField
foreach
(
$data
as
&
$item
)
{
foreach
(
$data
as
&
$item
)
{
$item
=
array
(
'word'
=>
$item
);
$item
=
array
(
'word'
=>
$item
);
}
}
$this
->
form
->
getView
()
->
registerJs
(
"
$this
->
form
->
getView
()
->
registerJs
(
"yii.gii.autocomplete(
$counter
, "
.
Json
::
encode
(
$data
)
.
");"
);
var datum = new Bloodhound({
datumTokenizer: function(d){return Bloodhound.tokenizers.whitespace(d.word);},
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: "
.
Json
::
encode
(
$data
)
.
"
});
datum.initialize();
jQuery('.typeahead-
{
$counter
}
').typeahead(null,{displayKey: 'word', source: datum.ttAdapter()});"
);
return
$this
;
return
$this
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment