rails-erd-d3 0.6.1 → 0.6.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: 0bcce33a5a0973906a644225d4eb35ef4036ad93
4
- data.tar.gz: 286ff8460c731f77176597eee9af5868cb5cb14a
3
+ metadata.gz: 669b8c53622c85d66ddb72a399c07881579ab263
4
+ data.tar.gz: 3c7f273abfa58b44a5783d17087591ae44d516cf
5
5
  SHA512:
6
- metadata.gz: 575cb3adad7cd62ea378c44f0c7c0714e7ce2e2dd899efd0f929b45bb517cb491ce5311e39f7a898ebddc4a78f17aed411217eecb05f598879fc127c663ef4b3
7
- data.tar.gz: 20fae5e7423f1ffb15af3632b0ee64e4eda6d75b835362afe64787bb7b44a124080fa3f5dc9c80416f4e78666913299b061f38d53fc41d2788ee12cac2841b89
6
+ metadata.gz: b6dec3aadd4aa15d3162b4b618e8090a2dd91d03650ecc034603d28596ff87d773752bfc26d8fc9b6692ac1fb3920f0d057fb031506fdc10f83c01e238cbf5dc
7
+ data.tar.gz: c18d321a279720c7b43e96e663f398de62e97ce6b6515267b55c2299a128cde6316832f4f0a7c0b310bbb9d6ffe6bfb1509be36cf7ac81868e1d22842fa632b2
data/Gemfile CHANGED
@@ -4,6 +4,10 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
+ gem "rails"
7
8
  gem "activerecord"
8
9
  gem "sqlite3"
10
+ gem "rspec"
11
+ gem "capybara"
12
+ gem "poltergeist"
9
13
  end
data/README.md CHANGED
@@ -62,33 +62,6 @@ function zoomed() {
62
62
  + ")"
63
63
  );
64
64
  ```
65
- - Add arrows
66
- ```
67
- svg.append("defs").append("marker")
68
- .attr("id", "arrow")
69
- .attr("viewBox", "0 -5 10 10")
70
- .attr("refX", 32)
71
- .attr("refY", 0)
72
- .attr("markerWidth", 7)
73
- .attr("markerHeight", 7)
74
- .attr("orient", "auto")
75
- .append("svg:path")
76
- .attr("d", "M0,-5L10,0L0,5");
77
-
78
- var link = svg.append('g')
79
- .attr("marker-end", "url(#arrow)");
80
- ```
81
- - Add
82
- ```
83
- var link = svg.append('g')
84
- .attr('stroke-width', 2)
85
- ```
86
- - Add
87
- ```
88
- node.append('circle')
89
- .attr('stroke', 'white')
90
- .attr('stroke-width', 3)
91
- ```
92
65
  - Freeze
93
66
  - On
94
67
  ```
@@ -104,15 +77,10 @@ node.append('circle')
104
77
  - Add link to another model in model window
105
78
  - Add tests
106
79
  - ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
107
- - Sort nodes by label
108
- - Check associations
109
- - [X] belongs_to
110
- - [X] has_one
111
- - [x] has_many
112
- - has_many :through
113
- - has_one :through
114
- - has_and_belongs_to_many
115
- - Polymorphic associations
80
+ - Sort by:
81
+ - number of connections
82
+ - number of entries in the table
83
+ - Show table structure on the diagram
116
84
  - Safe as jpg, png
117
85
  - Dependent destroy
118
86
 
@@ -2,11 +2,25 @@
2
2
  $(".visible").click(function() {
3
3
  var klass = $(this).attr("id");
4
4
 
5
- if ($(this).prop("checked")){
6
- $("." + klass).show();
5
+ if ($(this).prop("checked")) {
6
+ $(document.getElementsByClassName(klass)).show();
7
7
  }
8
8
  else {
9
- $("." + klass).hide();
9
+ $(document.getElementsByClassName(klass)).hide();
10
+ }
11
+ });
12
+
13
+ $("#check-all").click(function() {
14
+ if($(this).prop("checked")) {
15
+ $(".visible").each(function() {
16
+ $(this).prop("checked", false);
17
+ $(this).click();
18
+ });
19
+ } else {
20
+ $(".visible").each(function() {
21
+ $(this).prop("checked", true);
22
+ $(this).click();
23
+ });
10
24
  }
11
25
  });
12
26
 
@@ -17,19 +17,20 @@
17
17
  <th>#</th>
18
18
  <th>name</th>
19
19
  <th>type</th>
20
- <th>class_name</th>
20
+ <th>associated class</th>
21
21
  </tr>
22
22
  </thead>
23
23
  <tbody>
24
- <% model.reflections.each_with_index do |r, index| %>
25
- <% name = r[0] %>
24
+ <% model.reflections.each_with_index do |(name, data), index| %>
26
25
  <tr>
27
26
  <th><%= index + 1 %></th>
28
- <td><%= name.camelize %></td>
29
- <td><%= model.reflections[name].macro %></td>
27
+ <td><%= name %></td>
30
28
  <td>
31
- <%= model.reflections[name].options[:class_name] %>
32
- <%= ", through: #{model.reflections[name].options[:through].to_s.capitalize}" if model.reflections[name].options[:through] %>
29
+ <%= data.macro %>
30
+ <%= "<br>through: #{data.options[:through]}" if data.options[:through] %>
31
+ </td>
32
+ <td>
33
+ <%= data.options[:class_name] || name.camelize.singularize %>
33
34
  </td>
34
35
  </tr>
35
36
  <% end %>
@@ -86,6 +87,10 @@
86
87
  <th>#</th>
87
88
  <th>name</th>
88
89
  <th>show</th>
90
+ <th>
91
+ check all
92
+ <input id="check-all" type="checkbox" value="" checked>
93
+ </th>
89
94
  </tr>
90
95
  </thead>
91
96
  <tbody>
data/rails-erd-d3.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "rails-erd-d3"
7
7
  spec.authors = ["Roman Krasavtsev"]
8
8
  spec.email = ["mr.krasavtsev@gmail.com"]
9
- spec.version = "0.6.1"
9
+ spec.version = "0.6.2"
10
10
  spec.summary = "Entity–relationship diagram with D3.js for Rails application"
11
11
  spec.description = "This gem creates entity–relationship diagram with D3.js for your Rails application"
12
12
  spec.homepage = "https://github.com/RomanKrasavtsev/rails-erd-d3"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erd-d3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Krasavtsev