-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow users to inline update the variant of an image in admin #1580
Conversation
Great feature. Didn't had the time to loon into the implementation details, but this looks good on a first glance. One thing coming to mind, though. From a UX point of view I'm asking myself why we don't always show the select box With the current one preselected. This spares some clicks and we could get rid of the extra icons. Thoughts @Mandily ? |
I'm a little concerned that having two edit buttons will be confusing to users. @tvdeyen's suggestion would solve this. |
I have a couple of thoughts on preselecting values in dropdowns.
Without doing a full in depth exercise, I suspect that there's a good deal of dropdowns that would be suitable for a default value. With regards to the edit functionality of the tables - I think this is a great idea and I secretly thought it was going to take a lot longer before we'd start to see more of this added into the admin. So I'm excited you're doing it now @mtomov. I agree with Thomas and John - Instead of using additional icons within the tables, it would be nice to use the same convention that the product stock screen uses - swapping out the edit and delete buttons for a checkmark and X. I think it streamlines both the interaction and the UI. In the future, we could take this one step further and make everything in the page editable without having to go into an edit mode, and automatically save changes on field blur. But in the meantime I'm more than happy to see edit functionality being merged into the view pages themselves. |
Thanks @Mandily and the others for the feedback. It'll be great indeed if we have a standard for those. I just didn't fully understand what the final look would be with the checkmark and X buttons - do they go next to the current Edit and Delete buttons, is the select box always there available for change (no need to press Edit as Thomas suggested)? The only drawback of having the selectbox immediately there available is that it might look a bit ugly, as the deep blue on those select boxes puts a great focus on the area, as if though something is off .. Naturally, it's actually easier indeed from a programming point to have the select box directly there available .. so it's really up to you on how you're best seeing this.. as either option is sort of the same programming effort if you are concerned on that .. |
The checkmark and X buttons replace the edit and delete buttons when the user is in edit mode. Clicking on edit makes the whole row editable. Once the checkmark or X is clicked, the row goes back to view only, the edits are saved, and the edit and delete buttons appear again. I don't think we should avoid introducing a new and improved interaction model because a visual style is too garish. At some point I'd either like to update the select 2 inputs to v4 or restyle them ourselves with the rebrand. @jhawthorn might be better able to speak to that though. I realize this would also include a visual style change in the tables, but the best way I've seen this editable table thing done is that when a user hovers over a table row, it gets highlighted with the fields marked in white. I believe this is the best model, but before we go that way, I would want to understand if it's something that you think is doable across Solidus as a whole in a relatively short time period, because I would hate for a transition like this to take 4 years to complete. |
Amanda, the hover suggestion was brilliant, did it, wasn't difficult at all actually, hopefully can also be used by other similar in-table editing functionalities. With the hover, it's quite incredible how quickly one could change the variant on a whole bunch of images.
on hoveron click.. finally the user needs to click on the check icon to confirm the change |
I've actually gone about to re-write the javascript code for inline image update into a generic reusable It's all in the last commit, and as an example, to do it on a text field element in cell, one would need to create such markup:
Now, to eliminate a bit of duplication here - an improvement could be to check if the cell has an element with Another good improvement is to have the In this particular case for the image - I don't think we need to have the -- I think the option types/values admin section could be a good candidate for this kind of UI Looking forward to any input if that is in the right direction. Thank you! |
I downloaded your code and played around with the new functionality. I like it a lot! It would be nice if the styles between view and edit mode were the same, but I'm not sure if that's something we should tackle with this or leave it for the future rebrand. Especially as we can't do much with the dropdowns right now. What's your take on that? This might even be something I can do myself if you didn't want to get into the finicky css stuff. I know we technically don't need a save button on this page because we're auto saving, but I think we need to keep the save button on every page for peace of mind for the user. In the future, I'd like to introduce states to buttons, so if the page was saved, the button would look disabled, whereas if it needed to be saved, it would be brighter to attract attention. We don't need to do that for this feature, but I'd like to keep the save button here for future use. The third thing I wanted to bring attention to was that we don't have a stop gate for catching the user while in the middle of edit mode. If they start to edit a row and don't click on the check or x, and then navigate to another page, changes are lost. This is a behaviour that is consistent across Solidus, but I'd like to do something to remedy it in the near future: I see three options for this:
I'm a little more on the side of the adding this kind of functionality here than the save button, but I could be persuaded to add it in later if you had a good reason to leave it. WRT your most recent post, I like the idea of keeping the alt text an editable field. I was actually trying to figure out how we could do edit the thumbnail image too, but I think that gets more complicated than we want to get at this point. The good thing about making every field in a table editable is that we can then get rid of the edit pages. (WOOHOO!) I think the option types page you mentioned and a good handful of others would benefit from users being allowed to edit right in the table and getting rid of the edit pages altogether. In some cases we might have to add a few more columns to the table, but it shouldn't be too big of a deal. Let me know if you want to hash out any more ideas or need help identifying those pages. I've got an ongoing list that I can add those "optional" features I mentioned above, so let me know you're thoughts on the stop-gate solutions so I can log them in there if you decide to do them later. Thanks so much for taking this on! |
I don't think this a working for all tables. Often tables are just a list with little detail and the forms have way more options than ever will fit into a table row. Think of the product or order tables. For small tables I like the idea, though. Although I don't like auto save. What if the user change its mind or mistyped something? I like the current state with save and cancel buttons, although I think they should look different from the edit and delete buttons. It's very hard to tell for the user if the buttons currently visible are the edit buttons or save buttons. Maybe we should hide all buttons but the ones from the hovered row? Or we highlight the buttons if we are currently editing the row. I kinda like the first option. Would remove clutter from the views. |
I agree, I don't think this would be appropriate for all tables, but any of the smaller ones where all data can be represented in a single row should eventually be moved over to something like this. To clarify - it's EVERY FIELD in a small table, not EVERY TABLE. Contrary to your auto-save point - if the user mistyped something, they can just go back in and edit it again. It's not like we're asking them to confirm with a dialog when they save it anyway, so that extra step isn't really reducing the risk of human error. I was also thinking on the styles that the check and X are presented in vs the edit buttons. If we remove the other row's buttons, we do remove the clutter, but we also remove the user's ability to edit more than one row at a time. At first I was thinking that would be a good idea, but the more I think on it, the more I think we need to give users the power and freedom to edit these things as quickly and easily as possible. I can't say for sure, but I imagine that when a user needs to edit something on one of these pages, it's probably more than just one row. This is also why I like the auto-save feature. It allows users to be more efficient in entering/changing their data. In short - Solidus users are regular users of this software, I don't think we need to protect them from themselves as much as we would with a software that many people use only a few times. |
Thanks for your comments! Another round of updates in 0ac12bc focusing on simplification - have removed all the custom classes, reducing everything to a single On suggestion from Thomas - have removed all buttons on initial view. On hover - the Edit and Delete buttons come up. On Edit - the Update and Cancel buttons come up. I've dug out nice row context colours from spree's code depending on the button that you hover over. Have attached some screens as you might've only seen the Destroy (red) context colour and not the others. Hopefully that would help with the confusion between the buttons that you mentioned. Indeed would be nice if we have some colour in those buttons by default. Finally, have added a real Context colours: |
By any chance can we get the cancel tooltip to be orange to match the rest? The red is associated with delete/destroy in my mind. |
Sure, updated to orange in the last commit |
Is this not getting merged? If so, can we close it? |
I've rebased it onto latest master. Let me know what else I can do to demonstrate the achieved improvement. |
Hello, Although not a brand new PR, in the latest commit after speaking with @Mandily and @tvdeyen, I've:
Thank you for the feedback! |
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.
I like the feature, and have glanced over the code, but would like a second pair of eyes.
This looks great! I love how a small code change can make such a big difference to the usability of the admin. @mtomov Eventually I'd like to get to the point where we remove the buttons on the side and only show them on hover. Do you have any ideas/timeline on when we should implement that part? I'm also curious to know what the plan is for applying this code to the rest of the tables in the Solidus admin. |
Hi @Mandily - happy that you find it usable!
Thanks @mamhoff for reviewing! |
Come on, one more approve : ) Let's see if the new members would be more easily wooed @kennyadsl |
I will make a new issue in the next couple of days with other tables and link back to this one. |
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.
I have some comments (sorry, this review was pending and I forgot about it)
when @ESC_KEY then @onCancel(e) | ||
|
||
|
||
class Spree.Views.EditableTable |
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.
Can we split this up into separate files?
|
||
|
||
/* Inline Editable tables */ | ||
.inline-editable tr:not(:hover):not(.editing) { |
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.
I think we should rename the class into inline-editable-table
when we have this in the global namespace like this.
@@ -102,7 +102,7 @@ def link_to_delete(resource, options = {}) | |||
url = options[:url] || object_url(resource) | |||
name = options[:name] || Spree.t('actions.delete') | |||
confirm = options[:confirm] || Spree.t(:are_you_sure) | |||
options[:class] = "delete-resource" | |||
options[:class] = (options[:class].to_s + " delete-resource").strip |
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.
Several Ruby style guides recommends:
"#{options[:class]} delete-resource".strip
- by suggestion from @Mandily as the red is The red is associated with delete/destroy
Brilliant, thanks a lot @tvdeyen - all great spots! I think I've now addressed them all, and have squashed all my work into a single commit, which should describe it all. |
- On clicking an image row, users are able to select the variant of the image from a dropdown and persist the change using Enter from keyboard or the OK button to the right of the row - Use Escape or Cancel button to revert back without persisting the change The editing table functionality is generic enough to be used accross on similar table to allow users to edit the contents of the tables inline. Instructions to turn a table into an inline-editable one: 1. Add `inline-editable-table` class to the table 2. Add `check` and `cancel` buttons, and specify the update url on the `check/save` button. 3. Change the static text into input fields See `backend/app/views/spree/admin/images/_image_row.html.erb` for a usage example
🎊 Thanks! I made a followup #2042 |
Thanks all for helping out! |
This should allow users to update the variant of an image directly within the admin images table.
I have pretty much copy/pasted the code from the
payments/edit
class, so thanks @jhawthorn for that! Indeed a great learner on syncing Backbone's models with the backend.Not sure about the dotted underline below the small icons .. maybe I can remove that, but couldn't find an appropriate class for the purpose.