rocky 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rocky/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rocky
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,46 @@
1
+ class Middleware.Component.JsonForm extends Middleware.System.Base
2
+ constructor: (@container) ->
3
+ super(@container)
4
+ @initForm()
5
+
6
+ initForm: =>
7
+ if @container.propName("tagName") == "FORM"
8
+ @form = @container
9
+ else
10
+ @form = @container.find("form")
11
+
12
+ @setCompletedStatusName()
13
+
14
+ @form.on "ajax:success", @createResponse
15
+ @form.on "request:completed", @completeForm
16
+ @form.on "request:failed", @updateForm
17
+ @form.on "request:cancel", @cancelForm
18
+
19
+ @submitButton = @form.find("*[data-action='submit']")
20
+ @submitButton.on "click", =>
21
+ @form.trigger("submit.rails")
22
+
23
+ @form.find("input").keypress (e) =>
24
+ if e.which == 13
25
+ @form.trigger("submit.rails")
26
+ e.preventDefault()
27
+
28
+ @cancelButoon = @form.find("*[data-action='cancel']")
29
+ @cancelButton.on "click", =>
30
+ @form.trigger("request:cancel")
31
+
32
+ setCompletedStatusName: (status_name = "completed") =>
33
+ @completedStatusName = status_name
34
+
35
+ createResponse: (event, json) =>
36
+ if json[@completedStatusName] == true
37
+ @form.trigger("request:completed", json)
38
+ else
39
+ @form.trigger("request:failed", json)
40
+
41
+ completeForm: (event, json) =>
42
+
43
+ updateForm: (event, json) =>
44
+
45
+ cancelForm: =>
46
+ @container.remove()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-24 00:00:00.000000000 Z
12
+ date: 2013-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coffee-script
@@ -66,17 +66,18 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
- - lib/rocky.rb
70
69
  - lib/generators/rocky/install/install_generator.rb
71
70
  - lib/generators/rocky/install/templates/app.coffee
72
71
  - lib/generators/rocky/resource_helpers.rb
73
72
  - lib/rocky/version.rb
74
- - vendor/assets/javascripts/middleware/system/base.js.coffee
73
+ - lib/rocky.rb
74
+ - vendor/assets/javascripts/backbone.js
75
+ - vendor/assets/javascripts/middleware/component/json_form.js.coffee
75
76
  - vendor/assets/javascripts/middleware/component/modal.js.coffee
76
77
  - vendor/assets/javascripts/middleware/component/puppet.js.coffee
77
- - vendor/assets/javascripts/underscore.js
78
- - vendor/assets/javascripts/backbone.js
78
+ - vendor/assets/javascripts/middleware/system/base.js.coffee
79
79
  - vendor/assets/javascripts/middleware.js.coffee
80
+ - vendor/assets/javascripts/underscore.js
80
81
  - Rakefile
81
82
  - README.md
82
83
  homepage: https://github.com/Semjonow/rocky