pairing_matrix 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b191b038b63516fd7f21303ce0a02956df04a6b1
4
- data.tar.gz: eaa74828a094edc65c29293a4a8e10093114dcce
3
+ metadata.gz: 9de294d0c49a37755ec26bef5fe0455a5e96c7fe
4
+ data.tar.gz: 6b8f4f58eb23f7a0439e169970d963b5ded06c4b
5
5
  SHA512:
6
- metadata.gz: a8ba7db4c885470c987ec539ae65c56d85f1f4c05e4cbdda56e2c76fca22dfdd4a95d2d7ba66f146353c6d22490d2ab5b0b572d4e65b0bb27dbbd3cb03d53c07
7
- data.tar.gz: c8e71a71916321687468878bd731b38dfe279f06d0ef001f4b6d542d89cba198b8103df4b6a7ab0b0f602728999e7f3cdcc2715ccbb5d552a53deb6c6af4f15e
6
+ metadata.gz: 725f1224c7aa0dfd393ef4f541024a3ab438ead50d6b9f750cd1e49c5d8cf83b16b2bb960a514e2acc3d015ff1b351fbed432a99dc59987adfebd3487665e3f0
7
+ data.tar.gz: aa04c0c2a9acfba65bcbe7d37c85e844cb494b9ef825c7c17973adbe1ef890837c5effe032ea3afee448f1d24df31e20921b7d90af68a83602b64aadecb9bd52
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PairingMatrix
2
2
 
3
- TODO: Write a gem description
3
+ [![Gem Version](https://badge.fury.io/rb/pairing_matrix.svg)](https://badge.fury.io/rb/pairing_matrix)
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,5 +16,5 @@ $(document).ready(function () {
16
16
  renderMatrix($('#days').val())
17
17
  });
18
18
 
19
- renderMatrix(10);
19
+ renderMatrix($('#days').val());
20
20
  });
@@ -1,4 +1,6 @@
1
1
  var playground;
2
+
3
+
2
4
  function PlayGround(selector) {
3
5
  this.el = null;
4
6
  this.centerX = 400;
@@ -45,6 +47,7 @@ function PlayGround(selector) {
45
47
  return "M " + fromCoordinates.x + " " + fromCoordinates.y + " Q 400 350 " +
46
48
  toCoordinates.x + " " + toCoordinates.y;
47
49
  })
50
+ .attr("id", function(d) {return d.join('_')})
48
51
  .attr("fill", "none")
49
52
  .attr("stroke", "#DD1031")
50
53
  .attr("stroke-width", function (d) {
@@ -93,7 +96,8 @@ function PlayGround(selector) {
93
96
  .attr("id", function (d) {
94
97
  return d
95
98
  })
96
- .call(this.dragger());
99
+ .on('mouseover', this.mouseOver)
100
+ .on('mouseout', this.mouseOut)
97
101
  players.append("text")
98
102
  .attr("class", "player_names")
99
103
  .text(function (d) {
@@ -108,21 +112,58 @@ function PlayGround(selector) {
108
112
  .attr("fill", "#000000");
109
113
  };
110
114
 
111
- this.dragger = function () {
112
- return d3.drag().on("drag", function (d) {
113
- var player = d3.select(this);
114
- var playerName = $(player[0]).siblings(".player_names");
115
- var newPoint = playground.closestPointOnCircumference();
116
- player.attr("cx", newPoint[0]);
117
- player.attr("cy", newPoint[1]);
118
- playerName.attr("x", function () {
119
- return newPoint[0] + 2
120
- });
121
- playerName.attr("y", function () {
122
- return newPoint[1] + 3
123
- });
124
- playground.updateConnectorsPath(player.attr("id"), newPoint);
125
- })
115
+ this.getAllPairsContaining = function(name) {
116
+ return _.filter(this.validPairsData, function(pair) {
117
+ return pair.indexOf(name) >= 0
118
+ });
119
+ };
120
+
121
+ this.mouseOut = function(id) {
122
+ var connectedPairs = playground.getAllPairsContaining(id);
123
+ connectedPairs.forEach(function(pair) {
124
+ var firstPerson = pair[0];
125
+ var secondPerson = pair[1];
126
+ d3.selectAll($("#" + firstPerson))
127
+ .style("fill", function(d) {return d.color})
128
+ .style("stroke", "#EE1031")
129
+ d3.selectAll($("#" + secondPerson))
130
+ .style("fill", function(d) {return d.color})
131
+ .style("stroke", "#EE1031")
132
+ var pairId = pair.join('_');
133
+ d3.selectAll($("#" + pairId))
134
+ .style("fill", "none")
135
+ .style("stroke", "red")
136
+ .style("stroke-width", function(d) {return d.color})
137
+ })
138
+ d3.selectAll($("#" + id))
139
+ .style("fill", function(d) {return d.color})
140
+ .style("stroke", "#EE1031")
141
+ .attr("stroke-opacity", 0.75)
142
+ .attr("stroke-width", function (d) {
143
+ return playground.connectionScale(playground.getSoloContribution(d))
144
+ });
145
+ }
146
+
147
+ this.mouseOver = function (id) {
148
+ var connectedPairs = playground.getAllPairsContaining(id);
149
+ connectedPairs.forEach(function(pair) {
150
+ var firstPerson = pair[0];
151
+ var secondPerson = pair[1];
152
+ d3.selectAll($("#" + firstPerson))
153
+ .style("fill", "red")
154
+ .style("stroke", "blue");
155
+ d3.selectAll($("#" + secondPerson))
156
+ .style("fill", "red")
157
+ .style("stroke", "blue");
158
+ var pairId = pair.join('_');
159
+ d3.selectAll($("#" + pairId))
160
+ .style("fill", "none")
161
+ .style("stroke", "black")
162
+ .style("stroke-width", "2px")
163
+ })
164
+ d3.selectAll($("#" + id))
165
+ .style("fill", "red")
166
+ .style("stroke", "blue");
126
167
  };
127
168
 
128
169
  this.updateConnectorsPath = function (playerId, newPoint) {
@@ -1,3 +1,3 @@
1
1
  module PairingMatrix
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -18,5 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_dependency 'sinatra', '~> 1.4.8'
22
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pairing_matrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ajit Singh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.8
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.8
27
41
  description: Draw pairing matrix from given repos and configurations
28
42
  email:
29
43
  - jeetsingh.ajit@gmail.com
@@ -69,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
83
  version: '0'
70
84
  requirements: []
71
85
  rubyforge_project:
72
- rubygems_version: 2.6.7
86
+ rubygems_version: 2.5.1
73
87
  signing_key:
74
88
  specification_version: 4
75
89
  summary: Draw pairing matrix from given repos and configurations