luca 0.9.1 → 0.9.2

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 (59) hide show
  1. data/CHANGELOG +9 -0
  2. data/ROADMAP +15 -3
  3. data/Rakefile +33 -7
  4. data/app.rb +0 -1
  5. data/assets/javascripts/dependencies.coffee +0 -1
  6. data/assets/javascripts/sandbox/application.coffee +1 -1
  7. data/assets/javascripts/sandbox/templates/main.luca +52 -34
  8. data/assets/javascripts/sandbox/templates/sandbox/navigation.luca +3 -1
  9. data/assets/stylesheets/bootstrap-responsive.min.css +0 -1
  10. data/assets/stylesheets/bootstrap.min.css +48 -29
  11. data/assets/stylesheets/sandbox/sandbox.scss +11 -28
  12. data/lib/luca/rails/version.rb +1 -1
  13. data/site/assets/dependencies.js +94 -0
  14. data/site/assets/glyphicons-halflings-white.png +0 -0
  15. data/site/assets/glyphicons-halflings.png +0 -0
  16. data/site/assets/luca-ui-bootstrap.css +1313 -0
  17. data/site/assets/luca-ui-bootstrap.js +9 -0
  18. data/site/assets/luca-ui-development-tools.css +224 -0
  19. data/site/assets/luca-ui-development-tools.js +18561 -0
  20. data/site/assets/sandbox.css +14 -0
  21. data/site/assets/sandbox.js +131 -0
  22. data/site/index.html +20 -0
  23. data/spec/core/collection_spec.coffee +6 -6
  24. data/spec/core/view_spec.coffee +1 -0
  25. data/spec/framework_spec.coffee +7 -0
  26. data/spec/managers/collection_manager_spec.coffee +2 -1
  27. data/src/components/application.coffee +8 -4
  28. data/src/components/collection_view.coffee +8 -2
  29. data/src/components/fields/checkbox_array.coffee +3 -1
  30. data/src/components/form_view.coffee +46 -21
  31. data/src/components/grid_view.coffee +2 -4
  32. data/src/components/nav_bar.coffee +3 -7
  33. data/src/containers/tab_view.coffee +15 -2
  34. data/src/containers/viewport.coffee +13 -4
  35. data/src/core/collection.coffee +68 -53
  36. data/src/core/core.coffee +7 -2
  37. data/src/core/panel.coffee +32 -17
  38. data/src/core/registry.coffee +11 -3
  39. data/src/core/util.coffee +17 -1
  40. data/src/core/view.coffee +6 -5
  41. data/src/framework.coffee +46 -2
  42. data/src/managers/collection_manager.coffee +22 -81
  43. data/src/stylesheets/components/checkbox_array.scss +5 -0
  44. data/src/templates/components/form_alert +0 -0
  45. data/src/templates/components/form_alert.luca +3 -0
  46. data/src/templates/containers/tab_view.luca +1 -1
  47. data/src/tools/console.coffee +3 -0
  48. data/vendor/assets/javascripts/luca-ui-base.js +266 -128
  49. data/vendor/assets/javascripts/luca-ui-development-tools.js +3 -161
  50. data/vendor/assets/javascripts/luca-ui-development-tools.min.js +15 -0
  51. data/vendor/assets/javascripts/luca-ui-spec.js +380 -176
  52. data/vendor/assets/javascripts/luca-ui.js +348 -166
  53. data/vendor/assets/javascripts/luca-ui.min.js +4 -3
  54. data/vendor/assets/stylesheets/luca-ui-bootstrap.css +50 -29
  55. data/vendor/assets/stylesheets/luca-ui-spec.css +2 -0
  56. data/vendor/assets/stylesheets/luca-ui.css +2 -0
  57. metadata +16 -4
  58. data/src/templates/components/form_view.luca +0 -4
  59. data/src/tools/development_console.coffee +0 -147
