Skip to content

Commit

Permalink
added a layout manager, made it respond to <S-Enter>
Browse files Browse the repository at this point in the history
  • Loading branch information
ngn committed Aug 26, 2014
1 parent 4605a0e commit 8b2b600
Show file tree
Hide file tree
Showing 5 changed files with 5,154 additions and 6 deletions.
2 changes: 1 addition & 1 deletion a.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ router = express.Router()
router.use express.static __dirname

# compile *.coffee on the fly and serve it as *.js
app.get '/:name.js', (req, res, next) ->
app.get '/:name.coffee.js', (req, res, next) ->
require('fs').readFile "#{__dirname}/#{req.params.name}.coffee", 'utf8', (err, s) ->
if err then console.error err; res.status(404).send ''
else res.header('Content-Type', 'application/x-javascript').send require('coffee-script').compile s, bare: true
Expand Down
8 changes: 6 additions & 2 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jQuery ($) ->
cm.setCursor cm.lineCount() - 1, 6

socket.on 'open', (name, text) ->
# todo
layout.open 'east'

cm = CodeMirror document.getElementById('session'),
autofocus: true
Expand Down Expand Up @@ -73,7 +73,11 @@ jQuery ($) ->
$('.glyph', '#lbar').on 'mouseout blur', ->
clearTimeout ttid; ttid = null; $('#tip').hide()

$(window).resize(-> cm.setSize null, $(window).height() - 4 - $('#lbar').height()).resize()
layout = $('body').layout
north: resizable: 0, togglerLength_closed: '100%'
east: initClosed: true, spacing_closed: 0
center: onresize: updateCM = -> cm.setSize $('#session').width(), $('#session').height()
updateCM()

if debug
window.socket = socket
Expand Down
11 changes: 8 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@
border-top-width: 0;
}
#tip-title { padding: 0 0 0 30px; margin: 0; font-weight: bold; }
.ui-layout-resizer { background-color: #ccc; }
.ui-layout-toggler { background-color: #888; }
</style>
</head>
<body>
<div id="lbar"></div>
<div id="session" class="ui-layout-center"></div>
<div id="lbar" class="ui-layout-north"></div>
<div id="tip" style="display: none"><div id="tip-inner"><div id="tip-title"></div><pre id="tip-description"></pre></div></div>
<div id="session"></div>
<div class="ui-layout-east">editor</div>
<script src="/socket.io/socket.io.js"></script>
<script src="node_modules/jquery/dist/cdn/jquery-2.1.1.min.js"></script>
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/mode/apl/apl.js"></script>
<script src="index.js"></script>
<script src="jquery-ui.min.js"></script>
<script src="jquery.layout.js"></script>
<script src="index.coffee.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions jquery-ui.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 8b2b600

Please sign in to comment.