ruby on rails - joosy forms don't work -
i follow guide http://guides.joosy.ws/guides/blog/forms.html , try create forms new , edit post
so create templates/pages/posts/_form.jst.hamlc form , add code in pages/posts/new.js.coffee:
joosy.namespace 'posts', -> class @newpage extends applicationpage @layout applicationlayout @view 'new' elements: 'rawform': 'form' @fetch (complete) -> @data.post = post.build() complete() @afterload -> @form = joosy.form.attach @rawform, resource: @data.post success: (data) => @navigate '/' but "inner magic" doesn't work me.. when follow http://localhost:3000/blog#!/posts/new see form new post. form submits usual form. i.e. if type , press save, opens new page http://localhost:3000/blog?post%5btitle%5d=test&post%5bbody%5d=test#!/posts
so, i've stopped on step , have no ideas that..
p.s. if can retag question 'joosy' please it. author promises answer questions joosy framework here 'joosy' tag, can't create tag due lack of reputation
you should check 3 things:
- check console overall errors. may fail before afterload. , javascript dies silently unless watch errors.
- try add console.log @rawform in afterload ensure correct dom element binded.
- try compare code working example: https://github.com/roundlake/joosy-example
and if 1/2 didn't work , don't have time, show me template either cause pages looks copy of one: https://github.com/roundlake/joosy-example/blob/master/app/assets/javascripts/blog/pages/posts/new.js.coffee. latter known work. trouble not here.
Comments
Post a Comment