@@ -0,0 +1,14 @@
1
+ #viewport {
2
+ line-height: 1.5;
3
+ color: #333; }
4
+ #viewport p {
5
+ font-size: 14px; }
6
+ #viewport #information .row.heading {
7
+ margin-top: 12px;
8
+ margin-bottom: 12px; }
9
+ #viewport #information .row h3 {
10
+ margin-bottom: 4px; }
11
+ /*
12
+
13
+ */
14
+
@@ -0,0 +1,131 @@
1
+ (function() {
2
+
3
+ window.Sandbox = {
4
+ views: {},
5
+ collections: {},
6
+ models: {}
7
+ };
8
+
9
+ Luca.registry.addNamespace('Sandbox.views');
10
+
11
+ Luca.Collection.namespace = Sandbox.collections;
12
+
13
+ }).call(this);
14
+ (function() {
15
+ Luca.templates || (Luca.templates = {});
16
+ Luca.templates["main"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'hero-unit\'>\n <h1>Want to build apps with Backbone?</h1>\n <p>This is a collection of application design components that you should use to build your next large backbone.js application.</p>\n <p>It combines the elegance and simplicity of backbone.js and bootstrap.css, with the experience of developers who have been building single page javascript apps since you were a baby.</p>\n <a class=\'btn btn-large btn-primary\' href=\'#class_browser\'>\n Download\n </a>\n <a class=\'btn btn-success btn-large\' href=\'#component_tester\'>\n Build a component\n </a>\n</div>\n<hr />\n<div id=\'information\'>\n <div class=\'row heading\'>\n <div class=\'span12\'>\n <h2>Composite Application Architecture</h2>\n </div>\n </div>\n <div class=\'row\'>\n <div class=\'span4\'>\n <h3>Component Driven Design</h3>\n <p>Luca is a collection of common components needed to build large single page applications. Luca provides base classes for Model, View, and Collection classes which you can choose to extend where needed. Luca also provides an extensive library of application building components and UI elements which you can piece together in a variety of ways to build responsive, and snappy single page apps.</p>\n </div>\n <div class=\'span4\'>\n <h3>Backbone and Luca work together</h3>\n <p>Luca is not a replacement for Backbone, it is a smart use of Backbone\'s core classes. Large apps require layers of abstraction and patterns for communication between various components, Luca provides these for you.</p>\n <p>Like Backbone, you only have to use what you need.</p>\n </div>\n <div class=\'span4\'>\n <h3>Relies on good patterns</h3>\n <p>We have extracted all of the common patterns and optimizations we have learned over the course of a year developing several large applications. Using Luca allows you to leverage the power of Backbone.js but only focus on what makes your app unique.</p>\n </div>\n <a href=\'https://github.com/datapimp/luca\'>\n <img alt=\'Fork me on GitHub\' src=\'https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png\' style=\'position: absolute; top: 0; right: 0; border: 0; z-index:9000;\' />\n </a>\n </div>\n <div class=\'row heading\'>\n <div class=\'span12\'>\n <h2>Develop Apps Faster</h2>\n </div>\n </div>\n <div class=\'row\'>\n <div class=\'span4\'>\n <h3>Development Tools</h3>\n <p>If you enable the Luca development tools, you have access to things like an in browser Coffeescript console, a CodeMirror based IDE to edit and test your components which live reloads javascript prototype changes and re-renders your components, so that you can experiment directly in the browser.</p>\n <p>Live reloading of your code changes is also supported if you use the ruby gem and make changes in your favorite editor.</p>\n </div>\n <div class=\'span4\'>\n <h3>Experimentation and Debugging</h3>\n <p>The way the Luca framework was designed encourages us to define our apps mostly using JSON configuration, which then gets interpreted, and structural components and style rules are generated for us. Events get binded, and things just work.</p>\n <p>Because large parts of the application\'s code are just configuration strings, it is very easy to provide you with a suite of development tools that allow you to inspect what is going on behind the scenes and make changes directly in the environment if you want to experiment with some ideas.</p>\n </div>\n <div class=\'span4\'>\n <h3>Not only for Ruby Developers</h3>\n <p>Luca is just javascript and css, and will work with any server backend.</p>\n <p>That being said, Luca was developed against Rails and Sinatra apps and comes with many development helpers which work in these environments. The development environment and sandbox is a Sinatra app, but like everything else in the framework you can only use what you need.</p>\n </div>\n </div>\n</div>\n');}return __p.join('');};
17
+ }).call(this);
18
+ (function() {
19
+ Luca.templates || (Luca.templates = {});
20
+ Luca.templates["sandbox"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<h1>Hi</h1>\n');}return __p.join('');};
21
+ }).call(this);
22
+ (function() {
23
+ Luca.templates || (Luca.templates = {});
24
+ Luca.templates["sandbox/navigation"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<ul class=\'nav\'>\n <li>\n <a href=\'#\'>Intro</a>\n </li>\n</ul>\n');}return __p.join('');};
25
+ }).call(this);
26
+ (function() {
27
+
28
+ _.def("Sandbox.views.TopNavigation")["extends"]("Luca.components.NavBar")["with"]({
29
+ brand: "Luca",
30
+ name: "top_navigation",
31
+ template: "sandbox/navigation"
32
+ });
33
+
34
+ }).call(this);
35
+ (function() {
36
+
37
+ Sandbox.Router = Luca.Router.extend({
38
+ routes: {
39
+ "": "default",
40
+ "class_browser": "class_browser",
41
+ "component_tester": "component_tester"
42
+ },
43
+ "default": function() {
44
+ return this.app.navigate_to("pages").navigate_to("main");
45
+ },
46
+ class_browser: function() {
47
+ return this.app.navigate_to("pages").navigate_to("class_browser");
48
+ },
49
+ component_tester: function() {
50
+ return this.app.navigate_to("pages").navigate_to("component_tester");
51
+ }
52
+ });
53
+
54
+ }).call(this);
55
+ (function() {
56
+
57
+ Sandbox.Application = Luca.Application.extend({
58
+ name: 'sandbox_application',
59
+ el: '#viewport',
60
+ fluid: true,
61
+ topNav: 'top_navigation',
62
+ useKeyRouter: true,
63
+ keyEvents: {
64
+ meta: {
65
+ forwardslash: "developmentConsole"
66
+ }
67
+ },
68
+ components: [
69
+ {
70
+ ctype: 'controller',
71
+ name: 'pages',
72
+ components: [
73
+ {
74
+ name: "main",
75
+ bodyTemplate: 'main'
76
+ }, {
77
+ name: "class_browser",
78
+ ctype: "class_browser"
79
+ }, {
80
+ name: "component_tester",
81
+ ctype: "component_tester"
82
+ }
83
+ ]
84
+ }
85
+ ],
86
+ initialize: function(options) {
87
+ this.options = options != null ? options : {};
88
+ Luca.Application.prototype.initialize.apply(this, arguments);
89
+ return this.router = new Sandbox.Router({
90
+ app: this
91
+ });
92
+ },
93
+ developmentConsole: function() {
94
+ var container;
95
+ this.developmentConsole = Luca("coffeescript-console", function() {
96
+ return new Luca.tools.DevelopmentConsole({
97
+ name: "coffeescript-console"
98
+ });
99
+ });
100
+ if (!this.consoleContainerAppended) {
101
+ container = this.make("div", {
102
+ id: "devtools-console-wrapper",
103
+ "class": "devtools-console-container modal",
104
+ style: "width:1000px"
105
+ }, this.developmentConsole.el);
106
+ $('body').append(container);
107
+ this.consoleContainerAppended = true;
108
+ this.developmentConsole.render();
109
+ }
110
+ return $('#devtools-console-wrapper').modal({
111
+ backdrop: false,
112
+ show: true
113
+ });
114
+ },
115
+ afterRender: function() {
116
+ return this._super("afterRender", this, arguments);
117
+ }
118
+ });
119
+
120
+ $((function() {
121
+ (window || global).SandboxApp = new Sandbox.Application();
122
+ SandboxApp.boot();
123
+ return prettyPrint();
124
+ })());
125
+
126
+ }).call(this);
127
+ (function() {
128
+
129
+
130
+
131
+ }).call(this);
data/site/index.html ADDED
@@ -0,0 +1,20 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title>Luca. Container Framework For Backbone Views</title>
7
+ <meta name="viewport" content="width=device-width,initial-scale=1">
8
+ <link rel="stylesheet" href="assets/luca-ui-bootstrap.css">
9
+ <link rel="stylesheet" href="assets/luca-ui-development-tools.css">
10
+ <link rel="stylesheet" href="assets/sandbox.css">
11
+ </head>
12
+ <body>
13
+ <div id="viewport"></div>
14
+ <script src="assets/dependencies.js"></script>
15
+ <script src="assets/bootstrap.min.js"></script>
16
+ <script src="assets/luca-ui.min.js"></script>
17
+ <script src="assets/luca-ui-development-tools.min.js"></script>
18
+ <script src="assets/sandbox.js"></script>
19
+ </body>
20
+ </html>
@@ -44,7 +44,7 @@ describe "Method Caching", ->
44
44
 
