Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make spacing consistent before colon character in edit_view

  • Loading branch information...
commit decfe3a1b8acb97abc5ed21ffb2ec4512c8b7ebd 1 parent a4f89d7
@mkelley33 mkelley33 authored
View
2  lib/generators/backbone/scaffold/templates/templates/edit.jst
@@ -14,4 +14,4 @@
</form>
-<a href="#/index">Back</a>
+<a href="#/index">Back</a>
View
12 lib/generators/backbone/scaffold/templates/views/edit_view.coffee
@@ -1,22 +1,22 @@
<%= view_namespace %> ||= {}
class <%= view_namespace %>.EditView extends Backbone.View
- template : JST["<%= jst 'edit' %>"]
+ template: JST["<%= jst 'edit' %>"]
- events :
- "submit #edit-<%= singular_name %>" : "update"
+ events:
+ "submit #edit-<%= singular_name %>": "update"
- update : (e) ->
+ update: (e) ->
e.preventDefault()
e.stopPropagation()
@model.save(null,
- success : (<%= singular_name %>) =>
+ success: (<%= singular_name %>) =>
@model = <%= singular_name %>
window.location.hash = "/#{@model.id}"
)
- render : ->
+ render: ->
$(@el).html(@template(@model.toJSON() ))
this.$("form").backboneLink(@model)
View
15 test/generators/scaffold_generator_test.rb
@@ -62,8 +62,8 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_file "#{backbone_path}/views/posts/edit_view.js.coffee" do |view|
assert_match /class Dummy.Views.Posts.EditView extends Backbone.View/, view
assert_match /#{Regexp.escape('JST["backbone/templates/posts/edit"]')}/, view
- assert_match /#{Regexp.escape('"submit #edit-post" : "update"')}/, view
- assert_match /#{Regexp.escape('success : (post) =>')}/, view
+ assert_match /#{Regexp.escape('"submit #edit-post": "update"')}/, view
+ assert_match /#{Regexp.escape('success: (post) =>')}/, view
end
assert_file "#{backbone_path}/views/posts/post_view.js.coffee" do |view|
@@ -99,9 +99,12 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_file "#{backbone_path}/views/blog_posts/edit_view.js.coffee" do |view|
assert_match /class Dummy.Views.BlogPosts.EditView extends Backbone.View/, view
- assert_match /#{Regexp.escape('JST["backbone/templates/blog_posts/edit"]')}/, view
- assert_match /#{Regexp.escape('"submit #edit-blog_post" : "update"')}/, view
- assert_match /#{Regexp.escape('success : (blog_post) =>')}/, view
+ assert_match /#{Regexp.escape('template: JST["backbone/templates/blog_posts/edit"]')}/, view
+ assert_match /#{Regexp.escape('"submit #edit-blog_post": "update"')}/, view
+ assert_match /#{Regexp.escape('success: (blog_post) =>')}/, view
+ assert_match /#{Regexp.escape('events:')}/, view
+ assert_match /#{Regexp.escape('update: (e) ->')}/, view
+ assert_match /#{Regexp.escape('render: ->')}/, view
end
assert_file "#{backbone_path}/views/blog_posts/blog_post_view.js.coffee" do |view|
@@ -173,4 +176,4 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.