@@ -319,7 +319,7 @@ class TwitterClone::Pages::Posts::Index < Matestack::Ui::Page
319319 {
320320 for: Post .new , path: posts_path, method: :post ,
321321 # optional: in order to map Bootstrap's CSS classes, you can adjust the form error rendering like so:
322- errors: { wrapper: { tag: :div , class : ' invalid-feedback' }, input: { class : ' is-invalid' } }
322+ errors: {wrapper: {tag: :div , class : ' invalid-feedback' }, input: {class : ' is-invalid' } }
323323 }
324324 end
325325
@@ -389,7 +389,7 @@ To get that reactivity to work, we need make use of the `async` component.
389389
390390## Add Matestack's Async Component
391391
392- * [x] Add ` success: { emit: "submitted" } ` to the form config
392+ * [x] Add ` success: {emit: "submitted"} ` to the form config
393393* [x] Wrap the ` post_list_partial ` with an ` async ` , configured to rerender when the event ` submitted ` is received
394394
395395` app/matestack/twitter_clone/pages/posts/index.rb `
@@ -400,11 +400,11 @@ To get that reactivity to work, we need make use of the `async` component.
400400def form_config_helper
401401 {
402402 for: Post .new , path: posts_path, method: :post ,
403- errors: {
404- wrapper: { tag: :div , class : ' invalid-feedback' },
405- input: { class : ' is-invalid' }
403+ errors: {
404+ wrapper: {tag: :div , class : ' invalid-feedback' },
405+ input: {class : ' is-invalid' }
406406 },
407- success: { emit: " submitted" }
407+ success: {emit: " submitted" }
408408 }
409409end
410410
@@ -501,7 +501,7 @@ def post_partial(post)
501501 small text: post.created_at.strftime(" %d.%m.%Y %H:%M" )
502502 end
503503 paragraph text: post.body, class : " mb-5"
504- action path: like_post_path(post), method: :put , success: { emit: " liked_post_#{ post.id } " } do
504+ action path: like_post_path(post), method: :put , success: {emit: " liked_post_#{ post.id } " } do
505505 button class : " btn btn-light" do
506506 plain " Like (#{ post.likes_count } )"
507507 end
@@ -523,7 +523,7 @@ Great! We added a reactive form and reactive actions. We can now add some reacti
523523
524524## Add Reactive Feedback Using the ` toggle ` Component
525525
526- * [x] Add failure event submission to the form config like: ` failure: { emit: "form_failed" }, `
526+ * [x] Add failure event submission to the form config like: ` failure: {emit: "form_failed"}, `
527527* [x] Add a ` toggle ` component in order to render the success message for 5 seconds
528528* [x] Add a ` toggle ` component in order to render the failure message for 5 seconds
529529
@@ -565,9 +565,9 @@ class TwitterClone::Pages::Posts::Index < Matestack::Ui::Page
565565 def form_config_helper
566566 {
567567 for: Post .new , path: posts_path, method: :post ,
568- success: { emit: " submitted" },
569- failure: { emit: " form_failed" },
570- errors: { wrapper: { tag: :div , class : ' invalid-feedback' }, input: { class : ' is-invalid' } }
568+ success: {emit: " submitted" },
569+ failure: {emit: " form_failed" },
570+ errors: {wrapper: {tag: :div , class : ' invalid-feedback' }, input: {class : ' is-invalid' } }
571571 }
572572 end
573573
690690def form_config_helper
691691 {
692692 for: Post .new , path: posts_path, method: :post ,
693- success: { emit: " submitted" },
694- failure: { emit: " form_failed" },
695- errors: { wrapper: { tag: :div , class : ' invalid-feedback' }, input: { class : ' is-invalid' } }
693+ success: {emit: " submitted" },
694+ failure: {emit: " form_failed" },
695+ errors: {wrapper: {tag: :div , class : ' invalid-feedback' }, input: {class : ' is-invalid' } }
696696 }
697697end
698698
@@ -730,7 +730,7 @@ def post_partial post
730730 small text: post.created_at.strftime(" %d.%m.%Y %H:%M" )
731731 end
732732 paragraph text: post.body, class : " mb-5"
733- # action path: like_post_path(post), method: :put, success: { emit: "liked_post_#{post.id}" } do
733+ # action path: like_post_path(post), method: :put, success: {emit: "liked_post_#{post.id}"} do
734734 action path: like_post_path(post), method: :put do
735735 button class : " btn btn-light" do
736736 plain " Like (#{ post.likes_count } )"
@@ -1386,9 +1386,9 @@ class TwitterClone::Pages::Profile::Edit < Matestack::Ui::Page
13861386 def form_config_helper
13871387 {
13881388 for: :profile , path: profile_update_path, method: :put ,
1389- success: { emit: " submitted" },
1390- failure: { emit: " form_failed" },
1391- errors: { wrapper: { tag: :div , class : ' invalid-feedback' }, input: { class : ' is-invalid' } }
1389+ success: {emit: " submitted" },
1390+ failure: {emit: " form_failed" },
1391+ errors: {wrapper: {tag: :div , class : ' invalid-feedback' }, input: {class : ' is-invalid' } }
13921392 }
13931393 end
13941394
@@ -1436,7 +1436,7 @@ class ProfileController < ApplicationController
14361436 if profile_params[:username ].blank?
14371437 render json: {
14381438 message: ' Profile could not be updated.' ,
1439- errors: { username: [" can't be blank!" ] }
1439+ errors: {username: [" can't be blank!" ]}
14401440 }, status: :unprocessable_entity
14411441 else
14421442 cookies[:username ] = profile_params[:username ]
@@ -1645,9 +1645,9 @@ class Components::Post < Matestack::Ui::Component
16451645 def form_config_helper
16461646 {
16471647 for: context.post, path: post_path(id: context.post.id), method: :put ,
1648- success: { emit: " updated" },
1649- failure: { emit: " form_failed" },
1650- errors: { wrapper: { tag: :div , class : ' invalid-feedback' }, input: { class : ' is-invalid' } }
1648+ success: {emit: " updated" },
1649+ failure: {emit: " form_failed" },
1650+ errors: {wrapper: {tag: :div , class : ' invalid-feedback' }, input: {class : ' is-invalid' } }
16511651 }
16521652 end
16531653
0 commit comments