Skip to content

Commit

Permalink
fix: arrayed_json_field was not generating the field name for selects
Browse files Browse the repository at this point in the history
  • Loading branch information
jdugarte committed Sep 20, 2016
1 parent 820585d commit 5ba6f7b
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.2.1 (2016-09-20)

Bugfixes:

- arrayed_json_field was not generating the field name for selects

## 1.2.0 (2016-08-18)

Features:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
this.$container.on('click.bsfe.arrayedfield.data-api', '.remove-arrayed-field-row', this.removeRow.bind(this))
}

ArrayedField.VERSION = '1.2.0'
ArrayedField.VERSION = '1.2.1'

ArrayedField.prototype.addRow = function (event) {
var blueprint = this.$container.find(".blueprint-for-arrayed-field > .row").clone(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
this.$container.on('change.bsfe.duration.data-api', 'input.hours, input.minutes, input.seconds, input.milliseconds', this.updateSeconds.bind(this))
}

Duration.VERSION = '1.2.0'
Duration.VERSION = '1.2.1'

Duration.prototype.updateSeconds = function (event) {
var hidden = this.$container.find('input.duration-seconds')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
this.setInitialValues()
}

Scheduler.VERSION = '1.2.0'
Scheduler.VERSION = '1.2.1'

Scheduler.prototype.createEvents = function (event) {
this.$element.on('click.bsfe.scheduler.data-api', 'table.scheduler-badge', this.editSchedule.bind(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
this.createEvents()
}

SelectOrNew.VERSION = '1.2.0'
SelectOrNew.VERSION = '1.2.1'

SelectOrNew.prototype.createEvents = function () {
this.$element.on('change.bsfe.select-or-new.data-api', 'select', this.changeSelection.bind(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$(element).timepicker($.extend(defaults, options))
}

TimePicker.VERSION = '1.2.0'
TimePicker.VERSION = '1.2.1'


// TIME PICKER PLUGIN DEFINITION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
this.$container.on('change.bsfe.timespan.data-api', '.timespan-quantity, .timespan-unit', this.updateSeconds.bind(this))
}

Timespan.VERSION = '1.2.0'
Timespan.VERSION = '1.2.1'

Timespan.prototype.updateSeconds = function (event) {
var hidden = this.$container.find('.timespan-seconds')
Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap_form_extensions/arrayed_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def arrayed_json_field method, fields, **options
inputs = fields.map do |field|
case field[:type]
when :select
@template.select_tag nil, @template.options_for_select(field[:options], values[field[:name].to_s]), class: 'form-control'
@template.select_tag "#{object_name}[#{method}][][#{field[:name]}]", @template.options_for_select(field[:options], values[field[:name].to_s]), class: 'form-control'
else
@template.text_field_tag "#{object_name}[#{method}][][#{field[:name]}]", values[field[:name].to_s], class: 'form-control', placeholder: field[:name]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap_form_extensions/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module BootstrapFormExtensions
VERSION = "1.2.0"
VERSION = "1.2.1"
end
4 changes: 2 additions & 2 deletions test/arrayed_field_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def setup
expected = <<-HTML.chomp
<div class="form-group"><label class="control-label col-sm-2" for="thing_variables">Variables</label><div class="col-sm-10"><div data-arrayed-field="true"><div class="blueprint-for-arrayed-field" style="display:none;"><div class="row voffset1"><div class="col-sm-2"><select id="" class="form-control" data-name="thing[variables][][name]"><option value="var1">Variable One</option>
<option value="var2">Variable Two</option>
<option value="var3">Variable Three</option></select></div><div class="col-sm-2"><input type="text" id="" class="form-control" placeholder="value" data-name="thing[variables][][value]" /></div><div class="col-sm-1"><a class="btn btn-default remove-arrayed-field-row" href="javascript:void(0);"><i class=" glyphicon glyphicon-trash"></i></a></div></div></div><div class="arrayed-field-rows"><div class="row voffset1"><div class="col-sm-2"><select id="" class="form-control"><option value="var1">Variable One</option>
<option value="var3">Variable Three</option></select></div><div class="col-sm-2"><input type="text" id="" class="form-control" placeholder="value" data-name="thing[variables][][value]" /></div><div class="col-sm-1"><a class="btn btn-default remove-arrayed-field-row" href="javascript:void(0);"><i class=" glyphicon glyphicon-trash"></i></a></div></div></div><div class="arrayed-field-rows"><div class="row voffset1"><div class="col-sm-2"><select name="thing[variables][][name]" id="thing_variables__name" class="form-control"><option value="var1">Variable One</option>
<option value="var2">Variable Two</option>
<option value="var3">Variable Three</option></select></div><div class="col-sm-2"><input type="text" name="thing[variables][][value]" id="thing_variables__value" class="form-control" placeholder="value" /></div><div class="col-sm-1"><a class="btn btn-default remove-arrayed-field-row" href="javascript:void(0);"><i class=" glyphicon glyphicon-trash"></i></a></div></div><div class="row voffset1"><div class="col-sm-2"><select id="" class="form-control"><option value="var1">Variable One</option>
<option value="var3">Variable Three</option></select></div><div class="col-sm-2"><input type="text" name="thing[variables][][value]" id="thing_variables__value" class="form-control" placeholder="value" /></div><div class="col-sm-1"><a class="btn btn-default remove-arrayed-field-row" href="javascript:void(0);"><i class=" glyphicon glyphicon-trash"></i></a></div></div><div class="row voffset1"><div class="col-sm-2"><select name="thing[variables][][name]" id="thing_variables__name" class="form-control"><option value="var1">Variable One</option>
<option value="var2">Variable Two</option>
<option value="var3">Variable Three</option></select></div><div class="col-sm-2"><input type="text" name="thing[variables][][value]" id="thing_variables__value" class="form-control" placeholder="value" /></div><div class="col-sm-1"><a class="btn btn-default remove-arrayed-field-row" href="javascript:void(0);"><i class=" glyphicon glyphicon-trash"></i></a></div></div></div><div class="row voffset1"><div class="col-sm-12"><a class="btn btn-default add-arrayed-field-row" href="javascript:void(0);"><i class=" glyphicon glyphicon-plus"></i></a></div></div></div></div></div>
HTML
Expand Down

0 comments on commit 5ba6f7b

Please sign in to comment.