spine-rails 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,8 +50,9 @@
50
50
  };
51
51
  List.prototype.click = function(e) {
52
52
  var item;
53
- item = $(e.target).item();
54
- return this.trigger('change', item);
53
+ item = $(e.currentTarget).item();
54
+ this.trigger('change', item);
55
+ return false;
55
56
  };
56
57
  return List;
57
58
  })();
@@ -28,7 +28,7 @@
28
28
  };
29
29
  Route.add = function(path, callback) {
30
30
  var key, value, _results;
31
- if (typeof path === "object") {
31
+ if (typeof path === "object" && !(path instanceof RegExp)) {
32
32
  _results = [];
33
33
  for (key in path) {
34
34
  value = path[key];
@@ -40,7 +40,7 @@
40
40
  };
41
41
  Tabs.prototype.click = function(e) {
42
42
  var name;
43
- name = $(e.target).attr('data-name');
43
+ name = $(e.currentTarget).attr('data-name');
44
44
  return this.trigger('change', name);
45
45
  };
46
46
  Tabs.prototype.connect = function(tabName, controller) {
@@ -27,6 +27,10 @@ module Spine
27
27
  def create_app_file
28
28
  template "index.coffee.erb", "app/assets/javascripts/#{app_name}/index.js.coffee"
29
29
  end
30
+
31
+ def create_lib_file
32
+ template "view.coffee.erb", "app/assets/javascripts/#{app_name}/lib/view.js.coffee"
33
+ end
30
34
 
31
35
  def add_spine_app_to_application
32
36
  source = "app/assets/javascripts/application.js"
@@ -12,9 +12,6 @@
12
12
  #= require_tree ./views
13
13
 
14
14
  class <%= app_class %> extends Spine.Controller
15
- @view: (name) ->
16
- JST["<%= app_name %>/views/#{name}"]
17
-
18
15
  constructor: ->
19
16
  super
20
17
 
@@ -0,0 +1,3 @@
1
+ Spine.Controller.include
2
+ view: (name) ->
3
+ JST["<%= app_name %>/views/#{name}"]
@@ -8,6 +8,7 @@ $.fn.item = ->
8
8
 
9
9
  class New extends Spine.Controller
10
10
  events:
11
+ 'click [data-type=back]': 'back'
11
12
  'submit form': 'submit'
12
13
 
13
14
  constructor: ->
@@ -15,8 +16,11 @@ class New extends Spine.Controller
15
16
  @active @render
16
17
 
17
18
  render: ->
18
- @html App.view('<%= controller_name %>/new')
19
-
19
+ @html @view('<%= controller_name %>/new')
20
+
21
+ back: ->
22
+ @navigate '/<%= controller_name %>'
23
+
20
24
  submit: (e) ->
21
25
  e.preventDefault()
22
26
  <%= model_name %> = <%= model_class %>.fromForm(e.target).save()
@@ -24,6 +28,7 @@ class New extends Spine.Controller
24
28
 
25
29
  class Edit extends Spine.Controller
26
30
  events:
31
+ 'click [data-type=back]': 'back'
27
32
  'submit form': 'submit'
28
33
 
29
34
  constructor: ->
@@ -36,8 +41,11 @@ class Edit extends Spine.Controller
36
41
  @render()
37
42
 
38
43
  render: ->
39
- @html App.view('<%= controller_name %>/edit')(@item)
40
-
44
+ @html @view('<%= controller_name %>/edit')(@item)
45
+
46
+ back: ->
47
+ @navigate '/<%= controller_name %>'
48
+
41
49
  submit: (e) ->
42
50
  e.preventDefault()
43
51
  @item.fromForm(e.target).save()
@@ -45,6 +53,7 @@ class Edit extends Spine.Controller
45
53
 
46
54
  class Show extends Spine.Controller
47
55
  events:
56
+ 'click [bata-type=edit]': 'edit'
48
57
  'click [data-type=back]': 'back'
49
58
 
50
59
  constructor: ->
@@ -57,7 +66,10 @@ class Show extends Spine.Controller
57
66
  @render()
58
67
 
59
68
  render: ->
60
- @html App.view('<%= controller_name %>/show')(@item)
69
+ @html @view('<%= controller_name %>/show')(@item)
70
+
71
+ edit: ->
72
+ @navigate '/<%= controller_name %>', @item.id, 'edit'
61
73
 
62
74
  back: ->
63
75
  @navigate '/<%= controller_name %>'
@@ -76,7 +88,7 @@ class Index extends Spine.Controller
76
88
 
77
89
  render: =>
78
90
  <%= controller_name %> = <%= model_class %>.all()
79
- @html App.view('<%= controller_name %>/index')(<%= controller_name %>: <%= controller_name %>)
91
+ @html @view('<%= controller_name %>/index')(<%= controller_name %>: <%= controller_name %>)
80
92
 
81
93
  edit: (e) ->
82
94
  item = $(e.target).item()
@@ -1,5 +1,7 @@
1
1
  <h1>Edit <%= model_class %></h1>
2
2
 
3
+ <a data-type="back">Back</a>
4
+
3
5
  <form>
4
6
  <% fields.each do |field| %>
5
7
  <label>
@@ -8,6 +10,7 @@
8
10
  type="text" name="<%= field %>"
9
11
  value="<%%= @<%= field %> %>" required
10
12
  <%- if field == fields[0] %> autofocus<% end %>>
13
+ <br />
11
14
  </label>
12
15
  <% end %>
13
16
  <button>Edit</button>
@@ -1,5 +1,7 @@
1
1
  <h1>New <%= model_class %></h1>
2
2
 
3
+ <a data-type="back">Back</a>
4
+
3
5
  <form>
4
6
  <% fields.each do |field| %>
5
7
  <label>
@@ -8,6 +10,7 @@
8
10
  type="text" name="<%= field %>"
9
11
  value="<%%= @<%= field %> %>" required
10
12
  <%- if field == fields[0] %> autofocus<% end %>>
13
+ <br />
11
14
  </label>
12
15
  <% end %>
13
16
  <button>Create</button>
@@ -1,6 +1,6 @@
1
1
  <h1>Show <%= model_class %></h1>
2
2
 
3
- <a data-type="back">Back</a>
3
+ <a data-type="edit">Edit</a> <a data-type="back">Back</a>
4
4
 
5
5
  <%- fields.each do |field| -%>
6
6
  <p><%= field.titleize %>: <%%= @<%= field %> %></p>
@@ -1,6 +1,6 @@
1
1
  module Spine
2
2
  module Rails
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  SPINE_VERSION = "1.0.3"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,45 +1,63 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: spine-rails
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.8
3
+ version: !ruby/object:Gem::Version
4
+ hash: 13
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 9
10
+ version: 0.0.9
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Alex MacCaw
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-10-23 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2011-11-15 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: rails
16
- requirement: &70224443989420 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
17
25
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 3
32
+ - 1
33
+ - 0
21
34
  version: 3.1.0
22
35
  type: :runtime
23
- prerelease: false
24
- version_requirements: *70224443989420
25
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
26
38
  name: bundler
27
- requirement: &70224443988460 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
28
41
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
33
49
  type: :development
34
- prerelease: false
35
- version_requirements: *70224443988460
50
+ version_requirements: *id002
36
51
  description: This gem provides Spine for your Rails 3 application.
37
- email:
52
+ email:
38
53
  - info@eribium.org
39
54
  executables: []
55
+
40
56
  extensions: []
57
+
41
58
  extra_rdoc_files: []
42
- files:
59
+
60
+ files:
43
61
  - .gitignore
44
62
  - Gemfile
45
63
  - Gemfile.lock
@@ -61,6 +79,7 @@ files:
61
79
  - lib/generators/spine/model/templates/model.coffee.erb
62
80
  - lib/generators/spine/new/new_generator.rb
63
81
  - lib/generators/spine/new/templates/index.coffee.erb
82
+ - lib/generators/spine/new/templates/view.coffee.erb
64
83
  - lib/generators/spine/scaffold/scaffold_generator.rb
65
84
  - lib/generators/spine/scaffold/templates/controller.coffee.erb
66
85
  - lib/generators/spine/scaffold/templates/edit.jst.erb
@@ -77,29 +96,41 @@ files:
77
96
  - lib/spine/rails/engine.rb
78
97
  - lib/spine/rails/version.rb
79
98
  - spine-rails.gemspec
99
+ has_rdoc: true
80
100
  homepage: http://rubygems.org/gems/spine-rails
81
101
  licenses: []
102
+
82
103
  post_install_message:
83
104
  rdoc_options: []
84
- require_paths:
105
+
106
+ require_paths:
85
107
  - lib
86
- required_ruby_version: !ruby/object:Gem::Requirement
108
+ required_ruby_version: !ruby/object:Gem::Requirement
87
109
  none: false
88
- requirements:
89
- - - ! '>='
90
- - !ruby/object:Gem::Version
91
- version: '0'
92
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
118
  none: false
94
- requirements:
95
- - - ! '>='
96
- - !ruby/object:Gem::Version
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 23
123
+ segments:
124
+ - 1
125
+ - 3
126
+ - 6
97
127
  version: 1.3.6
98
128
  requirements: []
129
+
99
130
  rubyforge_project: spine-rails
100
- rubygems_version: 1.8.6
131
+ rubygems_version: 1.6.2
101
132
  signing_key:
102
133
  specification_version: 3
103
134
  summary: Use Spine with Rails 3
104
135
  test_files: []
105
- has_rdoc:
136
+