luca 0.8.06 → 0.8.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/CHANGELOG +32 -1
  2. data/Guardfile +14 -9
  3. data/app.rb +1 -0
  4. data/assets/javascripts/sandbox/config.coffee +1 -1
  5. data/assets/javascripts/sandbox/views/pages/pages_controller.coffee +6 -0
  6. data/lib/luca/rails/version.rb +1 -1
  7. data/spec/framework_spec.coffee +33 -1
  8. data/src/components/application.coffee +1 -3
  9. data/src/components/base_toolbar.coffee +5 -6
  10. data/src/components/collection_inspector.coffee +2 -0
  11. data/src/components/collection_loader_view.coffee +7 -6
  12. data/src/components/controller.coffee +3 -1
  13. data/src/components/development_console.coffee +7 -4
  14. data/src/components/fields/button_field.coffee +2 -5
  15. data/src/components/fields/checkbox_array.coffee +64 -0
  16. data/src/components/fields/checkbox_field.coffee +7 -10
  17. data/src/components/fields/file_upload_field.coffee +3 -6
  18. data/src/components/fields/hidden_field.coffee +4 -10
  19. data/src/components/fields/select_field.coffee +15 -18
  20. data/src/components/fields/text_area_field.coffee +5 -8
  21. data/src/components/fields/text_field.coffee +7 -14
  22. data/src/components/fields/type_ahead_field.coffee +4 -6
  23. data/src/components/form_button_toolbar.coffee +4 -4
  24. data/src/components/form_view.coffee +24 -10
  25. data/src/components/grid_view.coffee +80 -42
  26. data/src/components/record_manager.coffee +21 -22
  27. data/src/components/template.coffee +6 -8
  28. data/src/containers/card_view.coffee +2 -4
  29. data/src/containers/column_view.coffee +10 -12
  30. data/src/containers/modal_view.coffee +7 -9
  31. data/src/containers/panel_view.coffee +4 -4
  32. data/src/containers/split_view.coffee +3 -5
  33. data/src/containers/tab_view.coffee +3 -2
  34. data/src/containers/viewport.coffee +2 -3
  35. data/src/core/container.coffee +4 -4
  36. data/src/core/field.coffee +14 -13
  37. data/src/core/model.coffee +1 -1
  38. data/src/core/view.coffee +12 -3
  39. data/src/framework.coffee +134 -17
  40. data/src/managers/collection_manager.coffee +1 -1
  41. data/src/stylesheets/components/development_console.scss +5 -0
  42. data/src/templates/fields/checkbox_array.luca +5 -0
  43. data/src/templates/fields/checkbox_array_item.luca +4 -0
  44. data/vendor/assets/javascripts/luca-ui-base.js +155 -43
  45. data/vendor/assets/javascripts/luca-ui-spec.js +385 -133
  46. data/vendor/assets/javascripts/luca-ui.js +344 -132
  47. data/vendor/assets/javascripts/luca-ui.min.js +3 -3
  48. data/vendor/assets/stylesheets/luca-ui-bootstrap.css +4 -1
  49. data/vendor/assets/stylesheets/luca-ui-spec.css +4 -1
  50. data/vendor/assets/stylesheets/luca-ui.css +4 -1
  51. metadata +6 -2
data/CHANGELOG CHANGED
@@ -1,3 +1,34 @@
1
1
  0.7.3:
2
2
  - Models being loaded by the FormView will now call
3
- beforeFormLoad methods if they exist on those models
3
+ beforeFormLoad methods if they exist on those models
4
+
5
+ 0.8.1
6
+ - Adds many style fixes for GridView
7
+ - Fixes style conflicts for Bootstrap grid-* css selectors
8
+ - Adds getForm() and getModel() methods to Luca.Field classes that belong to a form
9
+
10
+ 0.8.2
11
+ - Adds checkbox group field component ( thanks nick desteffen )
12
+
13
+ 0.8.3
14
+ - Stop mixing in underscore.string onto the global underscore object
15
+ - the ctype property used to create objects from hashes, can now be named 'type'
16
+ - Adds Luca.util.classify function for converting strings into class names
17
+
18
+ 0.8.4
19
+ - Fixes bug in development console
20
+ - Colorizes Development Console
21
+ - Introduces Luca.template helper to find template by regex in Luca.templates
22
+ or window.JST. Optionally compiling the template if you pass variables to it.
23
+ - Introduces Luca.View.applyStyles which delegates to @$el.css
24
+
25
+ 0.8.5
26
+ - Luca.define() can be used to extend components, and retain references
27
+ to the inheritance chain. Components defined this way will have
28
+ _className attributes as well as _superClass() references. This
29
+ allows for introspection of components as well as advanced
30
+ querying of the Luca Component Cache
31
+
32
+ _ Added _.component as an alias to Luca.define
33
+
34
+ - All Luca components have been migrated over to the new Luca.define() API
data/Guardfile CHANGED
@@ -5,18 +5,23 @@ javascript_path = File.join( assets_path, 'javascripts' )
5
5
  stylesheets_path = File.join( assets_path, 'stylesheets' )
