New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide datetime time field element by default #637
Open
mstenta
wants to merge
10
commits into
farmOS:2.x
Choose a base branch
from
mstenta:2.x-datetime-toggle
base: 2.x
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5213b6c
Hide datetime time field element by default #637
mstenta 8889649
Only toggle time if #toggle_time is TRUE
paul121 34fb77e
Refactor datetime toggle to use data-farm-toggle-time attribute
paul121 c3d29ce
Hide time by default in planting quick form
paul121 dbca7b8
Hide time by default in asset move action form
paul121 54819e6
Hide time by default in asset group action form
paul121 3c362dc
Translate "Show time" text
paul121 8ca41b0
Rename library to datetime_toggle to be more explicit
paul121 369f884
Add toggle_time setting to datetime_timestamp_optional
paul121 f3be21f
Hide time by default for all FarmFieldFactory timestamp fields
paul121 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* Hide time input elements. */ | ||
div[data-farm-toggle-time="hide"] input.form-time { | ||
display: none; | ||
} | ||
|
||
/* Font size for toggle time text. */ | ||
div[data-farm-toggle-time] a.toggle-time { | ||
font-size: small; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(function (Drupal, once) { | ||
Drupal.behaviors.farm_ui_datetime = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: Rename to |
||
attach: function (context, settings) { | ||
var wrappers = once('toggle-time', '.form-datetime-wrapper div[data-farm-toggle-time="hide"]', context); | ||
wrappers.forEach(this.addShowTimeButton); | ||
}, | ||
addShowTimeButton: function (wrapper) { | ||
var link = document.createElement('a'); | ||
link.href = 'javascript: void(0)'; | ||
link.innerHTML = Drupal.t('Show time'); | ||
link.classList.add('toggle-time'); | ||
link.addEventListener('click', Drupal.behaviors.farm_ui_datetime.showTime); | ||
wrapper.querySelector('.form-type--date').appendChild(link); | ||
}, | ||
showTime: function (event) { | ||
var wrapper = event.target.closest('.form-datetime-wrapper div[data-farm-toggle-time]'); | ||
var link = wrapper.querySelector('a.toggle-time'); | ||
link.parentNode.removeChild(link); | ||
wrapper.dataset.farmToggleTime = 'show'; | ||
}, | ||
}; | ||
}(Drupal, once)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor tweak to make this language a bit clearer?