45
45
  describe "Luca.Collection", ->
46
46
  it "should accept a name and collection manager", ->
47
- mgr = new Luca.CollectionManager()
47
+ mgr = Luca.CollectionManager.get?('collection-spec') || new Luca.CollectionManager(name:"collection-spec")
48
48
  collection = new Luca.Collection([], name:"booya",manager:mgr)
49
49
  expect( collection.name ).toEqual("booya")
50
50
  expect( collection.manager ).toEqual(mgr)
@@ -170,16 +170,16 @@ describe "The onceLoaded helper", ->
170
170
  describe "Registering with the collection manager", ->
171
171
 
172
172
  it "should be able to find a default collection manager", ->
173
- mgr = new Luca.CollectionManager()
173
+ mgr = Luca.CollectionManager.get() || new Luca.CollectionManager()
174
174
  expect( Luca.CollectionManager.get() ).toEqual(mgr)
175
175
 
176
176
  it "should automatically register with the manager if I specify a name", ->
177
- mgr = new Luca.CollectionManager()
177
+ mgr = Luca.CollectionManager.get() || new Luca.CollectionManager()
178
178
  collection = new Luca.Collection([],name:"auto_register")
179
179
  expect( mgr.get("auto_register") ).toEqual(collection)
180
180
 
181
181
  it "should register with a specific manager", ->
