Skip to content

Commit

Permalink
Added subview and jade file to loop through the node's extra properti…
Browse files Browse the repository at this point in the history
…es and display them.
  • Loading branch information
Kelly M. Testa committed Mar 20, 2015
1 parent fa0935a commit 49a7153
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 20 deletions.
17 changes: 15 additions & 2 deletions client/pages/details-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var hasClass = require('amp-has-class');
var PageView = require('./base');
var NodeModel = require('../models/node-model');
var templates = require('../templates');
var ExtraDetailsSubView = require('../partials/extra-details');
var AccountSubView = require('../partials/account-details');
var AddressSubView = require('../partials/address-details');
var AddressRangeSubView = require('../partials/addressRange-details');
Expand Down Expand Up @@ -189,6 +190,16 @@ module.exports = PageView.extend({
model: this.model
});
}
},
extras: {
container: '[data-hook~=extra-properties]',
waitFor: 'model.vertexType',
prepareView: function(el) {
return new ExtraDetailsSubView({
el: el,
model: this.model
});
}
}
},
initialize: function (spec) {
Expand All @@ -204,7 +215,7 @@ module.exports = PageView.extend({
this.pageSize = 10;
},
render: function() {
this.model.fetch();
this.fetchNodeModel();
this.renderWithTemplate();

// render the collection of inEdges and outEdges
Expand All @@ -220,7 +231,9 @@ module.exports = PageView.extend({
this.fetchOutEdgeCollection();
}
this.renderCollection(this.model.outEdges, EdgeView, outList);

},
fetchNodeModel: function() {
this.model.fetch();
},
fetchInEdgeCollection: function() {
this.model.inEdges.fetch({data: {inEdges: true, page: this.currentInEPage, pageSize: this.pageSize}});
Expand Down
9 changes: 9 additions & 0 deletions client/partials/extra-details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var View = require('ampersand-view');
var templates = require('../templates');

module.exports = View.extend({
template: templates.includes.extraProps,
render: function(el) {
this.renderWithTemplate();
}
});
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"amp-add-class": "~1",
"amp-each": "~1.0",
"amp-has-class": "~1",
"amp-has-class": "~1.0.3",
"amp-remove-class": "~1",
"ampersand-checkbox-view": "~2.0",
"ampersand-dom": "~1.2",
Expand Down Expand Up @@ -42,8 +42,7 @@
"templatizer": "~1.1",
"xhr": "~2.0",
"request": "~2.51",
"amp-keys": "~1.0",
"amp-has-class": "~1.0.3"
"amp-keys": "~1.0"
},
"devDependencies": {
"jshint": "*",
Expand Down
6 changes: 6 additions & 0 deletions templates/includes/extraProps.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

span
each key,index in Object.keys(model._values)
if ((key !== "_id") && (key !== "description") && (key !== "vertexType") && (key !== "_type") && (key !== "inEdges") && (key !== "outEdges") && (key !== "name"))
dt #{key}
dd #{model[key]}
31 changes: 16 additions & 15 deletions templates/pages/details.jade
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@ section.page.alert-details
dd(data-hook="name")
dt Description
dd(data-hook="description")
span(data-hook="account-details")
span(data-hook="address-details")
span(data-hook="addressRange-details")
span(data-hook="attack-details")
span(data-hook="attacker-details")
span(data-hook="dnsName-details")
span(data-hook="flow-details")
span(data-hook="ip-details")
span(data-hook="host-details")
span(data-hook="port-details")
span(data-hook="service-details")
span(data-hook="user-details")
span(data-hook="vulnerability-details")
span(data-hook="software-details")
span(data-hook="malware-details")
span(data-hook="extra-properties")
//span(data-hook="account-details")
//span(data-hook="address-details")
//span(data-hook="addressRange-details")
//span(data-hook="attack-details")
//span(data-hook="attacker-details")
//span(data-hook="dnsName-details")
//span(data-hook="flow-details")
//span(data-hook="ip-details")
//span(data-hook="host-details")
//span(data-hook="port-details")
//span(data-hook="service-details")
//span(data-hook="user-details")
//span(data-hook="vulnerability-details")
//span(data-hook="software-details")
//span(data-hook="malware-details")
dt  
dd  
dt Incoming Edges
Expand Down

0 comments on commit 49a7153

Please sign in to comment.