6
6
 
7
7
  unless ENV['TEST_MODE']
8
- guard 'sprockets2', :clean=>false, :assets_path => javascript_path, :sprockets => App.sprockets, :precompile=>[/^luca-ui.+(coffee|js)$/], :digest => false, :gz => false do
9
- watch(%r{^src/.+$})
10
- watch(%r{^spec/.+$})
8
+ unless ENV['SKIP_JAVASCRIPTS']
9
+ guard 'sprockets2', :clean=>false, :assets_path => javascript_path, :sprockets => App.sprockets, :precompile=>[/^luca-ui.+(coffee|js)$/], :digest => false, :gz => false do
10
+ watch(%r{^src/.+$})
11
+ watch(%r{^spec/.+$})
12
+ end
11
13
  end
12
14
 
13
- guard 'sprockets2', :clean=>false, :assets_path => stylesheets_path, :sprockets => App.sprockets, :precompile=>[/^luca-ui.+(scss|css)$/], :digest => false, :gz => false do
14
- watch(%r{^src/stylesheets/.+$})
15
+ unless ENV['SKIP_STYLESHEETS']
16
+ guard 'sprockets2', :clean=>false, :assets_path => stylesheets_path, :sprockets => App.sprockets, :precompile=>[/^luca-ui.+(scss|css)$/], :digest => false, :gz => false do
17
+ watch(%r{^src/stylesheets/.+$})
18
+ end
15
19
  end
16
20
  end
17
21
 
18
- # TODO: Couldn't detect phantomjs
19
- guard 'jasmine' do
20
- watch(%r{src/(.+)\.coffee}) {|m| "spec/#{ m[1] }_spec.coffee" }
21
- watch(%r{spec/(.+)_spec\.coffee})
22
+ unless ENV['COMPILE_MODE']
23
+ guard 'jasmine' do
24
+ watch(%r{src/(.+)\.coffee}) {|m| "spec/#{ m[1] }_spec.coffee" }
25
+ watch(%r{spec/(.+)_spec\.coffee})
26
+ end
22
27
  end
data/app.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #
1
2
  require 'rubygems'
2
3
  require 'bundler'
3
4
  Bundler.require
@@ -1,4 +1,4 @@
1
- (window || global).Sandbox =
1
+ window.Sandbox =
2
2
  views: {}
3
3
  collections: {}
4
4
  models: {}
@@ -1,4 +1,6 @@
1
1
  Sandbox.views.PagesController = Luca.components.Controller.extend
2
+ # the main component is the tab view which
3
+ # has its own individual demos
2
4
  components:[
3
5
  ctype: 'tab_view'
4
6
  name: 'pages_tab_view'
@@ -27,6 +29,10 @@ Sandbox.views.PagesController = Luca.components.Controller.extend
27
29
  ctype: 'development_console'
28
30
  name: 'development_console'
29
31
  title: "Development Console"
32
+ ,
33
+ ctype: "collection_inspector"
34
+ name: "collection_inspector"
35
+ title: "Collection Inspector"
30
36
  ]
31
37
  ]
32
38
 
@@ -1,6 +1,6 @@
1
1
  module Luca
2
2
  module Rails
3
- VERSION = "0.8.06"
3
+ VERSION = "0.8.59"
4
4
  end
5
5
  end
6
6
 
@@ -70,4 +70,36 @@ describe "The Luca Framework", ->
70
70
  expect( Luca.isBackboneModel({}) ).toEqual false
