Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions distribution.amd/backbone-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ Form.validators = (function() {

})();


//==================================================================================================
//FIELDSET
//==================================================================================================
Expand Down Expand Up @@ -676,11 +675,24 @@ Form.Fieldset = Backbone.View.extend({
var $container = $(el),
selection = $container.attr('data-fields');

if (_.isUndefined(selection)) return;
if (_.isUndefined(selection)) {
return;
}

//Work out which fields to include (_compact used to trim empty string selection)
var keys = _.compact((selection == '*') ? self.selectedFields || _.keys(fields) : selection.split(','));

//include all keys if not specified
if (!keys.length){
keys = _.keys(fields);
}


_.each(fields, function(field) {
$container.append(field.render().el);
//Add them
_.each(keys, function(key) {
$container.append(fields[key].render().el);
});

});

this.setElement($fieldset);
Expand Down
2 changes: 1 addition & 1 deletion distribution.amd/backbone-forms.min.js

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions distribution/backbone-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ Form.validators = (function() {

})();


//==================================================================================================
//FIELDSET
//==================================================================================================
Expand Down Expand Up @@ -690,10 +689,19 @@ Form.Fieldset = Backbone.View.extend({
selection = $container.attr('data-fields');

if (_.isUndefined(selection)) return;

//Work out which fields to include (_compact used to trim empty string selection)
var keys = _.compact((selection == '*') ? self.selectedFields || _.keys(fields) : selection.split(','));

//include all keys if not specified
if (!keys.length)
keys = _.keys(fields);

_.each(fields, function(field) {
$container.append(field.render().el);
//Add them
_.each(keys, function(key) {
$container.append(fields[key].render().el);
});

});

this.setElement($fieldset);
Expand Down
2 changes: 1 addition & 1 deletion distribution/backbone-forms.min.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions src/fieldset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

//==================================================================================================
//FIELDSET
//==================================================================================================
Expand Down Expand Up @@ -87,10 +86,19 @@ Form.Fieldset = Backbone.View.extend({
selection = $container.attr('data-fields');

if (_.isUndefined(selection)) return;

_.each(fields, function(field) {
$container.append(field.render().el);

//Work out which fields to include (_compact used to trim empty string selection)
var keys = _.compact((selection == '*') ? self.selectedFields || _.keys(fields) : selection.split(','));

//include all keys if not specified
if (!keys.length)
keys = _.keys(fields);

//Add them
_.each(keys, function(key) {
$container.append(fields[key].render().el);
});

});

this.setElement($fieldset);
Expand Down