Skip to content

Commit

Permalink
Adding topbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
akoprow committed Jan 20, 2012
1 parent 1f171c1 commit d02bbdf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.exe
_build
_tracks
*~
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -4,7 +4,7 @@ SRC = parser.opa user.opa editor.opa webshell.opa

all: $(NAME)

$(NAME):
$(NAME): $(SRC)
opa --parser js-like $(SRC)

clean:
Expand Down
45 changes: 31 additions & 14 deletions webshell.opa
@@ -1,10 +1,13 @@
// license: AGPL
// (c) MLstate, 2011
// (c) MLstate, 2011, 2012
// author: Henri Binsztok
// author: Adam Koprowski (adding Facebook-connectivity)

import stdlib.themes.bootstrap
import stdlib.widgets.bootstrap

WB = WBootstrap

function focus(set) {
Log.warning("focus", set);
#status = "Focus: {set}";
Expand All @@ -18,18 +21,19 @@ function prompt(login) {
</span>
}

client function warner(msg) {
function warner(msg) {
#terminal =+ msg;
}

client function asker(f, msg) {
function asker(f, msg) {
#terminal =+ msg;
}

client function loop(_) {
function loop(_) {
LineEditor.init(#editor, readevalwrite, true);
}


function answer(expr) {
match (Parser.try_parse(Calc.shell, expr)) {
case { none }: "syntax error"
Expand All @@ -51,18 +55,31 @@ client function readevalwrite(expr) {
}

function page() {
html = WBootstrap.Layout.fixed(
WBootstrap.Typography.header(1, none,
<div id="terminal"/>
<div id="line" onready={loop}>
{prompt({none})}
<span id="editor"/>
</div>
));
<>{html}</>
<div id="status"/>
topbar =
WB.Navigation.topbar(
WB.Layout.fixed(
WB.Navigation.brand(<>webshell</>, none, ignore)
)
)
html = WB.Layout.fixed(
WB.Typography.header(1, none,
<div id="terminal"/>
<div id="line" onready={loop}>
{prompt({none})}
<span id="editor"/>
</div>
)
) |> Xhtml.update_class("body", _)
<>
{topbar}
{html}
<div id="status"/>
</>
}

Server.start(
Server.http, { ~page, title: "webshell" }
)

css = css
.body { padding-top: 50px }

0 comments on commit d02bbdf

Please sign in to comment.