diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/app/views.js b/app/views.js index 2a1ec01..0e34ec3 100644 --- a/app/views.js +++ b/app/views.js @@ -60,13 +60,8 @@ app.modelView(app.models.HelpResult, { $html: null, renderView: function(model) { - var hb = this.$html.builder(); - var commands = model.commands; - hb.element('ul', { class: 'help' }, function() { - commands.forEach(function(c) { - hb.element('li', c.name + " — " + c.description); - });}); - return hb.toHtmlElement(); + var template = document.getElementById('helpView').innerHTML; + return this.$html.element(template); } }); @@ -80,14 +75,10 @@ app.modelView(app.models.DisplayResult, { $html: null, renderView: function(model) { - var resultView = this.$html.element( - '
' + - '
>{input}
' + - '
' + - '
', model); - + var resultView = this.$html.element(document.getElementById('resultView').innerHTML, model); var contentView = app.buildViewFor(model.content); - resultView.childNodes[1].appendChild(contentView); + + resultView.querySelector('.content').appendChild(contentView); return resultView; } }); diff --git a/components/modelViewsFeature.js b/components/viewsFeature.js similarity index 92% rename from components/modelViewsFeature.js rename to components/viewsFeature.js index 426ef4d..2f8603e 100644 --- a/components/modelViewsFeature.js +++ b/components/viewsFeature.js @@ -1,4 +1,4 @@ -(function(app){ +(function(app, is){ app.modelView = function (modelCtor, builder) { var name = getKey(modelCtor); app.di.register(name, builder); @@ -18,4 +18,4 @@ var str = func.toString(); return str.substr(8, str.indexOf('(') - 8).trim(); } -})(window.app); +})(window.app, window.is); diff --git a/css/styles.css b/css/styles.css index 4f8a587..ebc49b2 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1,4 +1,8 @@ body { font-family: Verdana; font-size: 0.8em } +code { font-size: 1.2em; font-weight: bold; } + +.links { float: right; position: absolute; right: 10px; top: 10px; } + .expressionInput { width: 500px; padding: 3px; border: solid 1px lightgray; } @@ -15,6 +19,9 @@ body { font-family: Verdana; font-size: 0.8em } .expression td { padding: 3px; } .expression { font-size: 1.2em; } +.help { padding: 10px; background: #e0e0e0; } +.help ul { list-style-type: none; margin: 0; padding: 0; } + .error { color: maroon; } #view { padding: 10px} \ No newline at end of file diff --git a/index.html b/index.html index 65053e9..c41f6b3 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ - + @@ -28,11 +28,38 @@

Bitwise Operations Visualised

+ + +
+ + + + + + \ No newline at end of file