-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Re-implement the tag editing component #3800
Comments
This tag component will be moving to the PSM at some point in the future. It's also a horrible, horrible mess and needs rewriting to be a more independent component. One of the major things I'd like to change, is to have the tag component manage the tag models itself. Rather than sending off all of the tags with the post to be saved, I think it is cleaner, safer and more restful to save the tags independently when they are updated. To do this, I need to add new API endpoints, as we don't just need CRUD on a tag, but on a tag for a post. The restful way to do this would be to use a nested resource: POST Is different from POST In that it should create a relationship between the given tag and the given post, as well as creating the tag if it doesn't exist yet. I did a bit of research into how to do this with EmberData, given that this is quite a complex concept, and turned up a lot of information which said that nested resources were not supported. In a conversation with @novaugust he also expressed a concern of how EmberData was meant to know the difference between creating a tag, and creating a tag for a specific post. I turned up this solution, which it seems reasonably sane especially considering that we do want both the concepts of creating a tag and creating a tag & relating it to a post to exist in the admin UI: http://discuss.emberjs.com/t/current-way-to-handle-nested-resources/7477/4 I'm keen to get started speccing the issues to create the new API endpoints, so that the ember work can be done, but before I do I want to check that this is definitely a feasible and sensible path to go down, or if there are other / better suggestions. @novaugust @jaswilli @rwjblue your advise would be most welcome here! |
I feel weird having two endpoints for making tags. I'd love if we could On Sat, Apr 11, 2015 at 10:03 AM, Hannah Wolfe [email protected]
|
@novaugust from a wider API design view point, having another API endpoint for tags is correct, I believe, because Also sending the post with the tag in order to save, ends us up in a similar position to what we have now where we save all tags with the post, where the model code is playing a guessing game, saving the tag first and then trying to figure out what to do with the relationships. The intention is to make the endpoints much more explicit, if possible. |
I'd love to get a bit more feedback on this. I'm working on a full spec for what the API should look like and deciding which way to go on this is blocking me a bit. Not sure if I should break it out into a separate discussion issue, I really want to get a bit of clarity on whether or not we can or should support nested resources in the API. @sebgie I think from an API perspective it does make sense to move to Alternatively From http://discuss.emberjs.com/t/current-way-to-handle-nested-resources/7477/3:
Seems sane, although a bit complex. Perhaps putting a spec up with 2 versions would be easier to frame the conversation? |
I would say build the api you want to have; keep in mind that Ember won't be the only client consuming it, so we shouldn't be around it. We can make ember-data do what it needs to do to get the right endpoints =) Nesting really shouldn't be an issue; what gets weird is having nesting + first-level, but I reckon we could figure it out |
I don't see any problems with If the tag editor wants to get/set the tags linked to a post we can build something to do those requests using ajax. Even post- JSON-API 1.0 and Ember-Data 1.0 I don't think there's going to be a way to manipulate a resource's links without calling through that resource, so if we want to do that using ajax outside of Ember Data seems totally reasonable to me. |
There is a huge difference between the examples above:
For the tag editing component I think that we'll need both versions of the endpoint.
@novaugust 👍 ❤️ |
All good points, thanks 😍 I feel a bit better now about speccing this out. Watch this space! |
This is now required as a part of Zelda |
There are a couple of big parts to getting this done:
I'm thinking I need to write up a bit more of a spec - would be happy to do the API part if someone wanted to do the ember bits with me. |
Reference material: It would be great if the new field could work exactly like adding tags to a story on pocket.co |
raises hand for ember part @ErisDS Once I'm done with the inline-errors stuff, I can take a crack at the ember side of things. |
Whilst I think about it - one of the key things we want to do when we've got a new version of this component is introduce drag & drop re-ordering, so that's worth keeping in mind for whoever starts re-architecting this. |
jQueryUI has good built in functionality for the drag and drop portion of this here. That would IMO be the easiest to use because it wouldn't require any additional libraries to do. |
refs TryGhost#3800 - remove old tag editor code - reimplement tag editor as an ember component - add tag editor component to PSM
issue TryGhost#3800, closes TryGhost#5648 - uses ember-cli-selectize addon for the tag editing functionality in the PSM
The tag editing component is one of the more complex pieces of the Ghost admin interface, and it was largely 'ported' to Ember, as opposed to rebuilt in a more ember-y fashion. Unfortunately, it is largely broken, particularly on mobile, and needs a bit of a rethink.
The component consists of two main pieces: 1) the suggestions popover, which uses our ember popover component and I believe is working well across all devices, and 2) the tag input, which really needs some love. Any attempt to fix bugs with the current implementation promptly results in a game of whack-a-mole as other things break. I believe it needs rethinking and rebuilding from scratch.
This issue exists as a statement of intent that we will rebuild this, either on it's own if someone feels like taking it on, or possibly as part of the work on a new editor. All known bugs with this component are going to be closed as wontfix against this issue, pending the rewrite.
The text was updated successfully, but these errors were encountered: