jointjs 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Rakefile +2 -3
- data/{ethereal.gemspec → jointjs.gemspec} +2 -2
- data/lib/jointjs.rb +5 -0
- data/lib/jointjs/app/assets/javascripts/joint.js.coffee +12 -0
- data/lib/jointjs/app/assets/javascripts/joint/base.js.coffee +18 -0
- data/lib/{ethereal/app/assets/javascripts/ethereal/god.js.coffee → jointjs/app/assets/javascripts/joint/creator.js.coffee} +8 -13
- data/lib/{ethereal/app/assets/javascripts/ethereal → jointjs/app/assets/javascripts/joint}/ext.js.coffee +0 -0
- data/lib/jointjs/app/assets/javascripts/joint/watcher.js.coffee +49 -0
- data/lib/jointjs/app/assets/javascripts/joint/xhr.js.coffee +110 -0
- data/lib/{ethereal → jointjs}/app/views/layouts/application.js.erb +0 -0
- data/lib/{ethereal → jointjs}/railtie.rb +2 -2
- data/lib/jointjs/version.rb +3 -0
- data/test/Gemfile +27 -0
- data/test/Gemfile.lock +164 -0
- data/test/README.rdoc +28 -0
- data/test/Rakefile +6 -0
- data/test/app/assets/javascripts/application.js +4 -0
- data/test/app/assets/javascripts/item.js.coffee +2 -0
- data/test/app/assets/javascripts/list.js.coffee +6 -0
- data/test/app/assets/javascripts/tests/instances.js.coffee +17 -0
- data/test/app/assets/javascripts/tests/xhr.js.coffee +20 -0
- data/test/app/controllers/todos_controller.rb +18 -0
- data/test/app/models/todo.rb +2 -0
- data/test/app/views/layouts/application.html.erb +16 -0
- data/test/app/views/todos/_todo.html.erb +1 -0
- data/test/app/views/todos/create.js.erb +1 -0
- data/test/app/views/todos/index.html.erb +11 -0
- data/test/bin/bundle +3 -0
- data/test/bin/rails +8 -0
- data/test/bin/rake +8 -0
- data/test/bin/setup +29 -0
- data/test/bin/spring +18 -0
- data/test/config.ru +4 -0
- data/test/config/application.rb +26 -0
- data/test/config/boot.rb +3 -0
- data/test/config/database.yml +8 -2
- data/test/config/environment.rb +5 -0
- data/test/config/environments/development.rb +41 -0
- data/test/config/environments/production.rb +79 -0
- data/test/config/environments/test.rb +42 -0
- data/test/config/initializers/assets.rb +11 -0
- data/test/config/initializers/backtrace_silencers.rb +7 -0
- data/test/config/initializers/cookies_serializer.rb +3 -0
- data/test/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/config/initializers/inflections.rb +16 -0
- data/test/config/initializers/mime_types.rb +4 -0
- data/test/config/initializers/session_store.rb +3 -0
- data/test/config/initializers/wrap_parameters.rb +14 -0
- data/test/config/locales/en.yml +23 -0
- data/test/config/routes.rb +4 -0
- data/test/config/secrets.yml +2 -0
- data/test/db/joint_test +0 -0
- data/test/db/migrate/20150106151240_create_todos.rb +9 -0
- data/test/db/schema.rb +22 -0
- data/test/db/seeds.rb +1 -0
- metadata +97 -28
- data/lib/ethereal.rb +0 -5
- data/lib/ethereal/app/assets/javascripts/ethereal.js.coffee +0 -6
- data/lib/ethereal/app/assets/javascripts/ethereal/base.js.coffee +0 -51
- data/lib/ethereal/app/assets/javascripts/ethereal/model.js.coffee +0 -8
- data/lib/ethereal/app/assets/javascripts/ethereal/watcher.js.coffee +0 -50
- data/lib/ethereal/app/assets/javascripts/ethereal/xhr.js.coffee +0 -34
- data/lib/ethereal/version.rb +0 -3
- data/test/application.rb +0 -11
- data/test/js/base.js +0 -33
- data/test/js/god.js +0 -67
- data/test/js/list.js +0 -21
- data/test/js/models.js +0 -23
- data/test/js/watcher.js +0 -110
- data/test/test_helper.rb +0 -15
@@ -0,0 +1,11 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
+
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
data/test/db/joint_test
ADDED
Binary file
|
data/test/db/schema.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20150106151240) do
|
15
|
+
|
16
|
+
create_table "todos", force: :cascade do |t|
|
17
|
+
t.string "title", null: false
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/test/db/seeds.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Todo.create(title: 'dishes')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jointjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pier-Olivier Thibault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,27 +78,61 @@ files:
|
|
78
78
|
- LICENSE.txt
|
79
79
|
- README.md
|
80
80
|
- Rakefile
|
81
|
-
-
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
85
|
-
- lib/
|
86
|
-
- lib/
|
87
|
-
- lib/
|
88
|
-
- lib/
|
89
|
-
- lib/
|
90
|
-
- lib/
|
91
|
-
- lib/
|
92
|
-
-
|
93
|
-
- test/
|
81
|
+
- jointjs.gemspec
|
82
|
+
- lib/jointjs.rb
|
83
|
+
- lib/jointjs/app/assets/javascripts/joint.js.coffee
|
84
|
+
- lib/jointjs/app/assets/javascripts/joint/base.js.coffee
|
85
|
+
- lib/jointjs/app/assets/javascripts/joint/creator.js.coffee
|
86
|
+
- lib/jointjs/app/assets/javascripts/joint/ext.js.coffee
|
87
|
+
- lib/jointjs/app/assets/javascripts/joint/watcher.js.coffee
|
88
|
+
- lib/jointjs/app/assets/javascripts/joint/xhr.js.coffee
|
89
|
+
- lib/jointjs/app/views/layouts/application.js.erb
|
90
|
+
- lib/jointjs/railtie.rb
|
91
|
+
- lib/jointjs/version.rb
|
92
|
+
- test/Gemfile
|
93
|
+
- test/Gemfile.lock
|
94
|
+
- test/README.rdoc
|
95
|
+
- test/Rakefile
|
96
|
+
- test/app/assets/javascripts/application.js
|
97
|
+
- test/app/assets/javascripts/item.js.coffee
|
98
|
+
- test/app/assets/javascripts/list.js.coffee
|
99
|
+
- test/app/assets/javascripts/tests/instances.js.coffee
|
100
|
+
- test/app/assets/javascripts/tests/xhr.js.coffee
|
101
|
+
- test/app/controllers/todos_controller.rb
|
102
|
+
- test/app/models/todo.rb
|
103
|
+
- test/app/views/layouts/application.html.erb
|
104
|
+
- test/app/views/todos/_todo.html.erb
|
105
|
+
- test/app/views/todos/create.js.erb
|
106
|
+
- test/app/views/todos/index.html.erb
|
107
|
+
- test/bin/bundle
|
108
|
+
- test/bin/rails
|
109
|
+
- test/bin/rake
|
110
|
+
- test/bin/setup
|
111
|
+
- test/bin/spring
|
112
|
+
- test/config.ru
|
113
|
+
- test/config/application.rb
|
114
|
+
- test/config/boot.rb
|
94
115
|
- test/config/database.yml
|
116
|
+
- test/config/environment.rb
|
117
|
+
- test/config/environments/development.rb
|
118
|
+
- test/config/environments/production.rb
|
119
|
+
- test/config/environments/test.rb
|
120
|
+
- test/config/initializers/assets.rb
|
121
|
+
- test/config/initializers/backtrace_silencers.rb
|
122
|
+
- test/config/initializers/cookies_serializer.rb
|
123
|
+
- test/config/initializers/filter_parameter_logging.rb
|
124
|
+
- test/config/initializers/inflections.rb
|
125
|
+
- test/config/initializers/mime_types.rb
|
126
|
+
- test/config/initializers/session_store.rb
|
127
|
+
- test/config/initializers/wrap_parameters.rb
|
128
|
+
- test/config/locales/en.yml
|
129
|
+
- test/config/routes.rb
|
130
|
+
- test/config/secrets.yml
|
131
|
+
- test/db/joint_test
|
132
|
+
- test/db/migrate/20150106151240_create_todos.rb
|
133
|
+
- test/db/schema.rb
|
134
|
+
- test/db/seeds.rb
|
95
135
|
- test/integration/load_test.rb
|
96
|
-
- test/js/base.js
|
97
|
-
- test/js/god.js
|
98
|
-
- test/js/list.js
|
99
|
-
- test/js/models.js
|
100
|
-
- test/js/watcher.js
|
101
|
-
- test/test_helper.rb
|
102
136
|
homepage:
|
103
137
|
licenses:
|
104
138
|
- MIT
|
@@ -124,12 +158,47 @@ signing_key:
|
|
124
158
|
specification_version: 4
|
125
159
|
summary: Event based JavaScript framework tailored for Ruby on rails.
|
126
160
|
test_files:
|
127
|
-
- test/
|
161
|
+
- test/Gemfile
|
162
|
+
- test/Gemfile.lock
|
163
|
+
- test/README.rdoc
|
164
|
+
- test/Rakefile
|
165
|
+
- test/app/assets/javascripts/application.js
|
166
|
+
- test/app/assets/javascripts/item.js.coffee
|
167
|
+
- test/app/assets/javascripts/list.js.coffee
|
168
|
+
- test/app/assets/javascripts/tests/instances.js.coffee
|
169
|
+
- test/app/assets/javascripts/tests/xhr.js.coffee
|
170
|
+
- test/app/controllers/todos_controller.rb
|
171
|
+
- test/app/models/todo.rb
|
172
|
+
- test/app/views/layouts/application.html.erb
|
173
|
+
- test/app/views/todos/_todo.html.erb
|
174
|
+
- test/app/views/todos/create.js.erb
|
175
|
+
- test/app/views/todos/index.html.erb
|
176
|
+
- test/bin/bundle
|
177
|
+
- test/bin/rails
|
178
|
+
- test/bin/rake
|
179
|
+
- test/bin/setup
|
180
|
+
- test/bin/spring
|
181
|
+
- test/config.ru
|
182
|
+
- test/config/application.rb
|
183
|
+
- test/config/boot.rb
|
128
184
|
- test/config/database.yml
|
185
|
+
- test/config/environment.rb
|
186
|
+
- test/config/environments/development.rb
|
187
|
+
- test/config/environments/production.rb
|
188
|
+
- test/config/environments/test.rb
|
189
|
+
- test/config/initializers/assets.rb
|
190
|
+
- test/config/initializers/backtrace_silencers.rb
|
191
|
+
- test/config/initializers/cookies_serializer.rb
|
192
|
+
- test/config/initializers/filter_parameter_logging.rb
|
193
|
+
- test/config/initializers/inflections.rb
|
194
|
+
- test/config/initializers/mime_types.rb
|
195
|
+
- test/config/initializers/session_store.rb
|
196
|
+
- test/config/initializers/wrap_parameters.rb
|
197
|
+
- test/config/locales/en.yml
|
198
|
+
- test/config/routes.rb
|
199
|
+
- test/config/secrets.yml
|
200
|
+
- test/db/joint_test
|
201
|
+
- test/db/migrate/20150106151240_create_todos.rb
|
202
|
+
- test/db/schema.rb
|
203
|
+
- test/db/seeds.rb
|
129
204
|
- test/integration/load_test.rb
|
130
|
-
- test/js/base.js
|
131
|
-
- test/js/god.js
|
132
|
-
- test/js/list.js
|
133
|
-
- test/js/models.js
|
134
|
-
- test/js/watcher.js
|
135
|
-
- test/test_helper.rb
|
data/lib/ethereal.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
@Ethereal = {
|
2
|
-
attributeName: 'as'
|
3
|
-
}
|
4
|
-
|
5
|
-
@Ethereal.isDOM = (el) ->
|
6
|
-
el instanceof HTMLDocument ||
|
7
|
-
el instanceof HTMLElement
|
8
|
-
|
9
|
-
listen = (e) ->
|
10
|
-
if e.type && e.type == 'DOMContentLoaded'
|
11
|
-
document.removeEventListener('DOMContentLoaded', listen)
|
12
|
-
|
13
|
-
Ethereal.Watcher(document, {
|
14
|
-
attributes: true,
|
15
|
-
subtree: true,
|
16
|
-
childList: true,
|
17
|
-
attributeFilter: [Ethereal.attributeName],
|
18
|
-
characterData: true
|
19
|
-
})
|
20
|
-
|
21
|
-
Ethereal.Watcher().inspect(document.body)
|
22
|
-
|
23
|
-
document.addEventListener 'submit', (e) ->
|
24
|
-
if e.target.getAttribute('disabled')? || e.target.dataset['remote'] != 'true'
|
25
|
-
return
|
26
|
-
|
27
|
-
Ethereal.XHR.Form(e.target)
|
28
|
-
|
29
|
-
e.preventDefault()
|
30
|
-
return false
|
31
|
-
|
32
|
-
document.addEventListener 'click', (e) ->
|
33
|
-
return unless e.target instanceof HTMLAnchorElement
|
34
|
-
|
35
|
-
if e.target.getAttribute('disabled')? || e.target.dataset['remote'] != 'true'
|
36
|
-
return
|
37
|
-
|
38
|
-
xhr = new Ethereal.XHR(e.target)
|
39
|
-
xhr.send(e.target.getAttribute('href'))
|
40
|
-
|
41
|
-
e.preventDefault()
|
42
|
-
return false
|
43
|
-
|
44
|
-
|
45
|
-
if document.readyState == 'complete'
|
46
|
-
listen()
|
47
|
-
else
|
48
|
-
document.addEventListener('DOMContentLoaded', listen)
|
49
|
-
|
50
|
-
|
51
|
-
|
@@ -1,50 +0,0 @@
|
|
1
|
-
instance = undefined
|
2
|
-
|
3
|
-
class Watcher
|
4
|
-
constructor: (target, config = {}) ->
|
5
|
-
@observer = new MutationObserver(@observed)
|
6
|
-
@observer.observe(target, config)
|
7
|
-
|
8
|
-
observed: (mutations) =>
|
9
|
-
mutations.forEach (mutation) =>
|
10
|
-
if mutation.type == 'attributes'
|
11
|
-
Ethereal.God.update(target)
|
12
|
-
else
|
13
|
-
@add(mutation.addedNodes)
|
14
|
-
@destroy(mutation.removedNodes)
|
15
|
-
|
16
|
-
|
17
|
-
add: (nodes) =>
|
18
|
-
for node in nodes
|
19
|
-
continue unless Ethereal.isDOM(node)
|
20
|
-
if node.hasAttribute(Ethereal.attributeName)
|
21
|
-
Ethereal.God.create(node, node.getAttribute(Ethereal.attributeName))
|
22
|
-
|
23
|
-
for child in node.querySelectorAll("[#{Ethereal.attributeName}]")
|
24
|
-
Ethereal.God.create(child, child.getAttribute(Ethereal.attributeName))
|
25
|
-
|
26
|
-
destroy: (nodes) =>
|
27
|
-
for node in nodes
|
28
|
-
continue unless Ethereal.isDOM(node)
|
29
|
-
if node.hasAttribute(Ethereal.attributeName)
|
30
|
-
Ethereal.God.destroy(node)
|
31
|
-
|
32
|
-
for child in node.querySelectorAll("[#{Ethereal.attributeName}]")
|
33
|
-
Ethereal.God.destroy(child)
|
34
|
-
|
35
|
-
inspect: (node) ->
|
36
|
-
if Ethereal.isDOM(node)
|
37
|
-
found = node.querySelectorAll("[#{Ethereal.attributeName}]")
|
38
|
-
Ethereal.God.create(el) for el in found
|
39
|
-
|
40
|
-
# !! **************************************** !! #
|
41
|
-
|
42
|
-
Ethereal.Watcher = ->
|
43
|
-
unless instance?
|
44
|
-
i = 0
|
45
|
-
target = null
|
46
|
-
target = if Ethereal.isDOM(arguments[i]) then arguments[i++] else document
|
47
|
-
instance = new Watcher(target, arguments[i])
|
48
|
-
|
49
|
-
instance
|
50
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
class XHR
|
2
|
-
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
|
3
|
-
constructor: (el) ->
|
4
|
-
@element(el)
|
5
|
-
@request = new XMLHttpRequest()
|
6
|
-
@request.addEventListener('load', @completed)
|
7
|
-
|
8
|
-
|
9
|
-
element: (el) ->
|
10
|
-
@element = ->
|
11
|
-
el
|
12
|
-
|
13
|
-
completed: (e) =>
|
14
|
-
if e.target.responseText.length > 1
|
15
|
-
eval(e.target.responseText)(@element())
|
16
|
-
|
17
|
-
send: (src, method = 'GET', data) =>
|
18
|
-
@request.open(method, src)
|
19
|
-
@request.setRequestHeader('accept', "*/*;q=0.5, #{@script}")
|
20
|
-
@request.setRequestHeader('X-Requested-With', "XMLHttpRequest")
|
21
|
-
|
22
|
-
@request.send(data)
|
23
|
-
|
24
|
-
@Form: (element) =>
|
25
|
-
xhr = new XHR(element)
|
26
|
-
data = new FormData(element)
|
27
|
-
param = document.querySelector('meta[name=csrf-param]').getAttribute('content')
|
28
|
-
token = document.querySelector('meta[name=csrf-token]').getAttribute('content')
|
29
|
-
data.append(param, token)
|
30
|
-
xhr.send(element.getAttribute('action'), element.getAttribute('method'), data)
|
31
|
-
xhr
|
32
|
-
|
33
|
-
|
34
|
-
Ethereal.XHR = XHR
|