Skip to content

Commit

Permalink
Merge pull request #2 from ooda/improv-ux
Browse files Browse the repository at this point in the history
Improv ux
  • Loading branch information
hdemers committed Feb 28, 2014
2 parents bbeef0e + d5395e3 commit 7d3fb3c
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 109 deletions.
30 changes: 23 additions & 7 deletions vwordnet/static/css/app.less
Expand Up @@ -11,14 +11,20 @@


body {
font-family: 'Source Sans Pro', sans-serif;
font-weight: 400;
background-color: @background;
}

h2 {
font-weight: 600;
}

#alertContainer {
position: fixed;
top: 30px;
width: 100%;
z-index: -1;
z-index: +10;
}

#jsAlert {
Expand All @@ -40,8 +46,8 @@ body {
}

#define {
margin-top: 40px;
margin-left: 40px;
width: 300px;
}


Expand All @@ -61,7 +67,12 @@ body {

.js-node text {
fill: @text;
font: 12px sans-serif;
font-size: 14px;
font-family: 'Source Sans Pro', sans-serif;
}

.js-more-node {
cursor: pointer;
}

.link {
Expand All @@ -82,11 +93,11 @@ circle.js-parent {
}

.rootsynset {
font-size: 24px;
font-size: 20px;
}

.synset {
font-size: 18px;
font-size: 15px;
margin: 10px 0px 20px 20px;
}

Expand All @@ -98,6 +109,11 @@ circle.js-parent {
content: ':';
}

#spinner {
margin-bottom: 10px;
.nav {
margin-bottom: 20px;
}

.nav > li > a {
padding: 5px 10px;
color: #333;
}
12 changes: 1 addition & 11 deletions vwordnet/static/css/base.css
@@ -1,19 +1,9 @@
@import "bootstrap.min.css";
@import "bootstrap-responsive.min.css";

body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif, default;
}
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600);


.navbar-inner {
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}


a {
color: #5b4d3c;
}

9 changes: 0 additions & 9 deletions vwordnet/static/css/bootstrap-responsive.min.css

This file was deleted.

14 changes: 6 additions & 8 deletions vwordnet/static/css/bootstrap.min.css

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions vwordnet/static/js/app.js
Expand Up @@ -9,24 +9,23 @@ define([
"d3",
"viewmodel",
"tree",
"infomsg"
"infomsg",
"bootstrap",
"kinetic"
],
function ($, _, ko, d3, viewmodel, tree, infomsg) {
var exports = {}, define, addGraph;

exports.initialize = function () {
console.log("Initializing app.");
ko.applyBindings(viewmodel);
$("body").kinetic({cursor: 'default', slowdown: 0.7});
};

viewmodel.define = function (word) {
define(viewmodel.word());
};

$(window).resize(function () {

});

define = function (word) {
// Erase previous entries
viewmodel.definitions([]);
Expand All @@ -36,7 +35,7 @@ function ($, _, ko, d3, viewmodel, tree, infomsg) {
}

infomsg.clear();
$("#spinner").show();
$("#spinner").removeClass("hidden");

return $.ajax({
url: "define/" + word,
Expand All @@ -48,12 +47,19 @@ function ($, _, ko, d3, viewmodel, tree, infomsg) {
" a definition for this word. <br>Try again.");
}
else {
// Because Bootstrap selects element with jQuery and selectors must
// escape dots, we need to remove those dots from the ids.
data.definitions.forEach(function (def) {
def.name = def.rootsynset.replace(/\./g, "");
});

// Add nodes to the DOM through Knockout
ko.utils.arrayPushAll(viewmodel.definitions, data.definitions);
// Go through the added nodes and build graphs.
// Go through the added nodes and build graphs.
$(".js-definition").each(function (index, element) {
addGraph(element, data.definitions[index]);
});
$('.nav a:first').tab('show');
}
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log("Failed", jqXHR, textStatus, errorThrown);
Expand All @@ -63,7 +69,7 @@ function ($, _, ko, d3, viewmodel, tree, infomsg) {
"this issue. (" + data.message + ")";
infomsg.error(textStatus, message, 0);
}).always(function () {
$("#spinner").hide();
$("#spinner").addClass("hidden");
});
};

Expand Down
7 changes: 6 additions & 1 deletion vwordnet/static/js/main.js
Expand Up @@ -3,7 +3,8 @@
*/
require({
paths: {
"jquery": "other/jquery-1.9.1.min",
"jquery": "other/jquery-2.1.0.min",
"kinetic": "other/jquery.kinetic.min",
"knockout": "other/knockout-2.2.1",
"underscore": "other/underscore-min",
"domReady": "other/domReady",
Expand Down Expand Up @@ -42,6 +43,10 @@ require({
'bootstrap': {
exports: 'bootstrap',
deps: ['jquery']
},
'kinetic': {
exports: 'kinetic',
deps: ['jquery']
}
}
});
Expand Down
10 changes: 5 additions & 5 deletions vwordnet/static/js/other/bootstrap.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions vwordnet/static/js/other/jquery-1.9.1.min.js

This file was deleted.

4 changes: 4 additions & 0 deletions vwordnet/static/js/other/jquery-2.1.0.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions vwordnet/static/js/other/jquery.kinetic.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7d3fb3c

Please sign in to comment.