jointjs 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Rakefile +2 -3
  4. data/{ethereal.gemspec → jointjs.gemspec} +2 -2
  5. data/lib/jointjs.rb +5 -0
  6. data/lib/jointjs/app/assets/javascripts/joint.js.coffee +12 -0
  7. data/lib/jointjs/app/assets/javascripts/joint/base.js.coffee +18 -0
  8. data/lib/{ethereal/app/assets/javascripts/ethereal/god.js.coffee → jointjs/app/assets/javascripts/joint/creator.js.coffee} +8 -13
  9. data/lib/{ethereal/app/assets/javascripts/ethereal → jointjs/app/assets/javascripts/joint}/ext.js.coffee +0 -0
  10. data/lib/jointjs/app/assets/javascripts/joint/watcher.js.coffee +49 -0
  11. data/lib/jointjs/app/assets/javascripts/joint/xhr.js.coffee +110 -0
  12. data/lib/{ethereal → jointjs}/app/views/layouts/application.js.erb +0 -0
  13. data/lib/{ethereal → jointjs}/railtie.rb +2 -2
  14. data/lib/jointjs/version.rb +3 -0
  15. data/test/Gemfile +27 -0
  16. data/test/Gemfile.lock +164 -0
  17. data/test/README.rdoc +28 -0
  18. data/test/Rakefile +6 -0
  19. data/test/app/assets/javascripts/application.js +4 -0
  20. data/test/app/assets/javascripts/item.js.coffee +2 -0
  21. data/test/app/assets/javascripts/list.js.coffee +6 -0
  22. data/test/app/assets/javascripts/tests/instances.js.coffee +17 -0
  23. data/test/app/assets/javascripts/tests/xhr.js.coffee +20 -0
  24. data/test/app/controllers/todos_controller.rb +18 -0
  25. data/test/app/models/todo.rb +2 -0
  26. data/test/app/views/layouts/application.html.erb +16 -0
  27. data/test/app/views/todos/_todo.html.erb +1 -0
  28. data/test/app/views/todos/create.js.erb +1 -0
  29. data/test/app/views/todos/index.html.erb +11 -0
  30. data/test/bin/bundle +3 -0
  31. data/test/bin/rails +8 -0
  32. data/test/bin/rake +8 -0
  33. data/test/bin/setup +29 -0
  34. data/test/bin/spring +18 -0
  35. data/test/config.ru +4 -0
  36. data/test/config/application.rb +26 -0
  37. data/test/config/boot.rb +3 -0
  38. data/test/config/database.yml +8 -2
  39. data/test/config/environment.rb +5 -0
  40. data/test/config/environments/development.rb +41 -0
  41. data/test/config/environments/production.rb +79 -0
  42. data/test/config/environments/test.rb +42 -0
  43. data/test/config/initializers/assets.rb +11 -0
  44. data/test/config/initializers/backtrace_silencers.rb +7 -0
  45. data/test/config/initializers/cookies_serializer.rb +3 -0
  46. data/test/config/initializers/filter_parameter_logging.rb +4 -0
  47. data/test/config/initializers/inflections.rb +16 -0
  48. data/test/config/initializers/mime_types.rb +4 -0
  49. data/test/config/initializers/session_store.rb +3 -0
  50. data/test/config/initializers/wrap_parameters.rb +14 -0
  51. data/test/config/locales/en.yml +23 -0
  52. data/test/config/routes.rb +4 -0
  53. data/test/config/secrets.yml +2 -0
  54. data/test/db/joint_test +0 -0
  55. data/test/db/migrate/20150106151240_create_todos.rb +9 -0
  56. data/test/db/schema.rb +22 -0
  57. data/test/db/seeds.rb +1 -0
  58. metadata +97 -28
  59. data/lib/ethereal.rb +0 -5
  60. data/lib/ethereal/app/assets/javascripts/ethereal.js.coffee +0 -6
  61. data/lib/ethereal/app/assets/javascripts/ethereal/base.js.coffee +0 -51
  62. data/lib/ethereal/app/assets/javascripts/ethereal/model.js.coffee +0 -8
  63. data/lib/ethereal/app/assets/javascripts/ethereal/watcher.js.coffee +0 -50
  64. data/lib/ethereal/app/assets/javascripts/ethereal/xhr.js.coffee +0 -34
  65. data/lib/ethereal/version.rb +0 -3
  66. data/test/application.rb +0 -11
  67. data/test/js/base.js +0 -33
  68. data/test/js/god.js +0 -67
  69. data/test/js/list.js +0 -21
  70. data/test/js/models.js +0 -23
  71. data/test/js/watcher.js +0 -110
  72. data/test/test_helper.rb +0 -15
@@ -1,3 +0,0 @@
1
- module Ethereal
2
- VERSION = "0.0.3"
3
- end
data/test/application.rb DELETED
@@ -1,11 +0,0 @@
1
- require 'rails/all'
2
-
3
- Bundler.require(:default, Rails.env)
4
-
5
- module Ethereal
6
- class Application < Rails::Application
7
- config.root = File.expand_path('../', __FILE__)
8
- config.eager_load = false
9
- end
10
- end
11
-
data/test/js/base.js DELETED
@@ -1,33 +0,0 @@
1
- // Generated by CoffeeScript 1.6.3
2
- (function() {
3
- var listen;
4
-
5
- this.Shiny = {
6
- attributeName: 'as'
7
- };
8
-
9
- this.Shiny.isDOM = function(el) {
10
- return el instanceof HTMLDocument || el instanceof HTMLElement;
11
- };
12
-
13
- listen = function(e) {
14
- if (e.type && e.type === 'DOMContentLoaded') {
15
- document.removeEventListener('DOMContentLoaded', listen);
16
- }
17
- Shiny.Watcher(document, {
18
- attributes: true,
19
- subtree: true,
20
- childList: true,
21
- attributeFilter: [Shiny.attributeName],
22
- characterData: true
23
- });
24
- return Shiny.Watcher().inspect(document.body);
25
- };
26
-
27
- if (document.readyState === 'complete') {
28
- listen();
29
- } else {
30
- document.addEventListener('DOMContentLoaded', listen);
31
- }
32
-
33
- }).call(this);
data/test/js/god.js DELETED
@@ -1,67 +0,0 @@
1
- // Generated by CoffeeScript 1.6.3
2
- (function() {
3
- var God,
4
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
5
-
6
- God = (function() {
7
- function God() {
8
- this.modelExists = __bind(this.modelExists, this);
9
- this.destroy = __bind(this.destroy, this);
10
- this.create = __bind(this.create, this);
11
- this.update = __bind(this.update, this);
12
- }
13
-
14
- God.prototype.update = function(el) {
15
- var model;
16
- model = el.getAttribute(Shiny.attributeName);
17
- if (model != null) {
18
- return this.create(el, model);
19
- } else {
20
- return this.destroy(el);
21
- }
22
- };
23
-
24
- God.prototype.create = function(el) {
25
- var model;
26
- model = el.getAttribute(Shiny.attributeName);
27
- if (this.modelExists(model)) {
28
- el.instance = new Shiny.Models.klass[model](el);
29
- el.instance.element = function() {
30
- return el;
31
- };
32
- el.instance.on = function(event, target, callback) {
33
- if (callback != null) {
34
- el.instance.on.events.push([event, target, callback]);
35
- } else {
36
- callback = target;
37
- target = el;
38
- }
39
- return target.addEventListener(event, callback);
40
- };
41
- el.instance.on.events = [];
42
- if (el.instance.loaded != null) {
43
- return el.instance.loaded();
44
- }
45
- } else {
46
- throw "error: " + model + " is not registered. Add your model with Shiny.Models.add(" + model + ")";
47
- }
48
- };
49
-
50
- God.prototype.destroy = function(el) {
51
- var _ref;
52
- return (_ref = el.instance.on.events) != null ? _ref.forEach(function(event) {
53
- return event[1].removeEventListener(event[0], event[2]);
54
- }) : void 0;
55
- };
56
-
57
- God.prototype.modelExists = function(name) {
58
- return Shiny.Models.klass[name] != null;
59
- };
60
-
61
- return God;
62
-
63
- })();
64
-
65
- Shiny.God = new God;
66
-
67
- }).call(this);
data/test/js/list.js DELETED
@@ -1,21 +0,0 @@
1
- (function() {
2
-
3
- function List() {
4
-
5
- this.loaded = function() {
6
-
7
- this.on('click', this.remove)
8
- this.on('click', document, this.hello)
9
- }
10
-
11
- this.remove = function() {
12
- this.remove()
13
- }
14
-
15
- this.hello = function() {
16
- console.log('hello')
17
- }
18
- }
19
-
20
- Shiny.Models.add(List, "List")
21
- })()
data/test/js/models.js DELETED
@@ -1,23 +0,0 @@
1
- // Generated by CoffeeScript 1.6.3
2
- (function() {
3
- var Models;
4
-
5
- Models = (function() {
6
- function Models() {}
7
-
8
- Models.prototype.klass = {};
9
-
10
- Models.prototype.add = function(kls, name) {
11
- if (name == null) {
12
- name = kls.name;
13
- }
14
- return this.klass[name] = kls;
15
- };
16
-
17
- return Models;
18
-
19
- })();
20
-
21
- Shiny.Models = new Models;
22
-
23
- }).call(this);
data/test/js/watcher.js DELETED
@@ -1,110 +0,0 @@
1
- // Generated by CoffeeScript 1.6.3
2
- (function() {
3
- var Watcher, instance,
4
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
5
-
6
- instance = void 0;
7
-
8
- Watcher = (function() {
9
- function Watcher(target, config) {
10
- if (config == null) {
11
- config = {};
12
- }
13
- this.destroy = __bind(this.destroy, this);
14
- this.add = __bind(this.add, this);
15
- this.observed = __bind(this.observed, this);
16
- this.observer = new MutationObserver(this.observed);
17
- this.observer.observe(target, config);
18
- }
19
-
20
- Watcher.prototype.observed = function(mutations) {
21
- var _this = this;
22
- return mutations.forEach(function(mutation) {
23
- if (mutation.type === 'attributes') {
24
- return Shiny.God.update(target);
25
- } else {
26
- _this.add(mutation.addedNodes);
27
- return _this.destroy(mutation.removedNodes);
28
- }
29
- });
30
- };
31
-
32
- Watcher.prototype.add = function(nodes) {
33
- var child, node, _i, _len, _results;
34
- _results = [];
35
- for (_i = 0, _len = nodes.length; _i < _len; _i++) {
36
- node = nodes[_i];
37
- if (!Shiny.isDOM(node)) {
38
- continue;
39
- }
40
- if (node.hasAttribute(Shiny.attributeName)) {
41
- Shiny.God.create(node, node.getAttribute(Shiny.attributeName));
42
- }
43
- _results.push((function() {
44
- var _j, _len1, _ref, _results1;
45
- _ref = node.querySelectorAll("[" + Shiny.attributeName + "]");
46
- _results1 = [];
47
- for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
48
- child = _ref[_j];
49
- _results1.push(Shiny.God.create(child, child.getAttribute(Shiny.attributeName)));
50
- }
51
- return _results1;
52
- })());
53
- }
54
- return _results;
55
- };
56
-
57
- Watcher.prototype.destroy = function(nodes) {
58
- var child, node, _i, _len, _results;
59
- _results = [];
60
- for (_i = 0, _len = nodes.length; _i < _len; _i++) {
61
- node = nodes[_i];
62
- if (!Shiny.isDOM(node)) {
63
- continue;
64
- }
65
- if (node.hasAttribute(Shiny.attributeName)) {
66
- Shiny.God.destroy(node);
67
- }
68
- _results.push((function() {
69
- var _j, _len1, _ref, _results1;
70
- _ref = node.querySelectorAll("[" + Shiny.attributeName + "]");
71
- _results1 = [];
72
- for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
73
- child = _ref[_j];
74
- _results1.push(Shiny.God.destroy(child));
75
- }
76
- return _results1;
77
- })());
78
- }
79
- return _results;
80
- };
81
-
82
- Watcher.prototype.inspect = function(node) {
83
- var el, found, _i, _len, _results;
84
- if (Shiny.isDOM(node)) {
85
- found = node.querySelectorAll("[" + Shiny.attributeName + "]");
86
- _results = [];
87
- for (_i = 0, _len = found.length; _i < _len; _i++) {
88
- el = found[_i];
89
- _results.push(Shiny.God.create(el));
90
- }
91
- return _results;
92
- }
93
- };
94
-
95
- return Watcher;
96
-
97
- })();
98
-
99
- Shiny.Watcher = function() {
100
- var i, target;
101
- if (instance == null) {
102
- i = 0;
103
- target = null;
104
- target = Shiny.isDOM(arguments[i]) ? arguments[i++] : document;
105
- instance = new Watcher(target, arguments[i]);
106
- }
107
- return instance;
108
- };
109
-
110
- }).call(this);
data/test/test_helper.rb DELETED
@@ -1,15 +0,0 @@
1
- # The order of this file is important as some requirements execute ruby code automatically.
2
-
3
- ENV['RAILS_ENV'] ||= 'test'
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
-
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7
- require_relative 'application'
8
-
9
- Ethereal::Application.initialize!
10
-
11
- require 'rails/test_help'
12
-
13
- class ActiveSupport::TestCase
14
- end
15
-