Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make spacing consistent before colon character in edit_view #130

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+16 −13
Split
@@ -14,4 +14,4 @@
</form>
-<a href="#/index">Back</a>
+<a href="#/index">Back</a>
@@ -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)
@@ -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