From 050e1c0eca863c23f2e6d1bc21b568b5fdd26b11 Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Thu, 25 Aug 2011 16:39:09 +0200
Subject: [PATCH 1/9] fixed grid offset when re-ordering
---
data/grid/grid.js | 4 ++--
data/order/order.js | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/data/grid/grid.js b/data/grid/grid.js
index 3c64fae..9ece70a 100644
--- a/data/grid/grid.js
+++ b/data/grid/grid.js
@@ -112,8 +112,8 @@ $.Controller.extend("Mxui.Data.Grid",{
if(attr !== 'count' && attr !== 'updating'){
//want to throttle for rapid updates
params.attr('updating', true)
- clearTimeout(this.newRequestTimer,100)
- this.newRequestTimer = setTimeout(this.callback('newRequest', attr, val))
+ clearTimeout(this.newRequestTimer)
+ this.newRequestTimer = setTimeout(this.callback('newRequest', attr, val), 100)
}
},
newRequest : function(attr, val){
diff --git a/data/order/order.js b/data/order/order.js
index b03af6c..74e0e1d 100644
--- a/data/order/order.js
+++ b/data/order/order.js
@@ -79,9 +79,8 @@ $.Controller('Mxui.Data.Order',
order.unshift(newOrder)
}
}
- this.options.params.attrs({
- 'order' : order,
- offset: 0})
+ this.options.params.attr('offset', 0)
+ this.options.params.attr('order', order)
}
})
From e93c434017bec6ef3b24a4648e3f77182dfd3f95 Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Mon, 19 Sep 2011 22:05:19 +0200
Subject: [PATCH 2/9] commented model delegation, handle this stuff in
application controllers
---
data/grid/grid.js | 62 ++++++++++++++++++++--------------------
data/grid/views/init.ejs | 1 -
data/grid/views/list.ejs | 2 +-
3 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/data/grid/grid.js b/data/grid/grid.js
index d208edf..e6b5324 100644
--- a/data/grid/grid.js
+++ b/data/grid/grid.js
@@ -116,7 +116,7 @@ $.Controller.extend("Mxui.Data.Grid",{
if(clear){
this.empty();
}
-
+
this.append(trs);
// update the items
this.options.params.attr('count',items.count)
@@ -130,7 +130,7 @@ $.Controller.extend("Mxui.Data.Grid",{
}
},
newRequest : function(attr, val){
- var clear = true;
+ var clear = true;
if(!this.options.offsetEmpties && attr == "offset"){ // if offset changes and we have offsetEmpties false
clear = false;
}
@@ -141,35 +141,35 @@ $.Controller.extend("Mxui.Data.Grid",{
* @param {Object} called
* @param {Object} item
*/
- "{model} updated" : function(model, ev, item){
- var el = item.elements(this.element).html(this.options.row, item);
- if(this.options.updated){
- this.options.updated(this.element, el, item)
- }
- this.element.resize()
- },
- "{model} created" : function(model, ev, item){
- var newEl = $($.View("//mxui/data/grid/views/list",{
- items : [item],
- row: this.options.row
- }))
- if(this.options.append){
- this.options.append(this.element, newEl, item)
- }else{
- this.append(newEl)
- //newEl.appendTo(this.element).slideDown();
- }
- },
- "{model} destroyed" : function(model, ev, item){
- var el = item.elements(this.element)
- if(this.options.remove){
- this.options.remove(this.element,el, item)
- }else{
- el.slideUp( function(){
- el.remove();
- })
- }
- },
+// "{model} updated" : function(model, ev, item){
+// var el = item.elements(this.element).html(this.options.row, item);
+// if(this.options.updated){
+// this.options.updated(this.element, el, item)
+// }
+// this.element.resize()
+// },
+// "{model} created" : function(model, ev, item){
+// var newEl = $($.View("//mxui/data/grid/views/list",{
+// items : [item],
+// row: this.options.row
+// }))
+// if(this.options.append){
+// this.options.append(this.element, newEl, item)
+// }else{
+// this.append(newEl)
+// //newEl.appendTo(this.element).slideDown();
+// }
+// },
+// "{model} destroyed" : function(model, ev, item){
+// var el = item.elements(this.element)
+// if(this.options.remove){
+// this.options.remove(this.element,el, item)
+// }else{
+// el.slideUp( function(){
+// el.remove();
+// })
+// }
+// },
/**
* Insert rows into the table
* @param {Object} row insert after this row
diff --git a/data/grid/views/init.ejs b/data/grid/views/init.ejs
index ae0ca07..c97bcb5 100644
--- a/data/grid/views/init.ejs
+++ b/data/grid/views/init.ejs
@@ -12,5 +12,4 @@
-
\ No newline at end of file
diff --git a/data/grid/views/list.ejs b/data/grid/views/list.ejs
index 9f8cee6..82ba3b4 100644
--- a/data/grid/views/list.ejs
+++ b/data/grid/views/list.ejs
@@ -2,4 +2,4 @@
tabindex='0'>
<%== $.View(row, items[i] ) %>
-<%}%>
\ No newline at end of file
+<% } %>
\ No newline at end of file
From 9a2cb4a7e096d99dec698004e93791f6ec454e8b Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Tue, 20 Sep 2011 07:10:10 +0200
Subject: [PATCH 3/9] added prepend action to grid and tablescroll
---
data/grid/grid.js | 3 +++
layout/table_scroll/table_scroll.js | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/data/grid/grid.js b/data/grid/grid.js
index e6b5324..9f07bb1 100644
--- a/data/grid/grid.js
+++ b/data/grid/grid.js
@@ -178,6 +178,9 @@ $.Controller.extend("Mxui.Data.Grid",{
append: function( row, newEls ) {
this.element.children(":first").mxui_layout_table_scroll("append", row, newEls)
},
+ prepend: function(row, newEls){
+ this.element.children(":first").mxui_layout_table_scroll("prepend", row, newEls)
+ },
// remove all content from the grid
empty: function(){
this.element.children(":first").mxui_layout_table_scroll("empty")
diff --git a/layout/table_scroll/table_scroll.js b/layout/table_scroll/table_scroll.js
index a787c05..587d3b6 100644
--- a/layout/table_scroll/table_scroll.js
+++ b/layout/table_scroll/table_scroll.js
@@ -180,13 +180,21 @@ $.Controller("Mxui.Layout.TableScroll",{
if(!this.$.spacer){
this.changed(false);
}
-
+
this.$.spacer && this.$.spacer.before(after)
} else{
after.after(els)
}
this.element.resize();
},
+ prepend: function(before, els){
+ if(!els){
+ this.$.tbody && this.$.tbody.prepend(before)
+ } else{
+ before.before(els)
+ }
+ this.element.resize();
+ },
empty : function(){
this.$.tbody.children(":not(.spacing)").remove();
this.element.resize();
From e9d24359ac53ebb6417209a30293f30e432e1361 Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Tue, 20 Sep 2011 11:54:49 +0200
Subject: [PATCH 4/9] added stome stuff to grid
---
data/grid/grid.js | 61 ++++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/data/grid/grid.js b/data/grid/grid.js
index 9f07bb1..f56c0c8 100644
--- a/data/grid/grid.js
+++ b/data/grid/grid.js
@@ -4,7 +4,9 @@ steal('mxui/layout/table_scroll',
'jquery/view/ejs',
'mxui/data/order',
'mxui/util/selectable')
- .then('./views/th.ejs','./views/init.ejs','./views/list.ejs')
+ .then('jquery-ui/ui/jquery.effects.core.js')
+ .then('jquery-ui/ui/jquery.effects.slide.js')
+// .then('./views/th.ejs','./views/init.ejs','./views/list.ejs')
.then(function($){
/**
* A simple data grid that is paginate-able and sortable.
@@ -141,35 +143,34 @@ $.Controller.extend("Mxui.Data.Grid",{
* @param {Object} called
* @param {Object} item
*/
-// "{model} updated" : function(model, ev, item){
-// var el = item.elements(this.element).html(this.options.row, item);
-// if(this.options.updated){
-// this.options.updated(this.element, el, item)
-// }
-// this.element.resize()
-// },
-// "{model} created" : function(model, ev, item){
-// var newEl = $($.View("//mxui/data/grid/views/list",{
-// items : [item],
-// row: this.options.row
-// }))
-// if(this.options.append){
-// this.options.append(this.element, newEl, item)
-// }else{
-// this.append(newEl)
-// //newEl.appendTo(this.element).slideDown();
-// }
-// },
-// "{model} destroyed" : function(model, ev, item){
-// var el = item.elements(this.element)
-// if(this.options.remove){
-// this.options.remove(this.element,el, item)
-// }else{
-// el.slideUp( function(){
-// el.remove();
-// })
-// }
-// },
+ "{model} updated" : function(model, ev, item){
+ var el = item.elements(this.element).html(this.options.row, item);
+ if(this.options.updated){
+ this.options.updated(this.element, el, item)
+ }
+ this.element.resize()
+ },
+ "{model} created" : function(model, ev, item){
+ var newEl = $($.View("//mxui/data/grid/views/list",{
+ items : [item],
+ row: this.options.row
+ }))
+ if(this.options.append){
+ this.options.append(this.element, newEl, item)
+ }else{
+ this.prepend(newEl)
+ //newEl.appendTo(this.element).slideDown();
+ }
+ },
+ "{model} destroyed" : function(model, ev, item){
+ var el = item.elements(this.element)
+ if(this.options.remove){
+ this.options.remove(this.element,el, item)
+ }else{
+ el.remove()
+
+ }
+ },
/**
* Insert rows into the table
* @param {Object} row insert after this row
From dc03900506414d3e2ab0cd0b0b729baa97982495 Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Tue, 20 Sep 2011 20:42:53 +0200
Subject: [PATCH 5/9] rewrite grid to store template in options and factor dom
manipulation form on event
---
data/grid/grid.js | 65 ++++++++++++++++++++++++----------------
data/grid/views/init.ejs | 2 +-
2 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/data/grid/grid.js b/data/grid/grid.js
index f56c0c8..86fdce9 100644
--- a/data/grid/grid.js
+++ b/data/grid/grid.js
@@ -40,7 +40,10 @@ $.Controller.extend("Mxui.Data.Grid",{
defaults: {
columns: {},
params: new Mxui.Data,
- row : null,
+ initTemplate: '//mxui/data/grid/views/init.ejs',
+ listTemplate: '//mxui/data/grid/views/list.ejs',
+ titleTemplate: '//mxui/data/grid/views/th.ejs',
+ rowTemplate : null,
model : null,
noItems : "No Items",
// if true, can sort by multiple columns at a time
@@ -54,7 +57,23 @@ $.Controller.extend("Mxui.Data.Grid",{
// immediately uses the model to request items for the grid
loadImmediate: true,
- selectable : true
+ selectable : true,
+
+ // default crud manipulations
+
+ refresh: function(tbody, elt, newElt){
+ elt.replaceWith(newElt)
+ tbody.resize()
+ },
+ append: function(tbody, newElt){
+ tbody.prepend(newElt)
+ tbody.resize()
+ },
+ remove: function(tbody, elt){
+ elt.remove()
+ tbody.resize()
+ }
+
},
listensTo : ["select","deselect"]
},
@@ -65,7 +84,7 @@ $.Controller.extend("Mxui.Data.Grid",{
for(var name in this.options.columns){
count++;
}
- this.element.append( this.view({columns: this.options.columns, count: count}) )
+ this.element.append( this.view(this.options.initTemplate,{titleTemplate: this.options.titleTemplate, columns: this.options.columns, count: count}) )
this.element.children('table').mxui_layout_table_scroll({
filler: this.options.filler
@@ -110,8 +129,8 @@ $.Controller.extend("Mxui.Data.Grid",{
this.options.params.attr('updating', false);
- var trs = $(this.view('list',{
- row : this.options.row,
+ var trs = $(this.view(this.options.listTemplate,{
+ rowTemplate : this.options.rowTemplate,
items: items
}));
@@ -138,38 +157,31 @@ $.Controller.extend("Mxui.Data.Grid",{
}
this.options.model.findAll(this.options.params.attrs(), this.callback('list', clear))
},
+ _getRows: function(viewTemplateOption, items){
+ items = ( $.isArray(items) || items instanceof $.Model.List ) ? items : [items]
+ return $(this.view(this.options.listTemplate,{
+ rowTemplate : this.options[viewTemplateOption],
+ items: items
+ }, { columns: this.options.columns, renderer: this.options.renderer } ));
+ },
+
/**
* Listen for updates and replace the text of the list
* @param {Object} called
* @param {Object} item
*/
"{model} updated" : function(model, ev, item){
- var el = item.elements(this.element).html(this.options.row, item);
- if(this.options.updated){
- this.options.updated(this.element, el, item)
- }
- this.element.resize()
+ var el = item.elements(this.element),
+ newElt= this._getRows('rowTemplate', item)
+ this.options.refresh(this.$.tbody, el, newElt)
},
"{model} created" : function(model, ev, item){
- var newEl = $($.View("//mxui/data/grid/views/list",{
- items : [item],
- row: this.options.row
- }))
- if(this.options.append){
- this.options.append(this.element, newEl, item)
- }else{
- this.prepend(newEl)
- //newEl.appendTo(this.element).slideDown();
- }
+ var newEl = this._getRows('rowTemplate', item)
+ this.options.append(this.$.tbody, newEl)
},
"{model} destroyed" : function(model, ev, item){
var el = item.elements(this.element)
- if(this.options.remove){
- this.options.remove(this.element,el, item)
- }else{
- el.remove()
-
- }
+ this.options.remove(this.$.tbody, el)
},
/**
* Insert rows into the table
@@ -186,6 +198,7 @@ $.Controller.extend("Mxui.Data.Grid",{
empty: function(){
this.element.children(":first").mxui_layout_table_scroll("empty")
},
+
"select" : function(el, ev){
ev.preventDefault();
},
diff --git a/data/grid/views/init.ejs b/data/grid/views/init.ejs
index c97bcb5..3d23d3e 100644
--- a/data/grid/views/init.ejs
+++ b/data/grid/views/init.ejs
@@ -2,7 +2,7 @@
<%for(var col in columns){%>
- <%== view('//mxui/data/grid/views/th', {name: col, title: columns[col]}) %>
+ <%== $.View('//mxui/data/grid/views/th', {name: col, title: columns[col]}) %>
<%}%>
From e05858531c7cdc690f58282a040d882562b28153 Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Wed, 21 Sep 2011 15:54:33 +0200
Subject: [PATCH 6/9] use String.getObject insteand of Object
---
data/grid2/scripts/standalone/modelfixture.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/grid2/scripts/standalone/modelfixture.js b/data/grid2/scripts/standalone/modelfixture.js
index b4cc062..d327302 100644
--- a/data/grid2/scripts/standalone/modelfixture.js
+++ b/data/grid2/scripts/standalone/modelfixture.js
@@ -505,7 +505,7 @@
var parts = fullName.split(/\./),
shortName = parts.pop(),
- current = $.Class.getObject(parts.join('.')),
+ current = $.String.getObject(parts.join('.')),
namespace = current;
From bdac01cb821c221d4134cf71494d25f40859d82b Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Wed, 5 Oct 2011 21:53:34 +0200
Subject: [PATCH 7/9] failing filler demo
---
layout/fill/fill4.html | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 layout/fill/fill4.html
diff --git a/layout/fill/fill4.html b/layout/fill/fill4.html
new file mode 100644
index 0000000..08098a2
--- /dev/null
+++ b/layout/fill/fill4.html
@@ -0,0 +1,42 @@
+
+
+
+ fill 4
+
+
+
+
+
+
+
+
this element height lacks 2em
+
+
+
+
+
\ No newline at end of file
From 48119146a8b3c83a8ce4c23d5e43056565fa486f Mon Sep 17 00:00:00 2001
From: Nicolas
Date: Thu, 6 Oct 2011 10:02:48 +0200
Subject: [PATCH 8/9] stuff
---
data/grid/grid.js | 19 +++++----
data/grid/views/init.ejs | 5 +--
form/combobox/combobox.html | 2 +-
form/combobox/combobox.js | 3 +-
form/combobox/funcunit.html | 7 +++-
form/combobox/select/select.js | 2 +-
.../combobox/select/test/funcunit/funcunit.js | 5 +--
form/combobox/test/funcunit/funcunit.js | 41 +++++++++----------
.../test/funcunit/positioning4a_tests.js | 2 +-
layout/fill/fill.js | 9 +++-
layout/fit/fit.html | 10 ++---
layout/modal/modal.html | 10 +++--
layout/modal/modal.js | 4 +-
layout/positionable/positionable.html | 6 +--
nav/menu/menu.js | 2 +-
15 files changed, 70 insertions(+), 57 deletions(-)
diff --git a/data/grid/grid.js b/data/grid/grid.js
index 86fdce9..613cdd7 100644
--- a/data/grid/grid.js
+++ b/data/grid/grid.js
@@ -155,8 +155,11 @@ $.Controller.extend("Mxui.Data.Grid",{
if(!this.options.offsetEmpties && attr == "offset"){ // if offset changes and we have offsetEmpties false
clear = false;
}
- this.options.model.findAll(this.options.params.attrs(), this.callback('list', clear))
+ this.makeRequest(clear)
},
+ makeRequest: function(clear){
+ this.options.model.findAll(this.options.params.attrs(), this.callback('list', clear))
+ },
_getRows: function(viewTemplateOption, items){
items = ( $.isArray(items) || items instanceof $.Model.List ) ? items : [items]
return $(this.view(this.options.listTemplate,{
@@ -171,9 +174,11 @@ $.Controller.extend("Mxui.Data.Grid",{
* @param {Object} item
*/
"{model} updated" : function(model, ev, item){
- var el = item.elements(this.element),
- newElt= this._getRows('rowTemplate', item)
- this.options.refresh(this.$.tbody, el, newElt)
+ var el = item.elements(this.element)
+ if (el.length > 0){
+ var newElt= this._getRows('rowTemplate', item)
+ this.options.refresh(this.$.tbody, el, newElt)
+ }
},
"{model} created" : function(model, ev, item){
var newEl = this._getRows('rowTemplate', item)
@@ -189,14 +194,14 @@ $.Controller.extend("Mxui.Data.Grid",{
* @param {Object} newEls new elements to insert (they should be trs)
*/
append: function( row, newEls ) {
- this.element.children(":first").mxui_layout_table_scroll("append", row, newEls)
+ this.element.children(".mxui_layout_table_scroll").mxui_layout_table_scroll("append", row, newEls)
},
prepend: function(row, newEls){
- this.element.children(":first").mxui_layout_table_scroll("prepend", row, newEls)
+ this.element.children(".mxui_layout_table_scroll").mxui_layout_table_scroll("prepend", row, newEls)
},
// remove all content from the grid
empty: function(){
- this.element.children(":first").mxui_layout_table_scroll("empty")
+ this.element.children(".mxui_layout_table_scroll").mxui_layout_table_scroll("empty")
},
"select" : function(el, ev){
diff --git a/data/grid/views/init.ejs b/data/grid/views/init.ejs
index 3d23d3e..70d3bc3 100644
--- a/data/grid/views/init.ejs
+++ b/data/grid/views/init.ejs
@@ -7,9 +7,6 @@
-
- | Loading ... |
-
-
+
\ No newline at end of file
diff --git a/form/combobox/combobox.html b/form/combobox/combobox.html
index 71e5655..33ced71 100644
--- a/form/combobox/combobox.html
+++ b/form/combobox/combobox.html
@@ -466,7 +466,7 @@ No Selection
- steal.start();
+
@@ -17,4 +17,7 @@
diff --git a/form/combobox/combobox.js b/form/combobox/combobox.js
index 6a0e0da..604834a 100644
--- a/form/combobox/combobox.js
+++ b/form/combobox/combobox.js
@@ -1,5 +1,6 @@
steal('jquery/controller', 'jquery/lang/json', 'mxui/util/scrollbar_width', 'jquery/event/key')
- .controllers('dropdown','selectable').then(function() {
+ .then('./controllers/dropdown_controller.js','./controllers/selectable_controller.js')
+ .then(function() {
/**
* @tag home
diff --git a/form/combobox/funcunit.html b/form/combobox/funcunit.html
index c4360e7..460519e 100644
--- a/form/combobox/funcunit.html
+++ b/form/combobox/funcunit.html
@@ -1,13 +1,13 @@