Skip to content

Commit f2c92ff

Browse files
Namespace select bar width fix
1 parent 96b2f7a commit f2c92ff

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cache-visual-editor",
33
"printableName": "Cache Visual Editor",
4-
"version": "0.3.0",
4+
"version": "0.3.1",
55
"description": "Visual class editor for InterSystems Caché",
66
"main": "index.js",
77
"keywords": [

source/client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="medium menu icon"></div>
2020
<div class="medium back icon" id="backButton"></div>
2121
<span class="title">
22-
<select id="topNamespace">
22+
<select id="topNamespace" class="topNamespace">
2323
<option>Loading...</option>
2424
</select><span id="topTitle"></span>
2525
</span>

source/client/js/classEditor/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,30 @@ let backButton = onInit(() => {
3434
if (ns === data["namespace"]) c.setAttribute("selected", "true");
3535
topNamespace.appendChild(c);
3636
}
37+
updateHeaderNamespaceWidth(NAMESPACE);
3738
topNamespace.addEventListener("change", (e) => {
3839
NAMESPACE = (e.target || e.srcElement).value;
40+
updateHeaderNamespaceWidth(NAMESPACE);
3941
loadLevel("");
4042
});
4143
});
4244

45+
/**
46+
* This function uses a bit of trick to compute the width of the namespace element in header, but it
47+
* does its job.
48+
* @param {string} namespace
49+
*/
50+
function updateHeaderNamespaceWidth (namespace) {
51+
let temp = block("select", "topNamespace"),
52+
t2 = block("option");
53+
t2.setAttribute("selected", "true");
54+
t2.textContent = namespace;
55+
temp.appendChild(t2);
56+
topNamespace.parentNode.appendChild(temp);
57+
topNamespace.style.width = temp.offsetWidth + "px";
58+
topNamespace.parentNode.removeChild(temp);
59+
}
60+
4361
function orderData (data) {
4462
var sortable = [],
4563
sorted = {};

source/client/scss/basic.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,15 @@ html, body {
4545
font-weight: bold;
4646
vertical-align: middle;
4747

48-
#topNamespace {
48+
.topNamespace {
4949

5050
background: none;
5151
border: none;
5252
font: inherit;
53-
outline: none;
53+
outline: 0;
5454
-webkit-appearance: none;
5555
-moz-appearance: none;
5656
appearance: none;
57-
text-indent: 1px;
58-
text-overflow: '';
5957
cursor: pointer;
6058
@include transition($defaultTransition);
6159

0 commit comments

Comments
 (0)