-
-
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
Update backend New Image link for consistency #3786
Conversation
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.
Thanks @brchristian!
@@ -5,7 +5,9 @@ | |||
|
|||
<% content_for :page_actions do %> | |||
<% if can?(:create, Spree::Image) %> | |||
<li><%= link_to_with_icon('plus', t('spree.new_image'), new_admin_product_image_url(@product), id: 'new_image_link', class: 'btn btn-primary') %></li> | |||
<li id="new_image_link"> | |||
<%= link_to t('spree.new_image'), new_admin_product_image_url(@product), id: 'new_image_link', class: 'btn btn-primary' %> |
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.
Looks like you've applied the new_image_link
ID to both the li
and the a
elements. Since IDs should be unique and it's conceivable that someone could be using deface overrides to target this, I think it's best to leave the ID on the a
and not also add it to the li
.
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.
@jarednorman Good catch!
Looking around at other backend views, it seems like in https://github.com/solidusio/solidus/blob/master/backend/app/views/spree/admin/prices/index.html.erb#L5-L7 and https://github.com/solidusio/solidus/blob/master/backend/app/views/spree/admin/variants/index.html.erb#L7-L13, the convention is to put the ID on the li
element. I’d suggest that we do the same here for consistency with those other views.
I’ve force-pushed the latest; LMK what you think.
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.
Thanks @brchristian !
Ahh, actually there is more to the story here, because there are both specs and JS that expect the ID to live on the
For now, I have reversed my earlier decision and have force-pushed a version that puts the ID on the solidus/backend/app/views/spree/admin/prices/index.html.erb Lines 5 to 7 in 10a1199
solidus/backend/app/views/spree/admin/variants/index.html.erb Lines 7 to 13 in 10a1199
...so my OCD is triggered, but on the other hand, putting the ID on the Probably a more principled solution would be to move the |
Make consistent with visual style of other backend views
Thanks @brchristian! This triggered my OCD too... I guess another solution would be to update both the JS and the spec to just take the link that is contained in the |
This makes the New Image link consistent with visual style of other backend views.
Other Views:
Current Behavior:
New Behavior:
Checklist: