added coffee folder (dirty)

This commit is contained in:
Rushabh Mehta 2011-07-27 13:37:37 +05:30
parent 541c42b4fa
commit 6d9a5e3d9d
2 changed files with 34 additions and 0 deletions

3
js/wn-coffee/app.coffee Normal file
View file

@ -0,0 +1,3 @@
# Entry level app
wn.app = {}

View file

@ -0,0 +1,31 @@
class wn.widgets.Form
constructor: (@modeltype) ->
@view = wn.app.models['DocType'][modeltype].__view
@sections = []
render: (@parent) ->
# wrapper
@wrapper = $a @parent 'div' 'form_wrapper'
# render sections
for s in @view.sections
@sections.push new wn.widgets.FormSection @wrapper, section
class wn.widgets.FormSection
constructor: (@parent, @section) ->
@columns = []
@fields = []
@render()
render: ->
@wrapper = $a @parent 'div'
for f in section.fields
@render_field f, section
render_section: (section) ->
# render fields
render_field: (field, section) ->
# call the field factory
make_field field,