182
- window.other_manager = new Luca.CollectionManager()
182
+ window.other_manager = new Luca.CollectionManager(name:"other_manager")
183
183
 
184
184
  collection = new Luca.Collection [],
185
185
  name: "other_collection"
@@ -188,7 +188,7 @@ describe "Registering with the collection manager", ->
188
188
  expect( window.other_manager.get("other_collection") ).toEqual(collection)
189
189
 
190
190
  it "should find a collection manager by string", ->
191
- window.find_mgr_by_string = new Luca.CollectionManager()
191
+ window.find_mgr_by_string = new Luca.CollectionManager(name:"find_by_string")
192
192
 
193
193
  collection = new Luca.Collection [],
194
194
  name: "biggie"
@@ -197,7 +197,7 @@ describe "Registering with the collection manager", ->
197
197
  expect( collection.manager ).toBeDefined()
198
198
 
199
199
  it "should not register with a collection manager if it is marked as private", ->
200
- manager = new Luca.CollectionManager()
200
+ manager = new Luca.CollectionManager(name:"private")
201
201
 
202
202
  registerSpy = sinon.spy()
203
203
 
@@ -148,6 +148,7 @@ describe "The Collection Events API", ->
148
148
  name: "collectionEvents"
149
149
 
150
150
  beforeEach ()->
151
+ Luca.CollectionManager.destroyAll()
151
152
  @manager ||= new SampleManager()
152
153
  @collection = @manager.getOrCreate("sample")
153
154
 
@@ -68,6 +68,13 @@ describe "The Luca Framework", ->
68
68
  expect( Luca.isBackboneModel(obj) ).toEqual true
69
69
  expect( Luca.isBackboneModel({}) ).toEqual false
70
70
 
