-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Improvements for the content.js module #6799
Merged
Merged
Conversation
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
Co-authored-by: Nico Hoffmann ෴. <me@nhoffmann.com>
distantnative
approved these changes
Nov 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Summary of changes
this.$panel.api.post('/path', data, options, 'POST', silent = true)
after:this.$panel.api.post('/path', data, { silent: true})
This is now used inthis.$panel.content.save()
to keep safe calls silent.changes
property for thek-model-tabs
component to pass an object of changes directly. This will make the model tabs more independent from the content module and we can reuse the computed changes object that we already define in the model views.this.$panel.content.discard(api)
this.$panel.content.isLocked(api)
this.$panel.content.lock(api)
this.$panel.content.publish(values, api)
this.$panel.content.save(values, api)
this.$panel.content.saveLazy(values, api)
this.$panel.content.update(values, api)
this.$panel.content.isLocked()
this.$panel.content.lock()
this.$panel.content.changes()
this.$panel.content.isCurrent()
this.$panel.content.saveLazy()
this.$panel.content.isSaved
this.$panel.content.originals
this.$panel.content.saveLazy
is now used in the model viewonInput
event instead of throttling it directly in the view. This means that devs can now choose between callingthis.$panel.content.save
orthis.$panel.content.saveLazy
if the action should be delayed.onSave
method has been renamed toonViewSave
This matches the custom event in the events.js, which will trigger this and causes less confusion. This event is only fired onkeydown.cmd.s
and will in fact submit the form and not simply save the content. That's why I believe we should rename this right away.isUnsaved
computed property has been renamed tohasChanges
. This is also supposed to clean up possible confusions, because it's computing the number of items in thethis.$panel.content.changes()
object.content.save
content.discard
content.publish
content.save
event is used to update the new ModelViewisSaved
data property. By moving it to the ModelView and using the custom event to keep it updated, we can make sure that it is always correct and bound to the right api endpoint. Otherwise, we would need to keep track of multipleisSaved
states in the content module.on
methods have been removed from the PreviewView.protectedFields
property has been removed from ModelViewOutlook
Methods that depend on data from the current view could later be refactored to make API calls instead whenever they are used with different endpoints.
I.e. right now
this.$panel.content.lock()
wiil only work for the current view and throw an error if you try to pass a different endpoint. But it's totally possible to simply check for the endpoint and then make an async call to that view instead and get the lock info from there. The same would work forthis.$panel.content.changes()
for example. But I didn't want to blow this up even more. I just think that this is a nice way forward that could be really useful.Ready?
For review team