Skip to content
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

Update tag management UI with the post count #4683

Closed
ErisDS opened this issue Dec 18, 2014 · 10 comments · Fixed by #4689
Closed

Update tag management UI with the post count #4683

ErisDS opened this issue Dec 18, 2014 · 10 comments · Fixed by #4689
Labels
affects:admin Anything relating to Ghost Admin
Milestone

Comments

@ErisDS
Copy link
Member

ErisDS commented Dec 18, 2014

Once #4654 is merged, it will be possible to add the post count to the tag management UI.

This will require:

  • updating the client side models in Ember to recognise the post_count property and making sure it doesn't get sent back to the server
  • updating the API call on the tag management screen to send ?include=post_count
  • replacing N/A in the UI with the real post count
  • updating the delete modal with a message similar to the one in the delete user modal, which explains that the tag will be removed from X posts.

I think that's it :)

@ErisDS ErisDS added the affects:admin Anything relating to Ghost Admin label Dec 18, 2014
@ErisDS ErisDS added this to the Next Backlog milestone Dec 18, 2014
@novaugust novaugust mentioned this issue Dec 18, 2014
20 tasks
@ekulabuhov
Copy link
Contributor

Mind me taking this one? Started working on this already while testing API.

@ErisDS
Copy link
Member Author

ErisDS commented Dec 18, 2014

@ekulabuhov go for it ;)

@ErisDS
Copy link
Member Author

ErisDS commented Dec 20, 2014

Hi @ekulabuhov how are you getting on with this? This is one of the last pieces of tag management and we are aiming to ship it on Monday, so it'd be great if you can let us know if you're able to do it over the weekend. Thanks!

@ekulabuhov
Copy link
Contributor

Hi @ErisDS no problem, give me an hour & I'll be done with it.

@ekulabuhov
Copy link
Contributor

@ErisDS, the only part that is missing from my last commit is: "making sure it doesn't get sent back to the server". Do you mean the data included in the XHR request? Is that implemented anywhere else in the code? I can see ghost sending properties like "created_by", "creation_date", etc. when saving tags/posts. Guess they shouldn't be there either? Thanks!

@ErisDS
Copy link
Member Author

ErisDS commented Dec 20, 2014

Hi @ekulabuhov, yep, this has been implemented for the post model: https://github.com/TryGhost/Ghost/blob/master/core/client/serializers/post.js#L56

@ekulabuhov
Copy link
Contributor

Hi @ErisDS, last part is included now. Unfortunately, I've broken "New Tag" functionality on the Settings screen, as the new tag does not appear in the list when you press that button anymore. I spent quite a while trying to debug this problem and narrowed it down to a change in this line:
ekulabuhov@20059fb#diff-a0573194af85c8756d5bca910bc257c8L25

Now, I don't have enough experience with emberjs to tell what's wrong with that line. Could somebody help me here, please? Thank you!

@jaswilli
Copy link
Contributor

@ekulabuhov I made a couple comments on #4689. If you update the PR to address them then I'll merge it as a partial solution and follow it up with a new PR to close this issue out.

To answer your question, the reason you're not seeing the new tag in the list has to do with the data that's provided to the controller by store.find(). It's not a dynamic container, so if something else (e.g., a tag) gets added the template won't see it until the controller gets a new set of data somehow. Check out the documentation on store.filter() vs store.find().

ekulabuhov added a commit to ekulabuhov/Ghost that referenced this issue Dec 22, 2014
closes TryGhost#4683
- added post count to 'delete tag' modal
- fixed lint errors
- preventing extra data to be sent to server
- adjustments suggested by @jaswilli
@ekulabuhov
Copy link
Contributor

Thanks @jaswilli ! I made suggested changes.

I'm sorry, but I'm not sure if you got me right (or maybe I didn't get you). This is the current behavior on master:
master

Both use store.find(), but in my version {include: post_count} is added and that brakes model binding on the client side (last record is not added anymore).

@jaswilli
Copy link
Contributor

Thanks for the screenshot, I see what you're saying now. Apparently I misspoke above and the container provided by store.find('tag') is "live," but if you add a query parameter (`{include: 'post_count'}') it must not be any more. Maybe it's a change in behavior from an earlier version of Ember--I'd have to dig into it to see exactly what's going on.

It's actually a good thing as we don't want a new, unsaved tag to show up in that list. In my follow-up PR I'm going to use a store.filter() call in the route so that list will be "live" and only show tags that have been saved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:admin Anything relating to Ghost Admin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants