mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
Polish code assist panel
This commit is contained in:
parent
417622a7ca
commit
55abf7349b
@ -2,13 +2,8 @@
|
||||
<div class="input-assist">
|
||||
<div wicket:id="suggestions" class="suggestions autosize">
|
||||
<table>
|
||||
<tr wicket:id="suggestions">
|
||||
<td class="suggestion">
|
||||
<a wicket:id="link">
|
||||
<wicket:link><img src="bullet.gif"></wicket:link>
|
||||
<span wicket:id="label"></span>
|
||||
</a>
|
||||
</td>
|
||||
<tr wicket:id="suggestions" class="suggestion">
|
||||
<td wicket:id="content" class="content"></td>
|
||||
<td wicket:id="description" class="description"></td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -16,7 +11,7 @@
|
||||
<ul class="help list-unstyled">
|
||||
<li wicket:id="hints"></li>
|
||||
<li class="complete"></li>
|
||||
<li class="esc">Press 'esc' to hide suggestions</li>
|
||||
<li class="select">↑↓ to select item</li>
|
||||
</ul>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
@ -90,22 +90,22 @@ class AssistPanel extends Panel {
|
||||
|
||||
private Component newSuggestionItem(String itemId, InputCompletion suggestion) {
|
||||
WebMarkupContainer item = new WebMarkupContainer(itemId);
|
||||
WebMarkupContainer link = new WebMarkupContainer("link");
|
||||
LinearRange match = suggestion.getMatch();
|
||||
String label = suggestion.getLabel();
|
||||
if (match != null) {
|
||||
String prefix = StringEscapeUtils.escapeHtml4(label.substring(0, match.getFrom()));
|
||||
String suffix = StringEscapeUtils.escapeHtml4(label.substring(match.getTo()));
|
||||
String matched = StringEscapeUtils.escapeHtml4(label.substring(match.getFrom(), match.getTo()));
|
||||
link.add(new Label("label", prefix + "<b>" + matched + "</b>" + suffix).setEscapeModelStrings(false));
|
||||
item.add(new Label("content", prefix + "<b>" + matched + "</b>" + suffix).setEscapeModelStrings(false));
|
||||
} else {
|
||||
link.add(new Label("label", label));
|
||||
item.add(new Label("content", label));
|
||||
}
|
||||
item.add(link);
|
||||
|
||||
if (suggestion.getDescription() != null)
|
||||
item.add(new Label("description", suggestion.getDescription()));
|
||||
else
|
||||
item.add(new Label("description"));
|
||||
|
||||
String content = suggestion.getContent();
|
||||
item.add(AttributeAppender.append("data-content", content));
|
||||
item.add(AttributeAppender.append("data-caret", suggestion.getCaret()));
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB |
@ -1,13 +1,13 @@
|
||||
.input-assist {
|
||||
padding: 8px;
|
||||
}
|
||||
.input-assist td {
|
||||
padding: 4px 8px;
|
||||
.input-assist .suggestions {
|
||||
max-height: 400px;
|
||||
}
|
||||
.input-assist a {
|
||||
.input-assist td {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
padding: 4px 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.input-assist tr:hover td {
|
||||
background-color: #E0F0FC;
|
||||
@ -16,20 +16,22 @@
|
||||
background-color: #CBE8FB;
|
||||
border-color: #8BC8F9;
|
||||
}
|
||||
.input-assist .description {
|
||||
color: #999;
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
}
|
||||
.input-assist .suggestions {
|
||||
max-height: 400px;
|
||||
}
|
||||
.input-assist .suggestion a {
|
||||
.input-assist tr.suggestion td.content {
|
||||
padding-right: 12px;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.input-assist tr.suggestion td.content:before {
|
||||
font-family: FontAwesome;
|
||||
content: "\f105";
|
||||
margin-right: 8px;
|
||||
}
|
||||
.input-assist td.description {
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
.input-assist .help {
|
||||
margin-top: 8px;
|
||||
margin-bottom: 0;
|
||||
|
||||
@ -192,9 +192,9 @@ onedev.server.inputassist = {
|
||||
|
||||
updateHelp: function($dropdown) {
|
||||
if ($dropdown.find("tr.active").length != 0) {
|
||||
$dropdown.find(".help>.complete").empty().append("Press 'enter' to complete selected item");
|
||||
$dropdown.find(".help>.complete").empty().append("Tab or ↵ to complete with selected item");
|
||||
} else {
|
||||
$dropdown.find(".help>.complete").empty().append("Press 'tab' to complete first item");
|
||||
$dropdown.find(".help>.complete").empty().append("Tab to complete with first item");
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user