Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
14 changes: 11 additions & 3 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 @@ -677,10 +676,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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These if statements without curly braces don't pass jslint. I realize there are a lot of brace-less if statements in this project, but I think it would be best to use them moving forward.


_.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