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

#164878049 Disable contextmenu on H mark image #707

Conversation

Luleherll
Copy link
Collaborator

@Luleherll Luleherll commented Aug 21, 2019

PT Story: H-mark image: users are right-clicking to just save it; it's not the customized version

https://www.pivotaltracker.com/n/projects/1904891/stories/164878049

Changes proposed in this pull request:

  1. Disable right-clicking on the H-mark
  2. Add a custom context menu
  3. Translate tooltip message
  4. Change H-mark download buttons' color and layout
  5. Write tests

Screenshots (Optional):

Screen Shot 2019-09-12 at 7 36 35 PM

Ready for review:
@weedySeaDragon @thesuss @patmbolger

- disable contextmenu
- add a tooltip on the image

[Finishes #164878049]
@Luleherll Luleherll force-pushed the ft-disable-contextmenu-on-H-mark-image-164878049 branch from 745ac79 to 9194401 Compare August 21, 2019 16:16
Copy link
Collaborator

@weedySeaDragon weedySeaDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Change the title of the PR to start with "WIP" to show that this is a "Work In Progress" -- that more work will be coming after you get feedback. I don't know if we discussed this; I likely didn't mention this to you.
    • need to get feedback from @thesuss and @patmbolger to see if they like this approach and if so, have suggestions for the specific wording in the tooltip
  2. add these to your list of changes that will need to be included in this PR:
    1. cucumber test(s)
    2. change CSS so that this tooltip (.tooltip-text ) has the same style as the others (fas_tooltip(...))

@patmbolger
Copy link
Collaborator

Initial comments (in addition to @weedySeaDragon 's):

  1. The download test is on right of the image (not the left)

  2. The tooltip message has to be translated to Swedish (and make sure that is shown when the language is set to that)

  3. I wonder if we should only show that tooltip when the user right right-clicks on the image? It might be slightly less annoying that way, although it may not be worth worrying about.

  4. I'm wondering if - instead of blocking the entire context menu, and using the tooltip - if we could just remove the menu items related to the image (save, download, get address, etc.).

    • if this is a lot of work (including browser-specific code) then it's not worth it,
    • as a developer, it would be nice to be able to access the "Inspect Element" option, but that is also not worth a lot of work.
  5. If we're going to do this, it makes sense to also apply the same treatment to the proof-of-membership(?)

Copy link
Collaborator

@patmbolger patmbolger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls see comments.

@Luleherll Luleherll changed the title #164878049 Disable contextmenu on H mark image [WIP] #164878049 Disable contextmenu on H mark image Aug 22, 2019
@rmzse
Copy link
Collaborator

rmzse commented Aug 22, 2019

One thing about the text design is to make the purpose clearer by cleaning it up. Make the buttons stand out as clear CTA's should and make the text shorter. A good way to improve UX is to show users what they can do and why.

Changing the text to "Download Image" and "Copy Link to Image" is a good start, check out the image.

The idea is to have the design work for you so you don't have to explain so much, which in turn makes intructions shorter and more compact. Also, by removing the CTA's from to outside of the text paragraph it is easier for the user to really understand what to do instead of insisting to right-click the image.

A better UX would actually be to have the image rendered (once) and the setup of the business through ImageMagick.

Screenshot at aug  22 19-28-06

- make context message show onclick only
- disable contextmenu on 'proof of membership' image
- Change CTA buttons layout

[#164878049]
- make context message show onclick only
- disable contextmenu on 'proof of membership' image
- Change CTA buttons layout

[#164878049]
@Luleherll Luleherll force-pushed the ft-disable-contextmenu-on-H-mark-image-164878049 branch from 62f3d30 to f8b7c0f Compare August 26, 2019 13:34
Copy link
Collaborator

@weedySeaDragon weedySeaDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some thoughts on layout and style, but want to wait to hear the feedback from @patmbolger and @thesuss about what they think of this in general.

Also -- I have the cucumber tests written and passing. I did need to add a cucumber step to handle right-clicking. Will post about that later.

- create custom-menu file
- fix custom context bug
- update yaml files
@Luleherll Luleherll changed the title [WIP] #164878049 Disable contextmenu on H mark image #164878049 Disable contextmenu on H mark image Sep 3, 2019
@@ -9,14 +9,10 @@ default: &default
development:
<<: *default
database: shf_project_development
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link
Collaborator

@weedySeaDragon weedySeaDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! It's getting there.

Now it's clear enough for me to realize that we need to change the functionality so that the button actually copies the URL to the clipboard -- which is different from what it was doing before. See my comments in the app/views/users/show.html.haml file.

Please also paste a new screenshot into the PR description so that we can see the latest version (since it's now been improved so much).

Link to it from your website and use it in social media.
Or Print to use in a physical context, for example, to show a customer.
image_how_to_use_html: You can download the image, take a screenshot,
link to it from you website and use it in social media,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"you" should be "your"

@@ -788,7 +788,8 @@ sv:
use_this_image_link_html: "<span style='font-weight: bold'>
Använd den här länken på en extern webbplats:
</span>"
show_image: Visa bild
show_image: Kopiera bildadress
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change this one because it makes the meaning of the key (show_image ) different from the meaning of the value (copy the url).

Instead, add a new entry (line) below (you'll need to ensure that the indentation is correct):

copy_image_url: Kopiera bildadress

Likewise for the English translation file (en.yml), add the same line but with the English words: copy_image_url: Copy the URL

Then you need to be sure to use the users.show.copy_image_url translation key instead of the old one (old = users.show.show_image).
(That includes places in cucumber tests.)

@@ -90,10 +90,10 @@
%p= t('.proof_of_membership_describe')
= link_to(t('.download_image'),
proof_of_membership_path(@user, render_to: :jpg),
class: 'btn btn-sm btn-secondary')
class: 'btn btn-sm btn-primary')
= link_to(t('.show_image'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now need to change the functionality: The action of this button needs to (1) get the short url for the proof of membership, (2) copy it to the user's clipboard, and then (3) show a message to the user that the information has been copied to their clipboard and that they can now paste it where needed.

Just glancing quickly at the code (you should look more carefully at it to verify), seems that you need to use the short_proof_of_membership_url(user) method to get the url.

We'll need new text in the locale files for (3) above. See my review comments in the sv.yml file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need the same stuff for the Company H-markt (need to copy the URL to the clipboard instead of showing the image and add the entries to the locale files)

@patmbolger
Copy link
Collaborator

Looking at the latest version of the PR:

  1. I think we need a little space after the blue buttons - set the bottom margin the same as the top margin.

Screen Shot 2019-09-05 at 10 58 30 AM

  1. When I click "download image", this is what I get:

Screen Shot 2019-09-05 at 11 00 17 AM

It shouldn't have that text at the top.

  1. "Copy link of the image" does not actually do that - it goes to a page where the user can see how the image renders, get it's size, and also get a shortened URL if they want to use that on the own website. So, either we change the wording ("View Image", or similar), or we change the action.

We should discuss at our next meeting and get consensus on how we want this to work.

- implement copy_to_clipboard button
- write logic for contextmenu actions
- update test

[Finishes #164878049]
%ul.custom-menu
%li{"data-action" => "download"}= t('users.show.download_image')
%li{"data-action" => "link"}= t('users.show.copy_image_url')
%li{"data-action" => "show"}= t('users.show.show_image')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hash attribute should start with one space after the opening brace
Hash attribute should end with one space before the closing brace
Files should end with a trailing newline

@@ -0,0 +1,4 @@
%ul.custom-menu
%li{"data-action" => "download"}= t('users.show.download_image')
%li{"data-action" => "link"}= t('users.show.copy_image_url')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hash attribute should start with one space after the opening brace
Hash attribute should end with one space before the closing brace

Copy link
Collaborator

@patmbolger patmbolger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks very nice! I have just one remaining comment - other than that I am fine with the PR.

@weedySeaDragon weedySeaDragon merged commit 3af0fd1 into AgileVentures:develop Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants