ember-appkit-rails 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/templates/application.hbs +4 -4
- data/lib/ember/appkit/rails.rb +1 -0
- data/lib/ember/appkit/rails/engine.rb +6 -3
- data/lib/ember/appkit/rails/sprockets/context.rb +1 -1
- data/lib/ember/appkit/rails/version.rb +1 -1
- data/lib/ember/appkit/rails/walker.rb +86 -57
- data/lib/generators/ember/bootstrap_generator.rb +14 -6
- data/lib/generators/ember/scaffold_controller_override.rb +3 -3
- data/lib/generators/ember/scaffold_override.rb +1 -1
- data/lib/generators/templates/adapter.js.erb +1 -1
- data/lib/generators/templates/application.js.erb +1 -1
- data/lib/generators/templates/environment.js.erb +19 -0
- data/lib/generators/templates/environments/development.js.erb +9 -0
- data/lib/generators/templates/environments/production.js.erb +14 -0
- data/{test/dummy/config/environments/development.js → lib/generators/templates/environments/test.js.erb} +2 -0
- data/lib/generators/templates/router.js.es6 +9 -1
- data/lib/generators/templates/scaffold/route/edit.js.es6 +2 -4
- data/lib/generators/templates/scaffold/route/new.js.es6 +1 -2
- data/lib/generators/templates/scaffold/route/show.js.es6 +1 -2
- data/lib/generators/templates/scaffold/template/form.hbs +2 -2
- data/lib/generators/templates/scaffold/template/show.hbs +1 -1
- data/lib/generators/templates/scaffold_controller/controller.rb +5 -4
- data/test/dummy/Gemfile +1 -1
- data/test/dummy/config/{adapter.js.erb → adapters/application.js.es6.erb} +1 -1
- data/test/dummy/config/application.js +1 -1
- data/test/dummy/config/environment.js.erb +19 -0
- data/test/dummy/config/environments/development.js.erb +9 -0
- data/test/dummy/config/environments/production.js.erb +14 -0
- data/{lib/generators/templates/environments/development.js → test/dummy/config/environments/test.js.erb} +2 -0
- data/test/dummy/config/initializers/secret_token.rb +1 -1
- data/test/dummy/config/router.js.es6 +9 -1
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/log/test.log +35 -7
- data/test/dummy/tmp/cache/assets/test/sprockets/10fe949cc641775f5630b5dad6deb5fc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/129b422236f443119233cdb0a4525a06 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1f15c49a05b13c3a7ee50d2ac3900f38 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/25b8b60341168a02f48dabd2b0aa82ad +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4a1d4e32cd7b9fd1c62bfd553ae56051 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/660bc633c8899c6c1b20514637fa0169 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/67afcba9807cd5e57b80b5fdf9f26758 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7ca4966e0a480430a858a7ab74518c75 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/827fafc13575b345cc572fd041ef1fba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/{07afa5d8ceda557642e2330ab45eb203 → 83030d43d9bff738a1a01366d61d7691} +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/83a9a7d15d681a382363d2bccb9528bb +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/83af35bb6b852de883a26a9458fd4e3a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/{ae884a1acda0e6f9bb27a856a22bb08d → 8adfb5e646dca2c629e5d3dc88e2c2e9} +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9160f792acb62d1f7721c714681fcfe6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a6a0d79927cb0ec286aa0afb9812685c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bb4a2293175928af3e23c47488077098 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bf689240392e7355c0de5cfd47272146 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cdbe9110f011148cc7a1f172dc18a883 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d5a48c6656341c56cac8a8e42bb925a5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de0932670a6c856bc6eda1586fd29061 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de94a60b438eb5bf57653f3a220acd80 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e9abb671d48f6ff2be6ffb463ea652bf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/eeb5bd38d1dad0d908461fd114f702bc +0 -0
- data/test/fixtures/routes_with_api_version_namespaces_and_route.rb +12 -0
- data/test/fixtures/walker.rb +76 -0
- data/test/generators/bootstrap_generator_test.rb +14 -6
- data/test/generators/resource_override_test.rb +0 -9
- data/test/generators/scaffold_override_test.rb +22 -9
- data/test/integration/engine_test.rb +34 -0
- data/test/support/generator_test_support.rb +11 -0
- data/vendor/assets/javascripts/app.js.es6.erb +1 -16
- data/vendor/assets/javascripts/ember-appkit/index.js +1 -0
- data/vendor/assets/javascripts/ember-appkit/resolver.js +12 -7
- data/vendor/assets/javascripts/ember-appkit/resolver_ext.js +40 -0
- metadata +55 -44
- data/lib/generators/templates/environment.js +0 -12
- data/lib/generators/templates/environments/production.js +0 -3
- data/lib/generators/templates/environments/test.js +0 -3
- data/test/dummy/config/environment.js +0 -12
- data/test/dummy/config/environments/production.js +0 -3
- data/test/dummy/config/environments/test.js +0 -3
- data/test/dummy/tmp/cache/assets/test/sprockets/e15ec26dd7914851e352c6f2c73c4284 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e3ddb4a07e99c5bbf5f9cd9db3cdb82a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fde9e78f8d55a70f4ef757638fc6cde0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fdfac6623944c5a23737724cbd90e58e +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87955b857b074b7c1732bfdf4083590744543d9b
|
4
|
+
data.tar.gz: 9e28182f503839a37b534dba4632ec4d84042c7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 586f71fdfb2e89ad5bead93d2e25ae464989d6a1583058c3f442abbfcd2f217b90eeba2276518f4bdf47ed8e49f3a88818b123563c0c7f13a7133530693a7590
|
7
|
+
data.tar.gz: a372fab61645c6a64aba60450edaa6a8b05ade49e4fe0d6d2cfcda2d9b9730145b3c7717fc9823b5ebc3f45e767f5b1e7a1ea521839f0caf85a417191ca527cd
|
@@ -550,16 +550,16 @@
|
|
550
550
|
Hello {{name}},
|
551
551
|
|
552
552
|
<ol>
|
553
|
-
<li>
|
554
|
-
<h2>Use <code>rails generate ember:scaffold</code> to get your application started.</h2>
|
555
|
-
</li>
|
556
|
-
|
557
553
|
<li>
|
558
554
|
<h2>Add your own application template to replace this page.</h2>
|
559
555
|
<p>You are seeing this page because you haven’t set an application template yet.</p>
|
560
556
|
<p>Add a new <code>app/templates/application.hbs</code> file.</p>
|
561
557
|
</li>
|
562
558
|
|
559
|
+
<li>
|
560
|
+
<h2>Use <code>rails generate ember:scaffold</code> to get your application started.</h2>
|
561
|
+
</li>
|
562
|
+
|
563
563
|
<li>
|
564
564
|
<h2>Your Rails controllers should be nested under <code>app/controllers/api/v1</code>.</h2>
|
565
565
|
</li>
|
data/lib/ember/appkit/rails.rb
CHANGED
@@ -8,8 +8,6 @@ class Ember::Appkit::Rails::Engine < ::Rails::Engine
|
|
8
8
|
config.ember.paths.config = 'config'
|
9
9
|
config.ember.namespaces.app = 'app'
|
10
10
|
config.ember.namespaces.config = 'config'
|
11
|
-
|
12
|
-
config.ember.enable_logging = ::Rails.env.development?
|
13
11
|
config.ember.api_version = 1
|
14
12
|
|
15
13
|
generators do |app|
|
@@ -62,9 +60,14 @@ class Ember::Appkit::Rails::Engine < ::Rails::Engine
|
|
62
60
|
initializer :appkit_sprockets do
|
63
61
|
assets = Sprockets::Railtie.config.assets
|
64
62
|
|
63
|
+
precompile_index = config.assets.precompile.index { |i| i =~ File.join(Rails.root, 'app/assets/javascripts/application.js') }
|
64
|
+
config.assets.precompile[precompile_index] = /(?<!assets\/javascripts)(?:\/|\\|\A)application\.(css|js)$/
|
65
|
+
|
65
66
|
assets_javascript = assets.paths.delete(::Rails.root.join('app','assets','javascripts').to_s)
|
67
|
+
assets.paths.delete(::Rails.root.join('lib', 'assets','javascript').to_s)
|
66
68
|
|
67
|
-
index_of_last_app_assets = assets.paths.rindex{|
|
69
|
+
index_of_last_app_assets = assets.paths.rindex { |path| path.to_s.start_with?(::Rails.root.join('app').to_s) } + 1
|
70
|
+
assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, 'lib'))
|
68
71
|
assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, config.ember.paths.app))
|
69
72
|
assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, config.ember.paths.config))
|
70
73
|
end
|
@@ -2,7 +2,7 @@ require 'sprockets/context'
|
|
2
2
|
|
3
3
|
module Ember::Appkit::Rails::Sprockets::Context
|
4
4
|
def asset_requirable?(path)
|
5
|
-
return false if path.to_s.match
|
5
|
+
return false if path.to_s.match(File.join(::Rails.root, 'app/assets/javascripts')) || path.to_s.match(File.join(::Rails.root, 'lib/assets/javascripts'))
|
6
6
|
super
|
7
7
|
end
|
8
8
|
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
require '
|
1
|
+
require 'parser/current'
|
2
|
+
|
3
|
+
class Walker < AST::Processor
|
4
|
+
attr_accessor :found_nodes, :namespace_type
|
2
5
|
|
3
|
-
class Walker
|
4
6
|
def initialize(resource, path, api_version)
|
5
7
|
@resource = resource
|
6
8
|
@file = File.open(path, 'r+')
|
7
|
-
content = @file.read
|
8
|
-
@ast =
|
9
|
-
@lines = content.split("\n")
|
9
|
+
@content = @file.read
|
10
|
+
@ast = Parser::CurrentRuby.parse(@content)
|
10
11
|
@api_version = api_version
|
12
|
+
@found_nodes = []
|
11
13
|
end
|
12
14
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
output = nil
|
17
|
-
line_number = @lines.index { |line| line =~ /routes\.draw do/ }
|
15
|
+
def handler_missing(node)
|
16
|
+
walk(node)
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
def on_block(node)
|
20
|
+
if is_namespace?(node)
|
21
|
+
if is_namespace_type?(node, :api)
|
22
|
+
found_nodes << node
|
23
|
+
self.namespace_type = :api
|
24
|
+
walk_namespace(node)
|
25
|
+
elsif is_namespace_type?(node, "v#{@api_version}".to_sym)
|
26
|
+
found_nodes << node
|
27
|
+
self.namespace_type = :version
|
28
|
+
walk_namespace(node)
|
26
29
|
end
|
27
|
-
line_number = @write_to.last - 1
|
28
30
|
else
|
29
|
-
|
30
|
-
write_version_namespace do
|
31
|
-
write_resource
|
32
|
-
end
|
33
|
-
end
|
31
|
+
walk(node)
|
34
32
|
end
|
33
|
+
end
|
35
34
|
|
36
|
-
|
37
|
-
@
|
38
|
-
|
39
|
-
|
35
|
+
def on_send(node)
|
36
|
+
if is_resource?(node, @resource.to_sym)
|
37
|
+
@found_resource = true
|
38
|
+
found_nodes << node
|
39
|
+
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def write_api_namespace
|
@@ -51,49 +51,78 @@ class Walker
|
|
51
51
|
" resources :#{@resource}, except: [:new, :edit]"
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
54
|
+
def invoke!
|
55
|
+
process(@ast)
|
56
|
+
if found_nodes.empty?
|
57
|
+
found_nodes << @ast
|
58
|
+
end
|
59
|
+
node = found_nodes.last
|
60
|
+
begin_pos = node.loc.begin.end_pos
|
57
61
|
|
58
|
-
|
59
|
-
|
62
|
+
output = ''
|
63
|
+
|
64
|
+
if namespace_type
|
65
|
+
if namespace_type == :version
|
66
|
+
output = write_resource
|
67
|
+
else
|
68
|
+
output = write_version_namespace do
|
69
|
+
write_resource
|
70
|
+
end
|
60
71
|
end
|
72
|
+
else
|
73
|
+
output = write_api_namespace do
|
74
|
+
write_version_namespace do
|
75
|
+
write_resource
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
@file.rewind
|
81
|
+
@file.write(@content.insert(begin_pos + 1, output + "\n"))
|
82
|
+
@file.close
|
83
|
+
end
|
61
84
|
|
62
|
-
|
63
|
-
|
64
|
-
|
85
|
+
def revoke!
|
86
|
+
@revoke = true
|
87
|
+
process(@ast)
|
88
|
+
return if found_nodes.empty? || @found_resource.nil?
|
89
|
+
if found_nodes.last.loc.expression
|
90
|
+
begin_pos = found_nodes.last.loc.expression.begin_pos
|
91
|
+
end_pos = found_nodes.last.loc.expression.end_pos
|
92
|
+
else
|
93
|
+
begin_pos = found_nodes.last.loc.begin.begin_pos
|
94
|
+
end_pos = found_nodes.last.loc.end.end_pos
|
65
95
|
end
|
96
|
+
begin_pos = begin_pos - @content[0..begin_pos].reverse.index("\n")
|
97
|
+
@file.rewind
|
98
|
+
@file.write @content.sub(@content[begin_pos...end_pos], '')
|
99
|
+
@file.close
|
66
100
|
end
|
67
101
|
|
68
|
-
|
69
|
-
find_namespace(ast, "v#{version}") do |ast|
|
70
|
-
@write_to = [:version, ast[1][1][2][0]]
|
102
|
+
private
|
71
103
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
104
|
+
def is_resource?(node, type)
|
105
|
+
node.children[1] == :resource && node.children[2].children.first == type.to_sym
|
106
|
+
end
|
76
107
|
|
77
|
-
|
108
|
+
def is_namespace?(node)
|
109
|
+
node.children.first.children[1] == :namespace
|
78
110
|
end
|
79
111
|
|
80
|
-
def
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
112
|
+
def is_namespace_type?(node, type)
|
113
|
+
node.children.first.children[2].children.first == type.to_sym
|
114
|
+
end
|
115
|
+
|
116
|
+
def walk_namespace(node)
|
117
|
+
process(node.children[2])
|
118
|
+
if @revoke && node.children[2] && node.children[2].children == found_nodes.last.to_a
|
119
|
+
found_nodes << node
|
88
120
|
end
|
89
121
|
end
|
90
122
|
|
91
|
-
def walk(
|
92
|
-
|
93
|
-
|
94
|
-
yield(ast, node)
|
95
|
-
walk(node, &block)
|
96
|
-
end
|
123
|
+
def walk(node)
|
124
|
+
node.children.each do |child|
|
125
|
+
process(child) if child.respond_to?(:to_ast)
|
97
126
|
end
|
98
127
|
end
|
99
128
|
end
|
@@ -29,14 +29,14 @@ module Ember
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def create_ember_adapter_file
|
32
|
-
template "adapter.js.erb", "#{config_path}/
|
32
|
+
template "adapter.js.erb", "#{config_path}/adapters/application.js.es6.erb"
|
33
33
|
end
|
34
34
|
|
35
35
|
def create_ember_environment_files
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
copy_file "environment.js.erb", "#{config_path}/environment.js.erb"
|
37
|
+
copy_file "environments/development.js.erb", "#{config_path}/environments/development.js.erb"
|
38
|
+
copy_file "environments/production.js.erb", "#{config_path}/environments/production.js.erb"
|
39
|
+
copy_file "environments/test.js.erb", "#{config_path}/environments/test.js.erb"
|
40
40
|
end
|
41
41
|
|
42
42
|
def create_utils_csrf_file
|
@@ -52,6 +52,14 @@ module Ember
|
|
52
52
|
remove_jbuilder_from_gemfile
|
53
53
|
end
|
54
54
|
|
55
|
+
def add_greedy_rails_route
|
56
|
+
insert_into_file 'config/routes.rb', before: /^end$/ do
|
57
|
+
"\n" +
|
58
|
+
" # Uncomment when using 'history' as the location in Ember's router\n" +
|
59
|
+
" # get '*foo', :to => 'landing#index'\n"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
def add_custom_paths
|
56
64
|
if app_path != configuration.paths.app
|
57
65
|
insert_into_file 'config/application.rb', before: /\s\send\nend/ do
|
@@ -79,7 +87,7 @@ module Ember
|
|
79
87
|
path = Pathname.new(destination_root).join('Gemfile')
|
80
88
|
return unless path.exist?
|
81
89
|
|
82
|
-
gsub_file path, /(?:#.+$\n)?gem '#{gem}.*'
|
90
|
+
gsub_file path, /(?:#.+$\n)?gem ['|"]#{gem}.*['|"].*\n\n?/, ''
|
83
91
|
end
|
84
92
|
|
85
93
|
def remove_turbolinks_from_gemfile
|
@@ -6,9 +6,9 @@ module Rails
|
|
6
6
|
class ScaffoldControllerGenerator
|
7
7
|
source_root File.expand_path('../../templates/scaffold_controller', __FILE__)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
def create_controller_files
|
10
|
+
template "controller.rb", File.join("app/controllers/api/v#{::Rails.application.config.ember.api_version}", class_path, "#{controller_file_name}_controller.rb")
|
11
|
+
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -18,7 +18,7 @@ module Rails
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def write_resource
|
21
|
-
Walker.new(file_path.pluralize, File.join(destination_root, 'config/routes.rb'), ::Rails.application.config.ember.api_version)
|
21
|
+
action Walker.new(file_path.pluralize, File.join(destination_root, 'config/routes.rb'), ::Rails.application.config.ember.api_version)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//= require_self
|
2
|
+
//= require_environment_from ./environments
|
3
|
+
/*
|
4
|
+
This is useful when using canary versions of Ember to enable
|
5
|
+
feature flags before Ember itself is loaded.
|
6
|
+
|
7
|
+
See the feature flags guide for details:
|
8
|
+
|
9
|
+
http://emberjs.com/guides/configuring-ember/feature-flags/
|
10
|
+
*/
|
11
|
+
|
12
|
+
window.config = {};
|
13
|
+
|
14
|
+
<% config = Rails.application.config.ember %>
|
15
|
+
|
16
|
+
config.modulePrefix = '<%= config.namespaces.app %>';
|
17
|
+
config.routerPrefix = '<%= config.namespaces.config %>';
|
18
|
+
config.adapterPrefix = '<%= config.namespaces.config %>';
|
19
|
+
config.serializerPrefix = '<%= config.namespaces.config %>';
|
@@ -0,0 +1,14 @@
|
|
1
|
+
//= require handlebars.runtime
|
2
|
+
//= require ember.prod
|
3
|
+
//= require ember-data.prod
|
4
|
+
|
5
|
+
// For some configuration settings such as API keys,
|
6
|
+
// you should read them from the environment rather
|
7
|
+
// than checking them into version control. See also
|
8
|
+
// the Figaro gem.
|
9
|
+
// Keep in mind that API keys in js are visible to
|
10
|
+
// someone poking in the browser, so never expose
|
11
|
+
// a truly private API key in javascript.
|
12
|
+
// my_api_key = <%= ENV['MY_API_KEY'] %>
|
13
|
+
|
14
|
+
Ember.LOG_VERSION = false
|
@@ -1,4 +1,12 @@
|
|
1
|
-
var Router = Ember.Router.extend(
|
1
|
+
var Router = Ember.Router.extend({
|
2
|
+
// Uncomment to change Ember's router to use the
|
3
|
+
// HTML5 History API
|
4
|
+
// Please note that not all browsers support this!
|
5
|
+
// You will also need to uncomment the greedy route matcher
|
6
|
+
// in config/routes.rb
|
7
|
+
|
8
|
+
// location: 'history'
|
9
|
+
});
|
2
10
|
|
3
11
|
Router.map(function() {
|
4
12
|
});
|
@@ -7,15 +7,13 @@ export default Ember.Route.extend({
|
|
7
7
|
model.rollback();
|
8
8
|
},
|
9
9
|
actions: {
|
10
|
-
save: function() {
|
11
|
-
var model = this.get('controller.model');
|
10
|
+
save: function(model) {
|
12
11
|
var _this = this;
|
13
12
|
model.save().then(function() {
|
14
13
|
_this.transitionTo('<%= file_name.pluralize -%>.show', model);
|
15
14
|
});
|
16
15
|
},
|
17
|
-
cancel: function() {
|
18
|
-
var model = this.get('controller.model');
|
16
|
+
cancel: function(model) {
|
19
17
|
this.transitionTo('<%= file_name.pluralize -%>.show', model);
|
20
18
|
}
|
21
19
|
}
|
@@ -9,8 +9,7 @@ export default Ember.Route.extend({
|
|
9
9
|
}
|
10
10
|
},
|
11
11
|
actions: {
|
12
|
-
save: function() {
|
13
|
-
var model = this.get('controller.model');
|
12
|
+
save: function(model) {
|
14
13
|
var _this = this;
|
15
14
|
model.save().then(function() {
|
16
15
|
_this.transitionTo('<%= file_name.pluralize -%>.show', model);
|
@@ -3,8 +3,7 @@ export default Ember.Route.extend({
|
|
3
3
|
return this.store.find('<%= file_name.singularize -%>', params.<%= file_name.singularize -%>_id);
|
4
4
|
},
|
5
5
|
actions: {
|
6
|
-
destroyRecord: function() {
|
7
|
-
var model = this.get('controller.model');
|
6
|
+
destroyRecord: function(model) {
|
8
7
|
var _this = this;
|
9
8
|
model.destroyRecord().then(function() {
|
10
9
|
_this.transitionTo('<%= file_name.pluralize -%>.index');
|