Skip to content

Commit

Permalink
Show datetimepicker when clicking in text field
Browse files Browse the repository at this point in the history
Note that the datetimepicker is not really accessible right now.
Hopefully, there will be some improvement related to this soon.
See here: Eonasdan/tempus-dominus#2390
  • Loading branch information
Splines committed Jul 11, 2023
1 parent 2e8bdcb commit 22abf4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/assets/javascripts/datetimepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// see https://getdatepicker.com
console.log('trying to import datetimepicker');
$('#assignment-picker').tempusDominus({
display: {
sideBySide: true
Expand All @@ -10,3 +9,7 @@ $('#assignment-picker').tempusDominus({
hourCycle: 'h23'
}
});

$('#assignment-picker-input').on('click', () => {
$('#assignment-picker-button').click();
});
4 changes: 3 additions & 1 deletion app/views/assignments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
'data-td-target': '#assignment-picker' %>
<span
class="input-group-text"
role="button"
id="assignment-picker-button"
data-td-target="#assignment-picker"
data-td-toggle="datetimepicker">
<i class="fas fa-calendar"></i>
<i class="bi bi-calendar-fill"></i>
</span>
</div>
</div>
Expand Down

0 comments on commit 22abf4f

Please sign in to comment.