Skip to content

Commit

Permalink
Merge pull request #3013 from AlchemyCMS/backport/6.1-stable/pr-3002
Browse files Browse the repository at this point in the history
[6.1] Allow to set input_type on Datetime ingredient editor
  • Loading branch information
tvdeyen authored Sep 4, 2024
2 parents 0e5fa6a + 8e374a5 commit 27874a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/views/alchemy/ingredients/_datetime_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
datetime_editor, :value, {
name: datetime_editor.form_field_name,
id: datetime_editor.form_field_id,
value: datetime_editor.value
value: datetime_editor.value,
type: datetime_editor.settings[:input_type]
}
) %>
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions spec/dummy/config/alchemy/elements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@
- role: datetime
type: Datetime
hint: true
settings:
input_type: datetime
- role: file
type: File
hint: true
Expand Down
2 changes: 1 addition & 1 deletion spec/views/alchemy/ingredients/datetime_editor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

it "renders a datepicker" do
render element_editor
expect(rendered).to have_css('input[type="text"][data-datepicker-type="date"].date')
expect(rendered).to have_css('input[type="text"][data-datepicker-type="datetime"].datetime')
end
end

0 comments on commit 27874a1

Please sign in to comment.