71
+ it "should detect if a prototype is a luca view", ->
72
+ MyView = Luca.View.extend({})
73
+ expect( Luca.isViewPrototype(MyView) ).toEqual true
74
+
75
+ it "should detect if a prototype is a backbone view", ->
76
+ MyView = Backbone.View.extend()
77
+ expect( Luca.isViewPrototype(MyView) ).toEqual true
71
78
 
72
79
  describe "Luca Component Definition", ->
73
80
  beforeEach ->
@@ -5,6 +5,7 @@ describe "The Collection Manager", ->
5
5
  url: "/models"
6
6
 
7
7
  beforeEach ()->
8
+ Luca.CollectionManager.destroyAll()
8
9
  @manager = new Luca.CollectionManager(name:"manager",collectionNamespace: App.collections)
9
10
 
10
11
  it "should be defined", ->
@@ -22,7 +23,7 @@ describe "The Collection Manager", ->
22
23
  expect( collection.url ).toEqual "/models"
23
24
 
24
25
  describe "Adding Collections", ->
25
- manager = new Luca.CollectionManager
26
+ manager = Luca.CollectionManager.get?() || new Luca.CollectionManager(name:"blahblah")
26
27
  first = new Luca.Collection([],name:"added",prop:"val2")
27
28
  second = new Luca.Collection([],name:"added",prop:"val1")
28
29
 
@@ -9,6 +9,8 @@ _.def('Luca.Application').extends('Luca.containers.Viewport').with
9
9
  # by default unless otherwise specified
10
10
  useCollectionManager: true
11
11
 
12
+ collectionManagerClass: "Luca.CollectionManager"
13
+
12
14
  # Luca plugin apps are apps which mount onto existing
13
15
  # luca apps, and will not have the behavior of a main
14
16
  # app which acts as a singleton
@@ -46,16 +48,18 @@ _.def('Luca.Application').extends('Luca.containers.Viewport').with
46
48
  ]
47
49
 
48
50
  if @useCollectionManager is true
51
+ @collectionManagerClass = Luca.util.resolve( @collectionManagerClass ) if _.isString( @collectionManagerClass )
52
+
49
53
  @collectionManager ||= Luca.CollectionManager.get?()
50
- @collectionManager ||= new Luca.CollectionManager( @collectionManagerOptions||={} )
54
+ @collectionManager ||= new @collectionManagerClass( @collectionManagerOptions||={} )
51
55
 
52
- @state = new Backbone.Model( @defaultState )
56
+ @state = new Luca.Model( @defaultState )
53
57
 
54
58
  # we will render when all of the various components
55
59
  # which handle our data dependencies determine that
56
60
  # we are ready
57
- @bind "ready", ()=>
58
- @render()
61
+ @defer(()=>@render()).until("ready")
62
+
59
63
  # the keyRouter allows us to specify
60
64
  # keyEvents on our application with an API very similar
61
65
  # to the DOM events API for Backbone.View
@@ -22,7 +22,7 @@ _.def("Luca.components.CollectionView").extends("Luca.components.Panel").with
22
22
 
23
23
  _.bindAll @, "refresh"
24
24
 
25
- unless @collection?
25
+ unless @collection? or @options.collection
26
26
  throw "Collection Views must specify a collection"
27
27
 
28
28
  unless @itemTemplate? || @itemRenderer? || @itemProperty?
@@ -30,6 +30,9 @@ _.def("Luca.components.CollectionView").extends("Luca.components.Panel").with
30
30
 
31
31
  Luca.components.Panel::initialize.apply(@, arguments)
32
32
 
33
+ if _.isString(@collection) and Luca.CollectionManager.get()
34
+ @collection = Luca.CollectionManager.get().get(@collection)
35
+
33
36
  if Luca.isBackboneCollection(@collection)
34
37
  @collection.bind "reset", @refresh
35
38
  @collection.bind "add", @refresh
@@ -46,7 +49,10 @@ _.def("Luca.components.CollectionView").extends("Luca.components.Panel").with
46
49
  content = @itemRenderer.call(@, item)
47
50
 
48
51
  if @itemProperty
