rocky 0.1.2.pre → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,12 +12,10 @@ class Middleware.Component.JsonForm extends Middleware.System.Base
12
12
  if @form.length == 0
13
13
  return false
14
14
 
15
- @setCompletedStatusName()
16
-
17
- @form.on "ajax:success", @createResponse
18
- @form.on "request:completed", @completeForm
19
- @form.on "request:failed", @updateForm
20
- @form.on "request:cancel", @cancelForm
15
+ @form.on "ajax:success", @createResponse
16
+ @form.on "response:success", @completeForm
17
+ @form.on "response:error", @updateForm
18
+ @form.on "response:cancel", @cancelForm
21
19
 
22
20
  @submitButton = @form.find("*[data-action='submit']")
23
21
  @submitButton.on "click", =>
@@ -30,16 +28,13 @@ class Middleware.Component.JsonForm extends Middleware.System.Base
30
28
 
31
29
  @cancelButton = @form.find("*[data-action='cancel']")
32
30
  @cancelButton.on "click", =>
33
- @form.trigger("request:cancel")
34
-
35
- setCompletedStatusName: (status_name = "completed") =>
36
- @completedStatusName = status_name
31
+ @form.trigger("response:cancel")
37
32
 
38
33
  createResponse: (event, json) =>
39
- if json[@completedStatusName] == true
40
- @form.trigger("request:completed", json)
34
+ if json[Middleware.Env.getSuccessStatus()] == true
35
+ @form.trigger("response:success", json)
41
36
  else
42
- @form.trigger("request:failed", json)
37
+ @form.trigger("response:error", json)
43
38
 
44
39
  completeForm: (event, json) =>
45
40
 
@@ -0,0 +1,9 @@
1
+ class Middleware.System.Env
2
+ constructor: ->
3
+ @successStatus = "success"
4
+
5
+ setSuccessStatus: (name) =>
6
+ @successStatus = name
7
+
8
+ getSuccessStatus: =>
9
+ @successStatus
@@ -3,6 +3,9 @@
3
3
  #= require_tree ./middleware/component
4
4
 
5
5
  window.Middleware = {
6
+ Env: {}
6
7
  System: {}
7
8
  Component: {}
8
- }
9
+ }
10
+
11
+ window.Middleware.Env = new Middleware.System.Env
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.pre
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juri Semjonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-15 00:00:00.000000000 Z
11
+ date: 2013-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -78,8 +78,8 @@ files:
78
78
  - lib/generators/rocky/install/templates/app.coffee
79
79
  - lib/generators/rocky/resource_helpers.rb
80
80
  - lib/rocky/version.rb
81
+ - vendor/assets/javascripts/middleware/system/env.js.coffee
81
82
  - vendor/assets/javascripts/middleware/system/base.js.coffee
82
- - vendor/assets/javascripts/middleware/component/modal.js.coffee
83
83
  - vendor/assets/javascripts/middleware/component/puppet.js.coffee
84
84
  - vendor/assets/javascripts/middleware/component/json_form.js.coffee
85
85
  - vendor/assets/javascripts/underscore.js
@@ -102,9 +102,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - '>'
105
+ - - '>='
106
106
  - !ruby/object:Gem::Version
107
- version: 1.3.1
107
+ version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
110
  rubygems_version: 2.0.2
@@ -1,10 +0,0 @@
1
- class Middleware.Component.Modal extends Middleware.System.Base
2
- @create: (selector) ->
3
- $("body").append("<div class='modal' data-block='#{selector}'></div>")
4
- Middleware.Component.Modal.bindOne("*[data-block='#{selector}']")
5
-
6
- constructor: (@container) ->
7
- super(@container)
8
-
9
- fill: (content) =>
10
- @container.append(content)