Skip to content

Commit

Permalink
Show compact view control
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Mar 31, 2017
1 parent 36b854f commit 9fdb6ee
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ represented in the table below.

| URL Parameter | Default | Description |
|---|---|---|
| `compact` | `false` | Hides interface controls when set to `true`. |
| `host` | `http://hostname` | The host name of the server. |
| `port` | `57772` | The port of the server. |
| `webAppName` | `EntityBrowser` | Caché web application name. |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iknow-entity-browser",
"version": "0.9.7",
"version": "0.9.8",
"description": "Visualizer for iKnow entities",
"main": "gulpfile.babel.js",
"scripts": {
Expand Down
Binary file modified src/static/fonts/iknowentitybrowsericons.eot
Binary file not shown.
2 changes: 2 additions & 0 deletions src/static/fonts/iknowentitybrowsericons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/static/fonts/iknowentitybrowsericons.ttf
Binary file not shown.
Binary file modified src/static/fonts/iknowentitybrowsericons.woff
Binary file not shown.
20 changes: 18 additions & 2 deletions src/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@
</div>
</div>
</div>
<div id="rightTopIcons">
<div id="rightTopExpandButton" class="rightTopIcons" style="opacity: 0">
<div id="expandViewButton" class="ui icon-expand hint">
<div class="tooltip">
<div class="label">
Show all controls
</div>
</div>
</div>
</div>
<div id="rightTopIcons" class="rightTopIcons" style="opacity: 0">
<div id="settingsToggle" class="ui icon-settings hint">
<div class="tooltip">
<div class="label">
Expand All @@ -48,8 +57,15 @@
</div>
</div>
</a>
<div id="collapseCompactViewButton" class="ui icon-collapse hint">
<div class="tooltip">
<div class="label">
Collapse to compact view
</div>
</div>
</div>
</div>
<div id="toolbarIcons">
<div id="toolbarIcons" style="opacity: 0">
<div id="undoButton" class="ui icon-undo hint">
<div class="top tooltip">
<div class="label">
Expand Down
29 changes: 28 additions & 1 deletion src/static/js/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import * as graph from "../graph";
import * as sourceSettings from "./sourceSettings";
import * as tabularViewSettings from "./tabularViewSettings";
import * as storage from "../storage";
import { getChanges, applyChanges, init as initValues, applyFixedClasses } from "./values";
import { getChanges, getOption, applyChanges, init as initValues, applyFixedClasses, setOption
} from "./values";
import { makeAutosizable } from "../utils";

function toggleSettings (uiStateModel) {
Expand Down Expand Up @@ -40,4 +41,30 @@ export function init () {
location.reload();
});

updateCompactView();

}

function updateCompactView () {

let compact = !!getOption("compact");

function toggle (element, flag = true) {
element.style.opacity = flag ? 1 : 0;
element.style.pointerEvents = flag ? "all" : "none";
}

toggle(document.getElementById("rightTopIcons"), !compact);
toggle(document.getElementById("rightTopExpandButton"), compact);
toggle(document.getElementById("toolbarIcons"), !compact);

document.getElementById("expandViewButton").addEventListener("click", () => {
setOption("compact", false);
updateCompactView();
});
document.getElementById("collapseCompactViewButton").addEventListener("click", () => {
setOption("compact", true);
updateCompactView();
});

}
5 changes: 4 additions & 1 deletion src/static/js/settings/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as url from "../url";
const STORAGE_KEY = "settings";

const settingsTypes = {
compact: Boolean,
host: String,
port: Number,
webAppName: String,
Expand All @@ -16,7 +17,9 @@ const settingsTypes = {
tabularShowHiddenNodes: Boolean
};

const settings = { // assign defaults here
// defaults are assigned here
const settings = {
compact: false,
host: "",
port: 57772,
webAppName: "EntityBrowser",
Expand Down
6 changes: 6 additions & 0 deletions src/static/scss/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,9 @@
.icon-question:before {
content: "\7a";
}
.icon-expand:before {
content: "\41";
}
.icon-collapse:before {
content: "\42";
}
4 changes: 2 additions & 2 deletions src/static/scss/interface.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

}

#rightTopIcons {
.rightTopIcons {

position: absolute;
left: -35px;
Expand All @@ -33,7 +33,7 @@

}

#table.active #rightTopIcons {
#table.active .rightTopIcons {
top: 6px;
}

Expand Down

0 comments on commit 9fdb6ee

Please sign in to comment.