Skip to content

Commit

Permalink
added auto resize property to suggest window
Browse files Browse the repository at this point in the history
  • Loading branch information
Łukasz Kosicki authored and chilek committed Mar 25, 2016
1 parent ec523eb commit 2c48f19
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 6 deletions.
8 changes: 7 additions & 1 deletion img/autosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,13 @@ function AutoSuggest(form,elem,uri,autosubmit) {
li.onclick = function() { me.useSuggestion(); }
li.appendChild(a);
} else {
li.innerHTML = word;
word_len = word.length;

if (word_len > AUTOSUGGEST_MAX_LENGTH)
li.innerHTML = word.substring(0, AUTOSUGGEST_MAX_LENGTH) + " ...";
else
li.innerHTML = word;

li.onclick = function() { me.useSuggestion(); }
}
ds.innerHTML = desc;
Expand Down
6 changes: 3 additions & 3 deletions img/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ div.multiselectlayer ul li input { border: none; }

.pre { font-size: 8pt; font-family: Courier, Courier New; }

.suggestion_list { background-color: #EBE4D6; border: 1px solid; padding: 0px; width: 320px; }
.suggestion_list ul { padding: 0; margin: 0; list-style-type: none; }
.suggestion_list span { position: absolute; right: 0; font-size: 9px; margin-right: 2px; color: brown; }
.suggestion_list { background-color: #EBE4D6; border: 1px solid; padding: 0px; min-width: 320px; }
.suggestion_list ul { padding: 0; margin: 0; list-style-type: none;}
.suggestion_list span { float: right; right: 0; font-size: 9px; margin-right: 2px; color: brown; padding-left: 20px; }
.suggestion_list a { text-decoration: none; padding-left: 2px; color: black; }
.suggestion_list .selected { background-color: #CCFFCC; }
.suggestion_list .selected a { color: black; }
Expand Down
3 changes: 3 additions & 0 deletions lib/upgradedb/mysql.2016032500.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
$this->BeginTrans();

define('CONFIG_TYPE_NONE', 7);
define('CONFIG_TYPE_POSITIVE_INTEGER', 2);

$this->Execute("INSERT INTO uiconfig (section, var, value, type) VALUES('phpui', 'default_autosuggest_placement', 'bottom', ?)", array(CONFIG_TYPE_NONE));

$this->Execute("INSERT INTO uiconfig (section, var, value, type) VALUES('phpui', 'autosuggest_max_length', '40', ?)", array(CONFIG_TYPE_POSITIVE_INTEGER));

$this->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2016032500', 'dbversion'));

$this->CommitTrans();
Expand Down
3 changes: 3 additions & 0 deletions lib/upgradedb/postgres.2016032500.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
$this->BeginTrans();

define('CONFIG_TYPE_NONE', 7);
define('CONFIG_TYPE_POSITIVE_INTEGER', 2);

$this->Execute("INSERT INTO uiconfig (section, var, value, type) VALUES('phpui', 'default_autosuggest_placement', 'bottom', ?)", array(CONFIG_TYPE_NONE));

$this->Execute("INSERT INTO uiconfig (section, var, value, type) VALUES('phpui', 'autosuggest_max_length', '40', ?)", array(CONFIG_TYPE_POSITIVE_INTEGER));

$this->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2016032500', 'dbversion'));

$this->CommitTrans();
Expand Down
2 changes: 1 addition & 1 deletion modules/configlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function GetConfigList($order='var,asc', $section='', $search='')
case 'phpui':
switch($item['var'])
{
case 'default_autosuggest_maxlength':
case 'autosuggest_max_length':
$config[$idx]['description'] = trans('Max length of auto suggest proposal, further characters will be dotted.');
break;

Expand Down
5 changes: 5 additions & 0 deletions templates/default/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
</script>
</div>
<div id="pagecontent">
<script type="text/javascript">
<!--//
var AUTOSUGGEST_MAX_LENGTH = {ConfigHelper::getConfig('phpui.autosuggest_max_length')};
//-->
</script>
{block name="quicksearch"}
<div id="autosuggest"><ul><li></li></ul></div>
<form method="post" name="quicksearch" action="?m=quicksearch" id="quicksearch">
Expand Down
7 changes: 6 additions & 1 deletion templates/default/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@
{/block}
{block name=pagecontent}
<div id="pagecontent">
<script type="text/javascript">
<!--//
var AUTOSUGGEST_MAX_LENGTH = {ConfigHelper::getConfig('phpui.autosuggest_max_length')};
//-->
</script>
{block name=quicksearch}
<div id="autosuggest"><ul><li></li></ul></div>
<form method="post" name="quicksearch" action="?m=quicksearch" id="quicksearch">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 1%" class="nobr">
{trans("Search:")}
{include file="quicksearchcontents.html"}
{include file="quicksearchcontents.html"}
{* Enter key submit hack for IE *}
<input type="image" src="img/empty.gif" width="0" height="0" style="border: none;">
</td>
Expand Down

0 comments on commit 2c48f19

Please sign in to comment.