71
71
 
72
72
 
73
- describe
73
+ describe "Luca Component Definition", ->
74
+ beforeEach ->
75
+ Luca.define("Luca.random.ComponentDefinition").extends("Luca.View").with
76
+ property: "value"
77
+
78
+ it "should create the namespace for us", ->
79
+ expect( Luca.random ).toBeDefined()
80
+
81
+ it "should automatically register the namespace in the registry", ->
82
+ expect( Luca.registry.namespaces ).toContain 'Luca.random'
83
+
84
+ it "should automatically register the component in the registry", ->
85
+ expect( Luca.registry.lookup("component_definition") ).toBeDefined()
86
+
87
+ it "should reference the name of the extending class", ->
88
+ instance = new Luca.random.ComponentDefinition
89
+ expect( instance._className ).toEqual "Luca.random.ComponentDefinition"
90
+
91
+ it "should reference the extended class", ->
92
+ instance = new Luca.random.ComponentDefinition
93
+ expect( instance._superClass() ).toEqual Luca.View
94
+
95
+ it "should reference the name of the extended class", ->
96
+ instance = new Luca.random.ComponentDefinition
97
+ expect( instance._superClass()._className ).toEqual 'Luca.View'
98
+
99
+ it "should use the backbone.extend functionality properly", ->
100
+ instance = new Luca.random.ComponentDefinition
101
+ expect( instance.property ).toEqual "value"
102
+
103
+ it "should alias to _.component", ->
104
+ proxy = _.component('Luca.random.ComponentDefition')
105
+ expect( proxy.with ).toBeDefined()
@@ -1,4 +1,4 @@
1
- Luca.Application = Luca.containers.Viewport.extend
1
+ _.component('Luca.Application').extends('Luca.containers.Viewport').with
2
2
 
