Skip to content

Commit

Permalink
Forgot to commit these 2 files with the last TypeAhead commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jasondavis committed Jul 17, 2013
1 parent 47e25b6 commit 987f3e2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
32 changes: 30 additions & 2 deletions etc/styles/zpanelx/js/zpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// /js/bootstrap-tab.js
// /js/bootstrap-tooltip.js
// /js/bootstrap-popover.js
// /js/bootstrap-typeahead.js
// /js/typeahead.js

var zPanel = {

Expand Down Expand Up @@ -472,7 +472,7 @@ var zPanel = {

// Show Bootstrap typeAhead with Redirect.
// Pass in JSON object with Names and URLs
typeAhead: function(moduleNames) {
typeAheadOLD: function(moduleNames) {
var moduleNames = new Array();
var moduleUrls = new Object();
// Build Arrays
Expand All @@ -492,8 +492,36 @@ var zPanel = {

}
});
},

// Show Bootstrap typeAhead with Redirect.
// Pass in JSON object with Names and URLs
typeAhead: function(moduleNames) {
var moduleNames = new Array();
var moduleUrls = new Object();

// Build Arrays
$.each(moduleJsonData, function(index, module) {
moduleNames.push(module.name);
moduleUrls[module.name] = module.url;
});

// Attach Twitter TypeAhead
$('#module-search').typeahead({
name: 'modules',
local: moduleNames,
header: '<h3 class="module-search">Modules</h3>'
}).on('typeahead:selected typeahead:autocompleted', function($e,datum) {
var $typeahead = $(this);
console.log(moduleUrls[datum.value]);
//setTimeout(function() {
window.location.href = '/?module=' + moduleUrls[datum.value];
//return true;
//}, 1000);
});
}


}

};
Expand Down
9 changes: 5 additions & 4 deletions etc/styles/zpanelx/master.ztml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@

<!-- BEGIN CONTAINER -->
<div class="wrap container">
<form>
<div id="module-search-wrap">
<input type="text" id="module-search" data-provide="typeahead" placeholder="Search" autocomplete="off">
</form>
</div>
<div class="inner-wrap">
<!-- BEGIN LEFT SIDEBAR -->
<div id="page-sidebar" class="col-lg-3 visible-desktop">
Expand Down Expand Up @@ -281,9 +281,10 @@
<script src="<# ui_tpl_assetfolderpath #>js/bootstrap-button.js"></script>
<script src="<# ui_tpl_assetfolderpath #>js/bootstrap-collapse.js"></script>
<script src="<# ui_tpl_assetfolderpath #>js/bootstrap-carousel.js"></script>
<script src="<# ui_tpl_assetfolderpath #>js/bootstrap-typeahead.js"></script>
<script src="<# ui_tpl_assetfolderpath #>js/typeahead.min.js"></script>
<!-- <script type="text/javascript" src="<# ui_tpl_assetfolderpath #>/inc/init.js"></script> -->
<!-- Modulelist for Typeahead -->

<!-- Modulelist for Typeahead -->
<script>
var moduleJsonData = <# ui_tpl_modulelistjson #>;
zPanel.modules.typeAhead(moduleJsonData);
Expand Down

0 comments on commit 987f3e2

Please sign in to comment.