49
- content = if _.isFunction(@itemProperty) then @itemProperty() else (item.model.get(@itemProperty) || item.model[ @itemProperty ])
52
+ content = item.model.get(@itemProperty) || item.model[ @itemProperty ]
53
+ content = content() if _.isFunction(content)
54
+
55
+ content
50
56
 
51
57
  makeItem: (model, index)->
52
58
  item = if @prepareItem? then @prepareItem.call(@, model, index) else (model:model, index: index)
@@ -5,6 +5,8 @@ _.def('Luca.fields.CheckboxArray').extends('Luca.core.Field').with
5
5
 
6
6
  template: "fields/checkbox_array"
7
7
 
8
+ className: "luca-ui-checkbox-array"
9
+
8
10
  events:
9
11
  "click input" : "clickHandler"
10
12
 
@@ -57,7 +59,7 @@ _.def('Luca.fields.CheckboxArray').extends('Luca.core.Field').with
57
59
  label = model.get(@displayField)
58
60
  input_id = _.uniqueId("#{ @cid }_checkbox")
59
61
 
60
- inputElement = make("input",type:"checkbox",name:@input_name,value:value,id: input_id)
62
+ inputElement = make("input",type:"checkbox",class:"array-checkbox",name:@input_name,value:value,id: input_id)
61
63
  element = make("label", {for:input_id}, inputElement)
62
64
 
63
65
  $( element ).append(" #{ label }")
@@ -1,3 +1,20 @@
1
+ defaultToolbar =
2
+ buttons:[
3
+ icon:"remove-sign"
4
+ label: "Reset"
5
+ eventId: "click:reset"
6
+ className:"reset-button"
7
+ align: 'right'
8
+ ,
9
+ icon:"ok-sign"
10
+ white: true
11
+ label: "Save Changes"
12
+ eventId: "click:submit"
13
+ color: "success"
14
+ className: 'submit-button'
15
+ align: 'right'
16
+ ]
17
+
1
18
  _.def("Luca.components.FormView").extends('Luca.core.Container').with
2
19
 
3
20
  tagName: 'form'
@@ -29,7 +46,6 @@ _.def("Luca.components.FormView").extends('Luca.core.Container').with
29
46
  legend: ""
30
47
 
31
48
  bodyClassName: "form-view-body"
32
- bodyTemplate: ["components/form_view"]
33
49
 
34
50
  initialize: (@options={})->
35
51
  @loadMask = Luca.enableBootstrap unless @loadMask?
@@ -44,23 +60,12 @@ _.def("Luca.components.FormView").extends('Luca.core.Container').with
44
60
 
45
61
  @applyStyleClasses()
46
62
 
47
- if @toolbar is true and not (@bottomToolbar? or @topToolbar?)
48
- @bottomToolbar =
49
- buttons:[
50
- icon:"remove-sign"
51
- label: "Reset"
52
- eventId: "click:reset"
53
- className:"reset-button"
54
- align: 'right'
55
- ,
56
- icon:"ok-sign"
57
- white: true
58
- label: "Save Changes"
59
- eventId: "click:submit"
60
- color: "success"
61
- className: 'submit-button'
62
- align: 'right'
63
- ]
63
+ if @toolbar isnt false and (not @topToolbar and not @bottomToolbar)
64
+ @topToolbar = @getDefaultToolbar() if @toolbar is "both" or @toolbar is "top"
65
+ @bottomToolbar = @getDefaultToolbar() unless @toolbar is "top"
66
+
67
+ getDefaultToolbar: ()->
68
+ defaultToolbar
64
69
 
65
70
  applyStyleClasses: ()->
66
71
  if Luca.enableBootstrap
@@ -78,13 +83,13 @@ _.def("Luca.components.FormView").extends('Luca.core.Container').with
78
83
  @$el.addClass('form-inline') if @inlineForm
79
84
 
80
85
  resetHandler: (e)->
81
- me = my = $( e.currentTarget )
86
+ me = my = $( e?.target )
82
87
  @trigger "before:reset", @
83
88
  @reset()