3
3
  components:[
4
4
  ctype: 'controller'
@@ -61,10 +61,8 @@ Luca.Application = Luca.containers.Viewport.extend
61
61
  # sort of data processing, whatever your application requires to run outside
62
62
  # of the views
63
63
  boot: ()->
64
- console.log "Sup?"
65
64
  @trigger "ready"
66
65
 
67
-
68
66
  # delegate to the collection manager's get or create function.
69
67
  # use App.collection() to create or access existing collections
70
68
  collection: ()->
@@ -1,16 +1,15 @@
1
- Luca.components.Toolbar = Luca.core.Container.extend
1
+ _.component('Luca.components.Toolbar').extends('Luca.core.Container').with
2
+
2
3
  className: 'luca-ui-toolbar'
3
-
4
+
4
5
  position: 'bottom'
5
6
 
6
7
  initialize: (@options={})->
7
8
  Luca.core.Container::initialize.apply @, arguments
8
9
 
9
10
  prepareComponents: ()->
10
- _( @components ).each (component)=>
11
+ _( @components ).each (component)=>
11
12
  component.container = @el
12
13
 
13
14
  render: ()->
14
- $(@container).append(@el)
15
-
16
- Luca.register "toolbar", "Luca.components.Toolbar"
15
+ $(@container).append(@el)
@@ -0,0 +1,2 @@
1
+ _.component('Luca.components.CollectionInspector').extends('Luca.View').with
2
+ name: "collection_inspector"
@@ -2,8 +2,10 @@
2
2
  # You can provide your own template for the collection loader modal
3
3
  # if you want to. Default implementation uses twitter bootstrap modal and
4
4
  # progress bar (http://twitter.github.com/bootstrap/). You template
5
- # should have contain `progress`, `bar` and `message` classes
6
- Luca.components.CollectionLoaderView = Luca.components.Template.extend
5
+ # should contain `progress`, `bar` and `message` classes
6
+ _.component('Luca.components.CollectionLoaderView')
7
+ .extends('Luca.components.Template').with
8
+
7
9
  className: 'luca-ui-collection-loader-view'
8
10
 
9
11
  template: "components/collection_loader_view"
@@ -24,14 +26,13 @@ Luca.components.CollectionLoaderView = Luca.components.Template.extend
24
26
  loaded = @manager.loadedCollectionsCount()
25
27
  total = @manager.totalCollectionsCount()
26
28
  progress = parseInt((loaded / total) * 100)
29
+ collectionName = _.string.titleize( _.string.humanize( name ) )
27
30
 
28
31
  @modalContainer().find('.progress .bar').attr("style", "width: #{progress}%;")
29
- @modalContainer().find('.message').html("Loaded #{ _(name).chain().humanize().titleize().value() }...")
32
+ @modalContainer().find('.message').html("Loaded #{ collectionName }...")
30
33
 
31
34
  @manager.bind "all_collections_loaded", ()=>
32
35
  @modalContainer().find('.message').html("All done!")
33
36
  _.delay ()=>
34
37
  @modalContainer().modal('hide')
35
- , 400
36
-
37
- Luca.register "collection_loader_view","Luca.components.CollectionLoaderView"
38
+ , 400
@@ -1,4 +1,6 @@
1
- Luca.components.Controller = Luca.containers.CardView.extend
1
+ _.component('Luca.components.Controller')
2
+ .extends('Luca.containers.CardView').with
3
+
2
4
  initialize: (@options)->
3
5
  Luca.containers.CardView::initialize.apply @, arguments
4
6
 
@@ -1,5 +1,7 @@
1
- Luca.components.DevelopmentConsole = Luca.View.extend
1
+ _.component('Luca.components.DevelopmentConsole').extends('Luca.View').with
2
+
2
3
  name: "development_console"
4
+
3
5
  className: 'luca-ui-development-console'
4
6
 
5
7
  initialize: (@options={})->
@@ -34,11 +36,12 @@ Luca.components.DevelopmentConsole = Luca.View.extend
34
36
 
35
37
  returnValue: (val)->
36
38
  return "undefined" unless val?
37
- val?.toString()
39
+ val?.toString() || ""
38
40
 
39
41
  parseLine: (line)->
40
- _( line ).strip()
42
+ line = _.string.strip(line)
41
43
  line = line.replace(/^return/,' ')
44
+
42
45
  "return #{ line }"
43
46
 
44
47
  commandHandle: (line)->
@@ -53,4 +56,4 @@ Luca.components.DevelopmentConsole = Luca.View.extend
53
56
  if error.message.match /circular structure to JSON/
54
57
  return ret.toString()
55
58
 
56
- error.toString()
59
+ error.toString()
@@ -1,5 +1,4 @@
1
- Luca.fields.ButtonField = Luca.core.Field.extend
2
- form_field: true
1
+ _.component('Luca.fields.ButtonField').extends('Luca.core.Field').with
3
2
 
4
3
  readOnly: true
5
4
 
@@ -36,6 +35,4 @@ Luca.fields.ButtonField = Luca.core.Field.extend
36
35
  @icon_class = "icon-#{ @icon_class }" if @icon_class.length and !@icon_class.match(/^icon-/)
37
36
  @icon_class += " icon-white" if @white
38
37
 
39
- setValue: ()-> true
40
-
41
- Luca.register "button_field", "Luca.fields.ButtonField"
38
+ setValue: ()-> true
@@ -0,0 +1,64 @@
1
+ _.component('Luca.fields.CheckboxArray').extends('Luca.core.Field').with
2
+
3
+ template: "fields/checkbox_array"
4
+
5
+ events:
6
+ "click input" : "clickHandler"
7
+
8
+ initialize: (@options={})->
9
+ _.extend @, @options
10
+ _.extend @, Luca.modules.Deferrable
11
+ _.bindAll @, "populateCheckboxes", "clickHandler", "_updateModel"
12
+
13
+ Luca.core.Field::initialize.apply @, arguments
14
+
15
+ @input_id ||= _.uniqueId('field')
16
+ @input_name ||= @name
17
+ @label ||= @name
18
+ @valueField ||= "id"
19
+ @displayField ||= "name"
20
+ @selectedItems = []
21
+
22
+ afterInitialize: (@options={})->
23
+ try
24
+ @configure_collection()
25
+ catch e
26
+ console.log "Error Configuring Collection", @, e.message
27
+
28
+ @collection.bind "reset", @populateCheckboxes
29
+
30
+ afterRender: ()->
31
+ if @collection?.models?.length > 0
32
+ @populateCheckboxes()
33
+ else
34
+ @collection.trigger("reset")
35
+
36
+ clickHandler: (event)->
37
+ checkbox = event.target
38
+ if checkbox.checked
39
+ @selectedItems.push(checkbox.value)
40
+ else
41
+ if @selectedItems.indexOf(checkbox.value) isnt -1
42
+ @selectedItems = _.without(@selectedItems, [checkbox.value])
43
+
44
+ @_updateModel()
45
+
46
+ populateCheckboxes: ()->
47
+ controls = $(@el).find('.controls')
48
+ controls.empty()
49
+ unless _.isUndefined(@getModel())
50
+ @selectedItems = @getModel().get(@name)
51
+
52
+ @collection.each (model)=>
53
+ value = model.get(@valueField)
54
+ label = model.get(@displayField)
55
+ input_id = _.uniqueId('field')
56
+ controls.append(Luca.templates["fields/checkbox_array_item"]({label: label, value: value, input_id: input_id, input_name: @input_name}))
57
+ @$("##{input_id}").attr("checked", "checked") unless @selectedItems.indexOf(value) is -1
58
+
59
+ $(@container).append(@$el)
60
+
61
+ _updateModel: ()->
62
+ attributes = {}
63
+ attributes[@name] = @selectedItems
64
+ @getModel().set(attributes)
@@ -1,21 +1,20 @@
1
- Luca.fields.CheckboxField = Luca.core.Field.extend
2
- form_field: true
1
+ _.component('Luca.fields.CheckboxField').extends('Luca.core.Field').with
3
2
 
4
3
  events:
5
4
  "change input" : "change_handler"
6
5
 
7
6
  change_handler: (e)->
8
7
  me = my = $(e.currentTarget)
9
-
8
+
10
9
  @trigger "on:change", @, e
11
-
10
+
12
11
  if me.checked is true
13
12
  @trigger "checked"
14
13
  else
15
14
  @trigger "unchecked"
16
15
 
17
16
  className: 'luca-ui-checkbox-field luca-ui-field'
18
-
17
+
19
18
  template: 'fields/checkbox_field'
20
19
 
21
20
  hooks: ["checked","unchecked"]
@@ -27,8 +26,8 @@ Luca.fields.CheckboxField = Luca.core.Field.extend
27
26
  Luca.core.Field::initialize.apply @, arguments
28
27
 
29
28
  afterInitialize: ()->
30
- @input_id ||= _.uniqueId('field')
31
- @input_name ||= @name
29
+ @input_id ||= _.uniqueId('field')
30
+ @input_name ||= @name
32
31
  @input_value ||= 1
33
32
  @label ||= @name
34
33
 
@@ -36,6 +35,4 @@ Luca.fields.CheckboxField = Luca.core.Field.extend
36
35
  @input.attr('checked', checked)
37
36
 
38
37
  getValue:()->
39
- @input.attr('checked') is true
40
-
41
- Luca.register "checkbox_field", "Luca.fields.CheckboxField"
38
+ @input.attr('checked') is true
@@ -1,5 +1,4 @@
1
- Luca.fields.FileUploadField = Luca.core.Field.extend
2
- form_field: true
1
+ _.component('Luca.fields.FileUploadField').extends('Luca.core.Field').with
3
2
 
4
3
  template: 'fields/file_upload_field'
5
4
 
@@ -7,9 +6,7 @@ Luca.fields.FileUploadField = Luca.core.Field.extend
7
6
  Luca.core.Field::initialize.apply @, arguments
8
7
 
9
8
  afterInitialize: ()->
10
- @input_id ||= _.uniqueId('field')
11
- @input_name ||= @name
9
+ @input_id ||= _.uniqueId('field')
10
+ @input_name ||= @name
12
11
  @label ||= @name
13
12
  @helperText ||= ""
14
-
15
- Luca.register "file_upload_field", "Luca.fields.FileUploadField"
@@ -1,5 +1,4 @@
1
- Luca.fields.HiddenField = Luca.core.Field.extend
2
- form_field: true
1
+ _.component('Luca.fields.HiddenField').extends('Luca.core.Field').with
3
2
 
4
3
  template: 'fields/hidden_field'
5
4
 
@@ -7,12 +6,7 @@ Luca.fields.HiddenField = Luca.core.Field.extend
7
6
  Luca.core.Field::initialize.apply @, arguments
8
7
 
9
8
  afterInitialize: ()->
10
- @input_id ||= _.uniqueId('field')
11
- @input_name ||= @name
9
+ @input_id ||= _.uniqueId('field')
10
+ @input_name ||= @name
12
11
  @input_value ||= @value
13
- @label ||= @name
14
-
15
- Luca.register "hidden_field", "Luca.fields.HiddenField"
16
-
17
-
18
-
12
+ @label ||= @name
@@ -1,9 +1,8 @@
1
- Luca.fields.SelectField = Luca.core.Field.extend
2
- form_field: true
1
+ _.component('Luca.fields.SelectField').extends('Luca.core.Field').with
3
2
 
4
3
  events:
5
4
  "change select" : "change_handler"
6
-
5
+
7
6
  hooks:[
8
7
  "after:select"
9
8
  ]
@@ -17,16 +16,16 @@ Luca.fields.SelectField = Luca.core.Field.extend
17
16
  blankValue: ''
18
17
 
19
18
  blankText: 'Select One'
20
-
19
+
21
20
  initialize: (@options={})->
22
21
  _.extend @, @options
23
22
  _.extend @, Luca.modules.Deferrable
24
23
  _.bindAll @, "change_handler", "populateOptions", "beforeFetch"
25
24
 
26
25
  Luca.core.Field::initialize.apply @, arguments
27
-
28
- @input_id ||= _.uniqueId('field')
29
- @input_name ||= @name
26
+
27
+ @input_id ||= _.uniqueId('field')
28
+ @input_name ||= @name
30
29
  @label ||= @name
31
30
  @retainValue = true if _.isUndefined @retainValue
32
31
 
@@ -43,7 +42,7 @@ Luca.fields.SelectField = Luca.core.Field.extend
43
42
 
44
43
  @collection.bind "before:fetch", @beforeFetch
45
44
  @collection.bind "reset", @populateOptions
46
-
45
+
47
46
  # if the select field is configured with a data property
48
47
  # then parse that data into the proper format. either
49
48
  # an array of objects with the valueField and displayField
@@ -57,7 +56,7 @@ Luca.fields.SelectField = Luca.core.Field.extend
57
56
 
58
57
  hash
59
58
 
60
-
59
+
61
60
  afterRender: ()->
62
61
  @input = $('select', @el)
63
62
 
@@ -65,7 +64,7 @@ Luca.fields.SelectField = Luca.core.Field.extend
65
64
  @populateOptions()
66
65
  else
67
66
  @collection.trigger("reset")
68
-
67
+
69
68
  setValue: (value)->
70
69
  @currentValue = value
71
70
  Luca.core.Field::setValue.apply @, arguments
@@ -74,18 +73,18 @@ Luca.fields.SelectField = Luca.core.Field.extend
74
73
  @resetOptions()
75
74
 
76
75
  change_handler: (e)->
77
- @trigger "on:change", @, e
78
-
76
+ @trigger "on:change", @, e
77
+
79
78
  resetOptions: ()->
80
79
  @input.html('')
81
-
80
+
82
81
  if @includeBlank
83
82
  @input.append("<option value='#{ @blankValue }'>#{ @blankText }</option>")
84
83
 
85
84
 
86
85
  populateOptions: ()->
87
86
  @resetOptions()
88
-
87
+
89
88
  if @collection?.each?
90
89
  @collection.each (model) =>
91
90
  value = model.get( @valueField )
@@ -93,8 +92,6 @@ Luca.fields.SelectField = Luca.core.Field.extend
93
92
  selected = "selected" if @selected and value is @selected
94
93
  option = "<option #{ selected } value='#{ value }'>#{ display }</option>"
95
94
  @input.append( option )
96
-
97
- @trigger "after:populate:options", @
98
- @setValue( @currentValue )
99
95
 
100
- Luca.register "select_field", "Luca.fields.SelectField"
96
+ @trigger "after:populate:options", @
97
+ @setValue( @currentValue )
@@ -1,5 +1,4 @@
1
- Luca.fields.TextAreaField = Luca.core.Field.extend
2
- form_field: true
1
+ _.component('Luca.fields.TextAreaField').extends('Luca.core.Field').with
3
2
 
4
3
  events:
5
4
  "keydown input" : "keydown_handler"
@@ -16,8 +15,8 @@ Luca.fields.TextAreaField = Luca.core.Field.extend
16
15
 
17
16
  Luca.core.Field::initialize.apply @, arguments
18
17
 
19
- @input_id ||= _.uniqueId('field')
20
- @input_name ||= @name
18
+ @input_id ||= _.uniqueId('field')
19
+ @input_name ||= @name
21
20
  @label ||= @name
22
21
  @input_class ||= @class
23
22
  @inputStyles ||= "height:#{ @height };width:#{ @width }"
@@ -27,7 +26,7 @@ Luca.fields.TextAreaField = Luca.core.Field.extend
27
26
 
28
27
  getValue: ()->
29
28
  $( @field() ).val()
30
-
29
+
31
30
  field: ()->
32
31
  @input = $("textarea##{ @input_id }", @el)
33
32
 
@@ -38,6 +37,4 @@ Luca.fields.TextAreaField = Luca.core.Field.extend
38
37
  me = my = $( e.currentTarget )
39
38
 
40
39
  focus_handler: (e)->
41
- me = my = $( e.currentTarget )
42
-
43
- Luca.register "text_area_field", "Luca.fields.TextAreaField"
40
+ me = my = $( e.currentTarget )
@@ -1,6 +1,4 @@
1
- Luca.fields.TextField = Luca.core.Field.extend
2
- form_field: true
3
-
1
+ _.component('Luca.fields.TextField').extends('Luca.core.Field').with
4
2
  events:
5
3
  "keydown input" : "keydown_handler"
6
4
  "blur input" : "blur_handler"
@@ -13,15 +11,15 @@ Luca.fields.TextField = Luca.core.Field.extend
13
11
  _.bindAll @, "keydown_handler", "blur_handler", "focus_handler"
14
12
  Luca.core.Field::initialize.apply @, arguments
15
13
 
16
- @input_id ||= _.uniqueId('field')
17
- @input_name ||= @name
14
+ @input_id ||= _.uniqueId('field')
15
+ @input_name ||= @name
18
16
  @label ||= @name
19
17
  @input_class ||= @class
20
18
 
21
19
  if @prepend
22
- @$el.addClass('input-prepend')
20
+ @$el.addClass('input-prepend')
23
21
  @addOn = @prepend
24
-
22
+
25
23
  if @append
26
24
  @$el.addClass('input-append')
27
25
  @addOn = @append
@@ -33,11 +31,6 @@ Luca.fields.TextField = Luca.core.Field.extend
33
31
 
34
32
  focus_handler: (e)->
35
33
  me = my = $( e.currentTarget )
36
-
37
- change_handler: (e)->
38
- @trigger "on:change", @, e
39
-
40
-
41
- Luca.register "text_field", "Luca.fields.TextField"
42
-
43
34
 
35
+ change_handler: (e)->
36
+ @trigger "on:change", @, e
@@ -1,10 +1,8 @@
1
- Luca.fields.TypeAheadField = Luca.fields.TextField.extend
2
- form_field: true
3
-
1
+ _.component('Luca.fields.TypeAheadField').extends('Luca.fields.TextField').with
4
2
  className: 'luca-ui-field'
5
3
 
6
4
  afterInitialize: ()->
7
- @input_id ||= _.uniqueId('field')
8
- @input_name ||= @name
5
+ @input_id ||= _.uniqueId('field')
6
+ @input_name ||= @name
9
7
  @label ||= @name
10
-
8
+
@@ -1,10 +1,12 @@
1
- Luca.components.FormButtonToolbar = Luca.components.Toolbar.extend
1
+ _.component('Luca.components.FormButtonToolbar')
2
+ .extends('Luca.components.Toolbar').with
3
+
2
4
  className: 'luca-ui-form-toolbar form-actions'
3
5
 
4
6
  position: 'bottom'
5
7
 
6
8
  includeReset: false
7
-
9
+
8
10
  render: ()->
9
11
  $(@container).append(@el)
10
12
 
@@ -22,5 +24,3 @@ Luca.components.FormButtonToolbar = Luca.components.Toolbar.extend
22
24
  ctype: 'button_field'
23
25
  label: 'Reset'
24
26
  class: 'btn reset-button'
25
-
26
- Luca.register "form_button_toolbar", "Luca.components.FormButtonToolbar"