8000 Use default ActionView options instead of default Formtastic options … · mirelon/activeadmin@2f972aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f972aa

Browse files
author
Michal Kováč
committed
Use default ActionView options instead of default Formtastic options in DateRangeInput
fixes activeadmin#5955
1 parent 86e5aa3 commit 2f972aa

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
* Display multiple flash messages in separate elements. [#5929] by [@mirelon]
88

9+
### Bug Fixes
10+
11+
* Use default ActionView options instead of default Formtastic options
12+
for DateRangeInput [#5957] by [@mirelon]
13+
914
## 2.5.0 [](https://github.com/activeadmin/activeadmin/compare/v2.4.0..v2.5.0)
1015

1116
### Enhancements
@@ -528,6 +533,7 @@ Please check [0-6-stable] for previous changes.
528533
[#5931]: https://github.com/activeadmin/activeadmin/pull/5931
529534
[#5938]: https://github.com/activeadmin/activeadmin/pull/5938
530535
[#5929]: https://github.com/activeadmin/activeadmin/pull/5929
536+
[#5957]: https://github.com/activeadmin/activeadmin/pull/5957
531537

532538
[@5t111111]: https://github.com/5t111111
533539
[@aarek]: https://github.com/aarek

lib/active_admin/inputs/filters/date_range_input.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def input_html_options_for(input_name = gt_input_name, placeholder = gt_input_pl
3333
class: "datepicker",
3434
maxlength: 10,
3535
placeholder: placeholder,
36-
value: current_value ? current_value.strftime("%Y-%m-%d") : "" }.merge(input_html_options)
36+
value: current_value ? current_value.strftime("%Y-%m-%d") : "" }.merge(options[:input_html] || {})
3737
end
3838

3939
def 963E gt_input_placeholder

spec/unit/filters/filter_form_builder_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def filter(name, options = {})
171171
it "should generate a date less than" do
172172
expect(body).to have_selector("input.datepicker[name='q[published_date_lteq]']")
173173
end
174+
it "should generate two inputs with different ids" do
175+
ids = body.find_css("input.datepicker").to_a.map { |n| n[:id] }
176+
expect(ids).to contain_exactly("q_published_date_lteq", "q_published_date_gteq")
177+
end
174178

175179
context "with input_html" do
176180
let(:body) { filter :published_date, input_html: { 'autocomplete': 'off' } }

0 commit comments

Comments
 (0)
0