84
89
  @trigger "after:reset", @
85
90
 
86
91
  submitHandler: (e)->
87
- me = my = $( e.currentTarget )
92
+ me = my = $( e?.target )
88
93
  @trigger "before:submit", @
89
94
  @trigger "enable:loadmask", @ if @loadMask is true
90
95
  @submit() if @hasModel()
@@ -228,4 +233,24 @@ _.def("Luca.components.FormView").extends('Luca.core.Container').with
228
233
  @current_model?.set( @getValues() )
229
234
 
230
235
  setLegend: (@legend)->
231
- $('fieldset legend', @el).first().html(@legend)
236
+ $('fieldset legend', @el).first().html(@legend)
237
+
238
+ flash: (message)->
239
+ if @$('.toolbar-container.top').length > 0
240
+ @$('.toolbar-container.top').after(message)
241
+ else
242
+ @$bodyEl().prepend(message)
243
+
244
+ successFlashDelay: 1500
245
+
246
+ successMessage: (message)->
247
+ @$('.alert.alert-success').remove()
248
+ @flash Luca.template("components/form_alert", className:"alert alert-success", message: message)
249
+ _.delay ()=>
250
+ @$('.alert.alert-success').fadeOut()
251
+ , @successFlashDelay || 0
252
+
253
+ errorMessage: (message)->
254
+ @$('.alert.alert-error').remove()
255
+ @flash Luca.template("components/form_alert", className:"alert alert-error", message: message)
256
+
@@ -67,12 +67,10 @@ _.def('Luca.components.GridView').extend('Luca.components.Panel').with
67
67
  @configure_collection(true)
68
68
 
69
69
  @collection.bind "before:fetch", ()=>
70
- console.log "Triggering Enable Load Mask"
71
70
  @trigger "enable:loadmask" if @loadMask is true
72
71
 
73
72
  @collection.bind "reset", (collection) =>
74
73
  @refresh()
75
- console.log "Triggering Disable LoadMask"
76
74
  @trigger "disable:loadmask" if @loadMask is true
77
75
  @trigger "after:collection:load", collection
78
76
 
@@ -84,9 +82,9 @@ _.def('Luca.components.GridView').extend('Luca.components.Panel').with
84
82
  try
85
83
  rowEl = @getRowEl( model.id || model.get('id') || model.cid )
86
84
  cells = @render_row(model, @collection.indexOf(model), cellsOnly: true )
87
- $( rowEl ).html( cells )
85
+ $( rowEl ).html( cells.join(" ") )
88
86
  catch error
89
- console.log "Error in change handler for GridView.collection", error, @, model, rowEl, cells
87
+ console.log "Error in change handler for GridView.collection", error, @, model
90
88
 
91
89
  beforeRender: ()->
92
90
  Luca.components.Panel::beforeRender?.apply(@, arguments)
@@ -1,15 +1,8 @@
1
1
  _.def("Luca.components.NavBar").extends("Luca.View").with
2
2
  fixed: true
3
-
4
3
  position: 'top'
5
-
6
4
  className: 'navbar'
7
-
8
- initialize: (@options={})->
9
- Luca.View::initialize.apply(@, arguments)
10
-
11
5
  brand: "Luca.js"
12
-
13
6
  bodyTemplate: 'nav_bar'
14
7
  bodyClassName: 'luca-ui-navbar-body'
15
8
 
@@ -19,6 +12,9 @@ _.def("Luca.components.NavBar").extends("Luca.View").with
19
12
  if @brand?
20
13
  @content().append("<a class='brand' href='#'>#{ @brand }</a>")
21
14
 
15
+ if @template
16
+ @content().append Luca.template(@template, @)
17
+
22
18
  render: ()->
23
19
  @
24
20
 
@@ -13,10 +13,14 @@ _.def('Luca.containers.TabView').extends('Luca.containers.CardView').with
13
13
 
14
14
  tabVerticalOffset: '50px'
15
15
 
16
+ navClass: "nav-tabs"
17
+
16
18
  bodyTemplate: "containers/tab_view"
