society 1.5.2 → 1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 314ce3aa0269b8b5439f24496dde46ed84a92680
4
- data.tar.gz: b0505cb00af63e4ddcaf281aebc94d8c88e2e52f
3
+ metadata.gz: d5405b409b32bc4c1fbcdcd16045f6e89f914dc0
4
+ data.tar.gz: 37a9b9232cb5ad32076b44b93a79d23d8dfbecaf
5
5
  SHA512:
6
- metadata.gz: 86af6d89d6f5587ec9e8af1e1bac8d7617b801d36f98288055d9c59a6143c3901a0d58c9c30e03fae5249e618bc8048dcb3aeb3ca648c733a59be3742b5fa857
7
- data.tar.gz: 3e06ec5cd417258c8f1b0862a6a49f1a132530f77803be766c2966f33c97c9f9fdbdf2f68ab40d2e65d578f46c67433d3900713b7abbfe34bcf173bf0f991948
6
+ metadata.gz: 16e7aa59852b0fc41fe030d3d65794cb9db6d9f1ff14897ea6f2e2cc08402456c30921b99acaf7931f978eba1d5427d79d3585724455fda8d184722a3a343109
7
+ data.tar.gz: fbb2a78386bbc8642fdc036e6a216430814c3df7052afb9ab8e5b6042224d58153737ed04e3f02eb449f55a474f2822e5e46cde94140d14e107619b9ff8c0179
data/README.md CHANGED
@@ -32,7 +32,7 @@ Or install it yourself as:
32
32
 
33
33
  From your terminal:
34
34
 
35
- society from path/to/models
35
+ society from path/to/models [more/paths/if/applicable]
36
36
 
37
37
  and then open `doc/society/index.htm` in your browser.
38
38
 
@@ -40,7 +40,7 @@ a {
40
40
  background-image: none;
41
41
  }
42
42
 
43
- label.society-heatmap-select-label {
43
+ label {
44
44
  font: 300 12px "Helvetica Neue", Helvetica, Arial, sans-serif !important;
45
45
  }
46
46
 
@@ -51,6 +51,7 @@
51
51
  .attr('transform', 'translate(' + this.radius + ',' + this.radius + ')');
52
52
  this.linkAnchor = this.svg.append('g');
53
53
  this.nodeAnchor = this.svg.append('g');
54
+ $("#class-names").on('keydown', this.toggleFilteredNodes.bind(this));
54
55
  this.render();
55
56
  d3.select(self.frameElement).style('height', this.diameter + 'px');
56
57
  };
@@ -60,6 +61,10 @@
60
61
  this.render();
61
62
  };
62
63
 
64
+ NetworkGraph.prototype.toggleFilteredNodes = function () {
65
+ this.render();
66
+ };
67
+
63
68
  NetworkGraph.prototype.hideIsolatedNodes = function() {
64
69
  this.includeIsolatedNodes = false;
65
70
  this.render();
@@ -72,9 +77,9 @@
72
77
 
73
78
  NetworkGraph.prototype.getData = function() {
74
79
  if (this.includeIsolatedNodes) {
75
- return this.data;
80
+ return filterByAutocomplete(this.data);
76
81
  } else {
77
- return filterIsolatedNodes(this.data);
82
+ return filterByAutocomplete(filterIsolatedNodes(this.data));
78
83
  }
79
84
  };
80
85
 
@@ -233,6 +238,45 @@
233
238
  return map[""];
234
239
  };
235
240
 
241
+ function filterByAutocomplete(data) {
242
+ filter = $('#class-names').val()
243
+ if (filter === "") {
244
+ return data;
245
+ };
246
+
247
+ var json = data.slice();
248
+ var filtered = [];
249
+ var names = json.map(function(klass) {
250
+ return klass.name;
251
+ });
252
+
253
+ json.forEach(function(klass) {
254
+ klass.relations.forEach(function(edge) {
255
+ if (klass.name === edge) return;
256
+ json[names.indexOf(edge)]._HAS_INCOMING_ = true;
257
+ });
258
+ });
259
+
260
+ json.forEach(function(klass) {
261
+ var re = new RegExp(filter, "i");
262
+ if (klass.name.search(re) !== -1) {
263
+ filtered.push(klass);
264
+ klass.relations.forEach(function(edge) {
265
+ filtered.push(
266
+ {
267
+ "name": edge,
268
+ "relations": [ klass.name ]
269
+ }
270
+ );
271
+ });
272
+ };
273
+ });
274
+ if (filtered.length > 0) {
275
+ return filtered;
276
+ } else {
277
+ return data;
278
+ }
279
+ };
236
280
 
237
281
  function filterIsolatedNodes(data) {
238
282
  var json = data.slice();
@@ -34,6 +34,10 @@
34
34
  %span.key-red outgoing references
35
35
  Double-click on a class name to enter
36
36
  focus mode. Press ESC to return to the full view.
37
+ %div
38
+ %label Filter by class name:
39
+ %input#class-names{:type => "text"}/
40
+ %br
37
41
  #network{:style => "height: 100%; width: 100%;"}
38
42
  #tabs-2
39
43
  %div
@@ -1,3 +1,3 @@
1
1
  module Society
2
- VERSION = "1.5.2"
2
+ VERSION = "1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: society
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: '1.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coraline Ada Ehmke