17
19
  bodyEl: "div.tab-content"
18
20
 
19
21
  initialize: (@options={})->
22
+ @navClass = "nav-list"if @navStyle is "list"
23
+
20
24
  Luca.containers.CardView::initialize.apply @, arguments
21
25
 
22
26
  _.bindAll @, "select", "highlightSelectedTab"
@@ -48,14 +52,23 @@ _.def('Luca.containers.TabView').extends('Luca.containers.CardView').with
48
52
  createTabSelectors: ()->
49
53
  tabView = @
50
54
  @each (component,index)->
51
- selector = tabView.make("li",{class:"tab-selector","data-target":index}, "<a>#{ component.title }</a>")
55
+ icon = "<i class='icon-#{ component.tabIcon }" if component.tabIcon
56
+ link = "<a href='#'>#{ icon || ''} #{ component.title }</a>"
57
+ selector = tabView.make("li",{class:"tab-selector","data-target":index}, link)
52
58
  tabView.tabContainer().append(selector)
53
59
 
60
+ if component.navHeading? and not tabView.navHeadings?[ component.navHeading ]
61
+ $( selector ).before( tabView.make('li',{class:"nav-header"}, component.navHeading))
62
+ tabView.navHeadings ||= {}
63
+ tabView.navHeadings[ component.navHeading ] = true
64
+
54
65
  highlightSelectedTab: ()->
55
66
  @tabSelectors().removeClass('active')
56
67
  @activeTabSelector().addClass('active')
57
68
 
58
69
  select: (e)->
70
+ e.preventDefault()
71
+
59
72
  me = my = $( e.target )
60
73
 
61
74
  @trigger "before:select", @
@@ -72,7 +85,7 @@ _.def('Luca.containers.TabView').extends('Luca.containers.CardView').with
72
85
  $("##{ @cid }-tabs-selector")
73
86
 
74
87
  tabContainer: ()->
75
- @$('ul.nav-tabs', @tabContainerWrapper() )
88
+ @$("ul.#{ @navClass }", @tabContainerWrapper() )
76
89
 
77
90
  tabSelectors: ()->
78
91
  @$( 'li.tab-selector', @tabContainer() )
@@ -11,23 +11,31 @@ _.def('Luca.containers.Viewport').extend('Luca.containers.CardView').with
11
11
  wrapperClass: 'row'
12
12
 
13
13
  initialize: (@options={})->
14
- Luca.core.Container::initialize.apply(@, arguments)
14
+ _.extend @, @options
15
15
 
16
16
  if Luca.enableBootstrap is true
17
17
  @wrapperClass = "row-fluid" if @fluid is true
18
- @$el.wrap("<div class='#{ @wrapperClass }' />").addClass('span12')
18
+ @$wrap( @wrapperClass )
19
+
20
+ Luca.core.Container::initialize.apply(@, arguments)
19
21
 
20
22
  $('html,body').addClass('luca-ui-fullscreen') if @fullscreen
21
23
 
22
24
  beforeRender: ()->
23
25
  Luca.containers.CardView::beforeRender?.apply(@, arguments)
24
26
 
25
- if Luca.enableBootstrap and @topNav and @fullscreen
26
- $('body').css('padding','40px')
27
+ #if Luca.enableBootstrap and @topNav and @fullscreen
28
+ # $('body').css('padding','40px')
27
29
 
28
30
  @renderTopNavigation() if @topNav?
29
31
  @renderBottomNavigation() if @bottomNav?
30
32
 
33
+ afterRender: ()->
34
+ Luca.containers.CardView::after?.apply(@, arguments)
35
+
36
+ if Luca.enableBootstrap is true
37
+ @$el.children().wrap('<div class="container" />')
38
+
31
39
  renderTopNavigation: ()->
32
40
  return unless @topNav?
33
41
 
@@ -45,6 +53,7 @@ _.def('Luca.containers.Viewport').extend('Luca.containers.CardView').with
45
53
 
46
54
 
47
55
  renderBottomNavigation: ()->
56
+ # IMPLEMENT
48
57
 
49
58
 
50
59